async plugin update check
This commit is contained in:
		
				
					committed by
					
						 Steffen Schröder
						Steffen Schröder
					
				
			
			
				
	
			
			
			
						parent
						
							1011fbdde1
						
					
				
				
					commit
					9dc3ba395b
				
			| @@ -38,10 +38,6 @@ class PluginManager { | |||||||
|  |  | ||||||
| 		$this->pluginMenu = new PluginMenu($maniaControl); | 		$this->pluginMenu = new PluginMenu($maniaControl); | ||||||
| 		$this->maniaControl->configurator->addMenu($this->pluginMenu); | 		$this->maniaControl->configurator->addMenu($this->pluginMenu); | ||||||
|  |  | ||||||
| 		/*$this->fetchPluginList(function ($data) { |  | ||||||
| 			var_dump($data); |  | ||||||
| 		});*/ |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -353,16 +349,12 @@ class PluginManager { | |||||||
| 	 * @param      $function | 	 * @param      $function | ||||||
| 	 * @param bool $ignoreVersion | 	 * @param bool $ignoreVersion | ||||||
| 	 */ | 	 */ | ||||||
| 	private function fetchPluginList($function) { | 	public function fetchPluginList($function) { | ||||||
| 		$url = ManiaControl::URL_WEBSERVICE . 'plugins'; | 		$url = ManiaControl::URL_WEBSERVICE . 'plugins'; | ||||||
|  |  | ||||||
| 		$this->maniaControl->fileReader->loadFile($url, function ($dataJson, $error) use (&$function) { | 		$this->maniaControl->fileReader->loadFile($url, function ($dataJson, $error) use (&$function) { | ||||||
| 			$data = json_decode($dataJson); | 			$data = json_decode($dataJson); | ||||||
| 			if (!$data || !isset($data[0])) { | 			call_user_func($function, $data, $error); | ||||||
| 				return; |  | ||||||
| 			} |  | ||||||
|  |  | ||||||
| 			call_user_func($function, $data[0]); |  | ||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -3,8 +3,8 @@ | |||||||
| namespace ManiaControl\Update; | namespace ManiaControl\Update; | ||||||
|  |  | ||||||
| use ManiaControl\Admin\AuthenticationManager; | use ManiaControl\Admin\AuthenticationManager; | ||||||
| use ManiaControl\Callbacks\CallbackManager; |  | ||||||
| use ManiaControl\Callbacks\CallbackListener; | use ManiaControl\Callbacks\CallbackListener; | ||||||
|  | use ManiaControl\Callbacks\CallbackManager; | ||||||
| use ManiaControl\Callbacks\TimerListener; | use ManiaControl\Callbacks\TimerListener; | ||||||
| use ManiaControl\Commands\CommandListener; | use ManiaControl\Commands\CommandListener; | ||||||
| use ManiaControl\Files\FileUtil; | use ManiaControl\Files\FileUtil; | ||||||
| @@ -17,9 +17,9 @@ use ManiaControl\Plugins\PluginMenu; | |||||||
| /** | /** | ||||||
|  * Manager checking for ManiaControl Core and Plugin Updates |  * Manager checking for ManiaControl Core and Plugin Updates | ||||||
|  * |  * | ||||||
|  * @author steeffeen & kremsy |  * @author    steeffeen & kremsy | ||||||
|  * @copyright ManiaControl Copyright © 2014 ManiaControl Team |  * @copyright ManiaControl Copyright © 2014 ManiaControl Team | ||||||
|  * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 |  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||||
|  */ |  */ | ||||||
| class UpdateManager implements CallbackListener, CommandListener, TimerListener { | class UpdateManager implements CallbackListener, CommandListener, TimerListener { | ||||||
| 	/* | 	/* | ||||||
| @@ -98,7 +98,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		//Check if a new Core Update is Available | 		//Check if a new Core Update is Available | ||||||
| 		$self = $this; | 		$self         = $this; | ||||||
| 		$maniaControl = $this->maniaControl; | 		$maniaControl = $this->maniaControl; | ||||||
| 		$this->checkCoreUpdateAsync(function (UpdateData $updateData) use ($self, $maniaControl, $time) { | 		$this->checkCoreUpdateAsync(function (UpdateData $updateData) use ($self, $maniaControl, $time) { | ||||||
| 			$buildDate   = strtotime($self->getCurrentBuildDate()); | 			$buildDate   = strtotime($self->getCurrentBuildDate()); | ||||||
| @@ -162,7 +162,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$version = $this->maniaControl->client->getVersion(); | 		$version = $this->maniaControl->client->getVersion(); | ||||||
| 		if($this->coreUpdateData->minDedicatedBuild > $version->build){ | 		if ($this->coreUpdateData->minDedicatedBuild > $version->build) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -203,7 +203,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				$version = $self->maniaControl->client->getVersion(); | 				$version = $self->maniaControl->client->getVersion(); | ||||||
| 				if($updateData->minDedicatedBuild > $version->build){ | 				if ($updateData->minDedicatedBuild > $version->build) { | ||||||
| 					$self->maniaControl->chat->sendError("No new Build for this Server-version available!", $player->login); | 					$self->maniaControl->chat->sendError("No new Build for this Server-version available!", $player->login); | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
| @@ -220,7 +220,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				$version = $self->maniaControl->client->getVersion(); | 				$version = $self->maniaControl->client->getVersion(); | ||||||
| 				if($updateData->minDedicatedBuild > $version->build){ | 				if ($updateData->minDedicatedBuild > $version->build) { | ||||||
| 					$self->maniaControl->chat->sendError("No new Build for this Server-version available!", $player->login); | 					$self->maniaControl->chat->sendError("No new Build for this Server-version available!", $player->login); | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
| @@ -246,27 +246,27 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 	 * @param array $callback | 	 * @param array $callback | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handleManialinkPageAnswer(array $callback) { | 	public function handleManialinkPageAnswer(array $callback) { | ||||||
| 		$actionId    = $callback[1][2]; | 		$actionId = $callback[1][2]; | ||||||
| 		$update      = (strpos($actionId, PluginMenu::ACTION_PREFIX_UPDATEPLUGIN) === 0); | 		$update   = (strpos($actionId, PluginMenu::ACTION_PREFIX_UPDATEPLUGIN) === 0); | ||||||
| 		$install     = (strpos($actionId, PluginInstallMenu::ACTION_PREFIX_INSTALLPLUGIN) === 0); | 		$install  = (strpos($actionId, PluginInstallMenu::ACTION_PREFIX_INSTALLPLUGIN) === 0); | ||||||
|  |  | ||||||
| 		$login  = $callback[1][1]; | 		$login  = $callback[1][1]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->playerManager->getPlayer($login); | ||||||
|  |  | ||||||
| 		if($update) { | 		if ($update) { | ||||||
| 			$pluginClass = substr($actionId, strlen(PluginMenu::ACTION_PREFIX_UPDATEPLUGIN)); | 			$pluginClass = substr($actionId, strlen(PluginMenu::ACTION_PREFIX_UPDATEPLUGIN)); | ||||||
| 			if($pluginClass == 'All') { | 			if ($pluginClass == 'All') { | ||||||
| 				$this->checkPluginsUpdate($player); | 				$this->checkPluginsUpdate($player); | ||||||
| 			} else { | 			} else { | ||||||
| 				$newUpdate = $this->checkPluginUpdate($pluginClass); | 				$newUpdate = $this->checkPluginUpdate($pluginClass); | ||||||
| 				if($newUpdate != false) { | 				if ($newUpdate != false) { | ||||||
| 					$newUpdate->pluginClass = $pluginClass; | 					$newUpdate->pluginClass = $pluginClass; | ||||||
| 					$this->updatePlugin($newUpdate, $player, true); | 					$this->updatePlugin($newUpdate, $player, true); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if($install) { | 		if ($install) { | ||||||
| 			$pluginId = substr($actionId, strlen(PluginInstallMenu::ACTION_PREFIX_INSTALLPLUGIN)); | 			$pluginId = substr($actionId, strlen(PluginInstallMenu::ACTION_PREFIX_INSTALLPLUGIN)); | ||||||
|  |  | ||||||
| 			$url            = ManiaControl::URL_WEBSERVICE . 'plugins?id=' . $pluginId; | 			$url            = ManiaControl::URL_WEBSERVICE . 'plugins?id=' . $pluginId; | ||||||
| @@ -328,13 +328,13 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$self = $this; | 		$self = $this; | ||||||
| 		$this->checkCoreUpdateAsync(function (UpdateData $updateData) use (&$self,&$player) { | 		$this->checkCoreUpdateAsync(function (UpdateData $updateData) use (&$self, &$player) { | ||||||
| 			if (!$updateData) { | 			if (!$updateData) { | ||||||
| 				$self->maniaControl->chat->sendError('Update is currently not possible!', $player->login); | 				$self->maniaControl->chat->sendError('Update is currently not possible!', $player->login); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			$version = $self->maniaControl->client->getVersion(); | 			$version = $self->maniaControl->client->getVersion(); | ||||||
| 			if($updateData->minDedicatedBuild > $version->build){ | 			if ($updateData->minDedicatedBuild > $version->build) { | ||||||
| 				$self->maniaControl->chat->sendError("ManiaControl update version requires a newer Dedicated Server version!", $player->login); | 				$self->maniaControl->chat->sendError("ManiaControl update version requires a newer Dedicated Server version!", $player->login); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| @@ -368,36 +368,51 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Checks if there are outdated plugins active. | 	 * Checks if there are outdated plugins active. | ||||||
|  | 	 * | ||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function checkPluginsUpdate(Player $player = null) { | 	public function checkPluginsUpdate(Player $player = null) { | ||||||
| 		$this->maniaControl->log('[UPDATE] Checking plugins for newer versions ...'); | 		$this->maniaControl->log('[UPDATE] Checking plugins for newer versions ...'); | ||||||
| 		$outdatedPlugins = array(); |  | ||||||
|  |  | ||||||
| 		foreach ($this->maniaControl->pluginManager->getPluginClasses() as $pluginClass) { | 		$self = $this; | ||||||
| 			$pluginData = $this->checkPluginUpdate($pluginClass); | 		$this->maniaControl->pluginManager->fetchPluginList(function ($data, $error) use (&$self, &$player) { | ||||||
| 			if ($pluginData != false) { | 			$outdatedPlugins = array(); | ||||||
| 				$pluginData->pluginClass = $pluginClass; |  | ||||||
| 				$outdatedPlugins[] = $pluginData; |  | ||||||
| 				$this->maniaControl->log('[UPDATE] '.$pluginClass.': There is a newer version available: '.$pluginData->currentVersion->version.'!'); |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		if (count($outdatedPlugins) > 0) { | 			if (!$data || $error) { | ||||||
| 			$this->maniaControl->log('[UPDATE] Checking plugins: COMPLETE, there are '.count($outdatedPlugins).' outdated plugins, now updating ...'); | 				$self->maniaControl->log('[UPDATE] Error while checking plugins for newer version'); | ||||||
| 			if ($player) { | 				return; | ||||||
| 				$this->maniaControl->chat->sendInformation('Checking plugins: COMPLETE, there are '.count($outdatedPlugins).' outdated plugins, now updating ...', $player->login); |  | ||||||
| 			} | 			} | ||||||
| 			$this->performPluginsBackup(); |  | ||||||
| 			foreach ($outdatedPlugins as $plugin) { | 			$pluginClasses = $self->maniaControl->pluginManager->getPluginClasses(); | ||||||
| 				$this->updatePlugin($plugin, $player); |  | ||||||
|  | 			foreach($data as $plugin) { | ||||||
|  | 				foreach($pluginClasses as $pluginClass) { | ||||||
|  | 					$id = $pluginClass::getId(); | ||||||
|  | 					if ($plugin->id == $id) { | ||||||
|  | 						if ($plugin->currentVersion->version > $pluginClass::getVersion()) { | ||||||
|  | 							$outdatedPlugins[] = $plugin; | ||||||
|  | 							$self->maniaControl->log('[UPDATE] ' . $pluginClass . ': There is a newer version available: ' . $plugin->currentVersion->version . '!'); | ||||||
|  | 						} | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 		} else { |  | ||||||
| 			$this->maniaControl->log('[UPDATE] Checking plugins: COMPLETE, all plugins are up-to-date!'); | 			if (count($outdatedPlugins) > 0) { | ||||||
| 			if ($player) { | 				$self->maniaControl->log('[UPDATE] Checking plugins: COMPLETE, there are ' . count($outdatedPlugins) . ' outdated plugins, now updating ...'); | ||||||
| 				$this->maniaControl->chat->sendInformation('Checking plugins: COMPLETE, all plugins are up-to-date!', $player->login); | 				if ($player) { | ||||||
|  | 					$self->maniaControl->chat->sendInformation('Checking plugins: COMPLETE, there are ' . count($outdatedPlugins) . ' outdated plugins, now updating ...', $player->login); | ||||||
|  | 				} | ||||||
|  | 				$self->performPluginsBackup(); | ||||||
|  | 				foreach($outdatedPlugins as $plugin) { | ||||||
|  | 					$self->updatePlugin($plugin, $player); | ||||||
|  | 				} | ||||||
|  | 			} else { | ||||||
|  | 				$self->maniaControl->log('[UPDATE] Checking plugins: COMPLETE, all plugins are up-to-date!'); | ||||||
|  | 				if ($player) { | ||||||
|  | 					$self->maniaControl->chat->sendInformation('Checking plugins: COMPLETE, all plugins are up-to-date!', $player->login); | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		}); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -432,8 +447,8 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 	 * @return mixed | 	 * @return mixed | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getPluginsUpdates() { | 	public function getPluginsUpdates() { | ||||||
| 		$pluginUpdates  = array(); | 		$pluginUpdates = array(); | ||||||
| 		$pluginsWS      = array(); | 		$pluginsWS     = array(); | ||||||
|  |  | ||||||
| 		$url            = ManiaControl::URL_WEBSERVICE . 'plugins'; | 		$url            = ManiaControl::URL_WEBSERVICE . 'plugins'; | ||||||
| 		$dataJson       = FileUtil::loadFile($url); | 		$dataJson       = FileUtil::loadFile($url); | ||||||
| @@ -449,14 +464,14 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 		/** @var  Plugin $pluginClass */ | 		/** @var  Plugin $pluginClass */ | ||||||
| 		foreach($this->maniaControl->pluginManager->getPluginClasses() as $pluginClass) { | 		foreach($this->maniaControl->pluginManager->getPluginClasses() as $pluginClass) { | ||||||
| 			$pluginId = $pluginClass::getId(); | 			$pluginId = $pluginClass::getId(); | ||||||
| 			if(array_key_exists($pluginId, $pluginsWS)) { | 			if (array_key_exists($pluginId, $pluginsWS)) { | ||||||
| 				if($pluginsWS[$pluginId]->currentVersion->version > $pluginClass::getVersion()) { | 				if ($pluginsWS[$pluginId]->currentVersion->version > $pluginClass::getVersion()) { | ||||||
| 					$pluginUpdates[$pluginId] = $pluginsWS[$pluginId]; | 					$pluginUpdates[$pluginId] = $pluginsWS[$pluginId]; | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if(empty($pluginUpdates)) { | 		if (empty($pluginUpdates)) { | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		return $pluginUpdates; | 		return $pluginUpdates; | ||||||
| @@ -472,9 +487,9 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 	private function updatePlugin($pluginData, Player $player = null, $reopen = false) { | 	private function updatePlugin($pluginData, Player $player = null, $reopen = false) { | ||||||
| 		$self = $this; | 		$self = $this; | ||||||
| 		$this->maniaControl->fileReader->loadFile($pluginData->currentVersion->url, function ($updateFileContent, $error) use (&$self, &$updateData, &$player, &$pluginData, &$reopen) { | 		$this->maniaControl->fileReader->loadFile($pluginData->currentVersion->url, function ($updateFileContent, $error) use (&$self, &$updateData, &$player, &$pluginData, &$reopen) { | ||||||
| 			$self->maniaControl->log('[UPDATE] Now updating '.$pluginData->name.' ...'); | 			$self->maniaControl->log('[UPDATE] Now updating ' . $pluginData->name . ' ...'); | ||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$self->maniaControl->chat->sendInformation('Now updating '.$pluginData->name.' ...', $player->login); | 				$self->maniaControl->chat->sendInformation('Now updating ' . $pluginData->name . ' ...', $player->login); | ||||||
| 			} | 			} | ||||||
| 			$tempDir = ManiaControlDir . '/temp/'; | 			$tempDir = ManiaControlDir . '/temp/'; | ||||||
| 			if (!is_dir($tempDir)) { | 			if (!is_dir($tempDir)) { | ||||||
| @@ -500,14 +515,14 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 				return false; | 				return false; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$zip->extractTo(ManiaControlDir.'/plugins'); | 			$zip->extractTo(ManiaControlDir . '/plugins'); | ||||||
| 			$zip->close(); | 			$zip->close(); | ||||||
| 			unlink($updateFileName); | 			unlink($updateFileName); | ||||||
| 			@rmdir($tempDir); | 			@rmdir($tempDir); | ||||||
|  |  | ||||||
| 			$self->maniaControl->log('[UPDATE] Successfully updated '.$pluginData->name.'!'); | 			$self->maniaControl->log('[UPDATE] Successfully updated ' . $pluginData->name . '!'); | ||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$self->maniaControl->chat->sendSuccess('Successfully updated '.$pluginData->name.'!', $player->login); | 				$self->maniaControl->chat->sendSuccess('Successfully updated ' . $pluginData->name . '!', $player->login); | ||||||
| 				$self->maniaControl->pluginManager->deactivatePlugin($pluginData->pluginClass); | 				$self->maniaControl->pluginManager->deactivatePlugin($pluginData->pluginClass); | ||||||
| 				$self->maniaControl->pluginManager->activatePlugin($pluginData->pluginClass); | 				$self->maniaControl->pluginManager->activatePlugin($pluginData->pluginClass); | ||||||
|  |  | ||||||
| @@ -530,10 +545,10 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 		$self = $this; | 		$self = $this; | ||||||
| 		$this->maniaControl->fileReader->loadFile($pluginData->currentVersion->url, function ($installFileContent, $error) use (&$self, &$updateData, &$player, &$pluginData, &$reopen) { | 		$this->maniaControl->fileReader->loadFile($pluginData->currentVersion->url, function ($installFileContent, $error) use (&$self, &$updateData, &$player, &$pluginData, &$reopen) { | ||||||
| 			$pluginsDirectory = ManiaControlDir . '/plugins/'; | 			$pluginsDirectory = ManiaControlDir . '/plugins/'; | ||||||
| 			$pluginFiles = scandir($pluginsDirectory); | 			$pluginFiles      = scandir($pluginsDirectory); | ||||||
|  |  | ||||||
| 			$self->maniaControl->log('[UPDATE] Now installing '.$pluginData->name.' ...'); | 			$self->maniaControl->log('[UPDATE] Now installing ' . $pluginData->name . ' ...'); | ||||||
| 			$self->maniaControl->chat->sendInformation('Now installing '.$pluginData->name.' ...', $player->login); | 			$self->maniaControl->chat->sendInformation('Now installing ' . $pluginData->name . ' ...', $player->login); | ||||||
|  |  | ||||||
| 			$tempDir = ManiaControlDir . '/temp/'; | 			$tempDir = ManiaControlDir . '/temp/'; | ||||||
| 			if (!is_dir($tempDir)) { | 			if (!is_dir($tempDir)) { | ||||||
| @@ -555,13 +570,13 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 				return false; | 				return false; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$zip->extractTo(ManiaControlDir.'/plugins'); | 			$zip->extractTo(ManiaControlDir . '/plugins'); | ||||||
| 			$zip->close(); | 			$zip->close(); | ||||||
| 			unlink($installFileName); | 			unlink($installFileName); | ||||||
| 			@rmdir($tempDir); | 			@rmdir($tempDir); | ||||||
|  |  | ||||||
| 			$pluginFilesAfter = scandir($pluginsDirectory); | 			$pluginFilesAfter = scandir($pluginsDirectory); | ||||||
| 			$newFiles = array_diff($pluginFilesAfter, $pluginFiles); | 			$newFiles         = array_diff($pluginFilesAfter, $pluginFiles); | ||||||
|  |  | ||||||
| 			$classesBefore = get_declared_classes(); | 			$classesBefore = get_declared_classes(); | ||||||
| 			foreach($newFiles as $newFile) { | 			foreach($newFiles as $newFile) { | ||||||
| @@ -601,8 +616,8 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$self->maniaControl->log('[UPDATE] Successfully installed '.$pluginData->name.'!'); | 			$self->maniaControl->log('[UPDATE] Successfully installed ' . $pluginData->name . '!'); | ||||||
| 			$self->maniaControl->chat->sendSuccess('Successfully installed '.$pluginData->name.'!', $player->login); | 			$self->maniaControl->chat->sendSuccess('Successfully installed ' . $pluginData->name . '!', $player->login); | ||||||
|  |  | ||||||
| 			if ($reopen) { | 			if ($reopen) { | ||||||
| 				$menuId = $self->maniaControl->configurator->getMenuId('Install Plugins'); | 				$menuId = $self->maniaControl->configurator->getMenuId('Install Plugins'); | ||||||
| @@ -613,7 +628,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Set Core Update Data | 	 * Set Core Update Data | ||||||
| 	 *  | 	 * | ||||||
| 	 * @param UpdateData $coreUpdateData | 	 * @param UpdateData $coreUpdateData | ||||||
| 	 */ | 	 */ | ||||||
| 	public function setCoreUpdateData(UpdateData $coreUpdateData = null) { | 	public function setCoreUpdateData(UpdateData $coreUpdateData = null) { | ||||||
| @@ -639,7 +654,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 			if (!$ignoreVersion && $updateData->version <= ManiaControl::VERSION) { | 			if (!$ignoreVersion && $updateData->version <= ManiaControl::VERSION) { | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			 |  | ||||||
| 			call_user_func($function, $updateData); | 			call_user_func($function, $updateData); | ||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
| @@ -687,11 +702,11 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		$excludes   = array('.', '..'); | 		$excludes   = array('.', '..'); | ||||||
| 		$pathInfo   = pathInfo(ManiaControlDir.'/plugins'); | 		$pathInfo   = pathInfo(ManiaControlDir . '/plugins'); | ||||||
| 		$parentPath = $pathInfo['dirname'] . '/'; | 		$parentPath = $pathInfo['dirname'] . '/'; | ||||||
| 		$dirName    = $pathInfo['basename']; | 		$dirName    = $pathInfo['basename']; | ||||||
| 		$backupZip->addEmptyDir($dirName); | 		$backupZip->addEmptyDir($dirName); | ||||||
| 		$this->zipDirectory($backupZip, ManiaControlDir.'/plugins', strlen($parentPath), $excludes); | 		$this->zipDirectory($backupZip, ManiaControlDir . '/plugins', strlen($parentPath), $excludes); | ||||||
| 		$backupZip->close(); | 		$backupZip->close(); | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user