分析鸟云的UpgradeService代码,升级的所有参数和方法都在里面
第一步:在其他文件实例化UpgradeService:
$this->upgradeService = new UpgradeService(
REAL_PATH,
"update.niaoyun.com",
$this->dataDir,
$dbconfig,
$agentDomain,
$agentid,
$agentPass,
$templates
);
UpgradeService实例化后,参数已经赋值:
下面是UpgradeService..php
public function __construct($appRootDir, $masterHost, $tempDir, $dbConfig, $agentDomain, $agentid, $agentPassword, $templates)
{
$this->masterHost = $masterHost;
$this->agengid = $agentid;
$this->agentDomain = $agentDomain;
$this->agentPassword = $agentPassword;
............
}
第二步:通过$this->upgradeService便可调用UpgradeService..php里面定义的方法啦
本文解析了鸟云的UpgradeService代码实现,介绍了如何实例化UpgradeService并使用其方法进行系统升级。通过具体实例,展示了参数传递过程及构造函数的作用。

被折叠的 条评论
为什么被折叠?



