From a21f380126ada958a9480e5042eb3c16ecbf0fe0 Mon Sep 17 00:00:00 2001 From: Olle Harstedt Date: Thu, 5 May 2016 20:51:36 +0200 Subject: [PATCH] Revert "Dev: Add config file for plugin" This reverts commit c52d2f0875e05de262ba6581250c1070db9cb8f5. --- .../controllers/admin/pluginmanager.php | 1 - application/models/Plugin.php | 54 +------------------ 2 files changed, 1 insertion(+), 54 deletions(-) diff --git a/application/controllers/admin/pluginmanager.php b/application/controllers/admin/pluginmanager.php index 4f8aeaa0373..509b0976e29 100644 --- a/application/controllers/admin/pluginmanager.php +++ b/application/controllers/admin/pluginmanager.php @@ -43,7 +43,6 @@ public function index() if (array_key_exists($oPlugin->name, $aDiscoveredPlugins)) { $aPluginSettings = App()->getPluginManager()->loadPlugin($oPlugin->name, $oPlugin->id)->getPluginSettings(false); - $pluginConfig = $oPlugin->getConfig(); $data[] = array( 'id' => $oPlugin->id, 'name' => $aDiscoveredPlugins[$oPlugin->name]['pluginName'], diff --git a/application/models/Plugin.php b/application/models/Plugin.php index cb2ea16caff..c6203848410 100644 --- a/application/models/Plugin.php +++ b/application/models/Plugin.php @@ -29,56 +29,4 @@ public static function model($className = __CLASS__) { public function tableName() { return '{{plugins}}'; } - - public function getConfig() { - $file = Yii::app()->basePath - . DIRECTORY_SEPARATOR . '..' - . DIRECTORY_SEPARATOR . 'plugins' - . DIRECTORY_SEPARATOR . $this->name - . DIRECTORY_SEPARATOR . 'config.php'; - - // No config file, just return empty array - if (!file_exists($file)) { - return array(); - } - - $config = include($file); - - if (!isset($config['version'])) { - throw new Exception("Config file need a version number"); - } - - // Compare with 0.0.1-dev, which is the lowest possible version. - $isPhpVersion = version_compare($config['version'], '0.0.1-dev'); - - if ($isPhpVersion === -1) { - throw new Exception("Version in config is not a PHP version: " . $config['version']); - } - - $status = $this->getStatus($config['version']); - - return $config; - } - - /** - * Return version status, e.g. "alpha" if - * version is "1.2.3-alpha" - * - * @param string $version - * @return string - */ - protected function getStatus($version) { - $versionAndStatus = explode('-', $version); - var_dump($versionAndStatus); - - if (count($versionAndStatus) === 1) { - return ""; - } - elseif (count($versionAndStatus) === 2) { - return $versionAndStatus[1]; - } - else { - throw new Exception("Invalid version: more than one slash ('-'): " . $version); - } - } -} +} \ No newline at end of file