本文整理匯總了PHP中TemplateManager::loadTemplateByRemote方法的典型用法代碼示例。如果您正苦於以下問題:PHP TemplateManager::loadTemplateByRemote方法的具體用法?PHP TemplateManager::loadTemplateByRemote怎麽用?PHP TemplateManager::loadTemplateByRemote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TemplateManager
的用法示例。
在下文中一共展示了TemplateManager::loadTemplateByRemote方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
public function execute()
{
$done = true;
if (!$this->_validate()) {
return $this->delete();
}
try {
switch ($this->getData("type")) {
case TASK_SERVER_INIT:
$err = $this->server->initializeForUse();
if (strlen($err) == 0) {
Core::addToTaskLog("Server " . $this->getData("serverID") . " has been initialized.");
} else {
Core::addToTaskLog("Server " . $this->getData("serverID") . " could not be initialized. Reason: {$err}.");
}
break;
case TASK_SERVER_UPDATE:
$server = new PhysicalServer($this->getData('serverID'));
$server->updateServer();
Core::addToTaskLog("Server " . $this->getData("serverID") . " has been updated");
break;
case TASK_SERVER_INSTALL_TEMPLATE:
if (!PhysicalServerManager::existsById($this->getData("serverID"))) {
$this->delete();
}
if (!TemplateManager::existsById($this->getData("addInfo"))) {
$this->delete();
}
$server = new PhysicalServer($this->getData("serverID"));
$template = new Template($this->getData("addInfo"));
$template->installOnServer($server);
Core::addToTaskLog("Template (" . $template->getData("id") . ", " . $template->getData("gameName") . ") installed on server " . $server->getData("id") . " (" . $server->getData("name") . ")");
break;
case TASK_TEMPLATES_INSTALL_FROM_REMOTE:
$template = TemplateManager::loadTemplateByRemote($this->getData("addInfo"));
Core::addToTaskLog("Gameserver templated downloaded. (" . $template->getData("gameName") . ")");
break;
case TASK_GAMESERVER_UPDATESETTINGS:
if (GameserverManager::existsById($this->getData("addInfo"))) {
echo "Updating Config.";
$gameserver = new Gameserver($this->getData("addInfo"));
$gameserver->settingsUpdateOnServer();
$id = $gameserver->getData("id");
Core::addToTaskLog("Gameserver settings saved. (ID: {$id})");
} else {
$id = $this->getData("addInfo");
Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
}
break;
case TASK_GAMESERVER_INSTALL:
if (GameserverManager::existsById($this->getData("addInfo"))) {
$gameserver = new Gameserver($this->getData("addInfo"));
$gameserver->install();
$id = $gameserver->getData("id");
Core::addToTaskLog("Gameserver installed. (ID: {$id})");
} else {
$id = $this->getData("addInfo");
Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
}
break;
case TASK_GAMESERVER_UNINSTALL:
if (GameserverManager::existsById($this->getData("addInfo"))) {
$gameserver = new Gameserver($this->getData("addInfo"));
$done = $gameserver->delete();
$id = $gameserver->getData("id");
if ($done) {
Core::addToTaskLog("Gameserver deleted. (ID: {$id})");
}
} else {
$id = $this->getData("addInfo");
Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
}
break;
case TASK_GAMESERVER_START:
if (GameserverManager::existsById($this->getData("addInfo"))) {
$gameserver = new Gameserver($this->getData("addInfo"));
$gameserver->start();
$id = $gameserver->getData("id");
Core::addToTaskLog("Gameserver started. (ID: {$id})");
} else {
$id = $this->getData("addInfo");
Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
}
break;
case TASK_GAMESERVER_STOP:
if (GameserverManager::existsById($this->getData("addInfo"))) {
$gameserver = new Gameserver($this->getData("addInfo"));
$gameserver->stop();
$id = $gameserver->getData("id");
Core::addToTaskLog("Gameserver stopped. (ID: {$id})");
} else {
$id = $this->getData("addInfo");
Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
}
break;
case TASK_GAMESERVER_DISABLE:
if (GameserverManager::existsById($this->getData("addInfo"))) {
$gameserver = new Gameserver($this->getData("addInfo"));
$gameserver->disable();
$id = $gameserver->getData("id");
//.........這裏部分代碼省略.........