当前位置: 首页>>代码示例>>PHP>>正文


PHP TemplateManager::loadTemplateByRemote方法代码示例

本文整理汇总了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");
//.........这里部分代码省略.........
开发者ID:xerox8521,项目名称:FS-Gamepanel,代码行数:101,代码来源:Task.class.php


注:本文中的TemplateManager::loadTemplateByRemote方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。