} return $args->getValues(); } $PluginManager = new AkPluginManager(); /** * List available plugins. */ if ($command == 'list') { $options = get_console_options_for('List available plugins.', array('source' => array('short' => 's', 'desc' => "Use the specified plugin repositories. --source URL1 URL2", 'max' => -1, 'min' => 1), 'local' => array('short' => 'l', 'desc' => "List locally installed plugins.", 'max' => 0), 'remote' => array('short' => 'r', 'desc' => "List remotely available plugins. This is the default behavior", 'max' => 0))); if (isset($options['local']) && isset($options['remote'])) { die("Local and remote arguments can not be used simultaneously\n"); } if (!empty($options['source'])) { $PluginManager->tmp_repositories = Ak::toArray($options['source']); } $installed_plugins = $PluginManager->getInstalledPlugins(); if (isset($options['local'])) { if (empty($installed_plugins)) { die("There are not plugins intalled at {$ak_app_dir}/vendor/plugins\n"); } else { echo "Plugins installed at {$ak_app_dir}/vendor/plugins:\n\n"; foreach ($installed_plugins as $plugin) { echo " * " . $plugin . " (" . rtrim($PluginManager->getRepositoryForPlugin($plugin), '/') . "/{$plugin})\n"; } die("\n"); } } else { $plugins = $PluginManager->getPlugins(true); if (empty($plugins)) { die("Could not find remote plugins\n"); } else {
function _checkInstallDependencies() { if (isset($this->php_min_version)) { if (version_compare(PHP_VERSION, $this->php_min_version, '<')) { echo "\n"; Ak::t("This plugin requires at least php version: %version", array('%version', $this->php_min_version)); echo "\n"; return false; } } if (isset($this->php_max_version)) { if (version_compare(PHP_VERSION, $this->php_max_version, '>')) { echo "\n"; Ak::t("This plugin runs only on php version <= %version", array('%version', $this->php_min_version)); echo "\n"; return false; } } if (isset($this->dependencies)) { $this->dependencies = Ak::toArray($this->dependencies); $pluginManager = new AkPluginManager(); $plugins = $pluginManager->getInstalledPlugins(); $missing = array(); foreach ($this->dependencies as $dependency) { if (!in_array($dependency, $plugins)) { $missing[] = $dependency; } } if (!empty($missing)) { echo "\n"; $params = array('plugin' => AkT('plugin', 'quantify(' . count($missing) . ')'), 'missing' => AkT($missing, 'toSentence')); echo Ak::t("This plugin depends on the %plugin %missing. Please install the missing plugins first.", $params); echo "\n"; return false; } else { /** * register the dependent plugins */ foreach ($this->dependencies as $dependency) { $dependencyFile = AK_PLUGINS_DIR . DS . $dependency . DS . 'dependent_plugins'; if ($fileExists = file_exists($dependencyFile)) { $dependendPlugins = file($dependencyFile); } else { $dependendPlugins = array(); } if (!in_array($this->plugin_name, $dependendPlugins)) { $dependendPlugins[] = $this->plugin_name; } if (!empty($dependendPlugins)) { Ak::file_put_contents($dependencyFile, implode("\n", $dependendPlugins)); } else { if ($fileExists) { unlink($dependencyFile); } } } } } return true; }
} return $args->getValues(); } $PluginManager = new AkPluginManager(); /** * List available plugins. */ if ($command == 'list') { $options = get_console_options_for('List available plugins.', array('source' => array('short' => 's', 'desc' => "Use the specified plugin repositories. --source URL1 URL2", 'max' => -1, 'min' => 1), 'local' => array('short' => 'l', 'desc' => "List locally installed plugins.", 'max' => 0), 'remote' => array('short' => 'r', 'desc' => "List remotely available plugins. This is the default behavior", 'max' => 0))); if (isset($options['local']) && isset($options['remote'])) { AkConsole::displayError("Local and remote arguments can not be used simultaneously", true); } if (!empty($options['source'])) { $PluginManager->tmp_repositories = Ak::toArray($options['source']); } $installed_plugins = $PluginManager->getInstalledPlugins(); if (isset($options['local'])) { $plugins_dir = $ak_app_dir . DS . 'vendor' . DS . 'plugins'; if (empty($installed_plugins)) { AkConsole::displayError("There are not plugins intalled at {$plugins_dir}", true); } else { echo "Plugins installed at {$plugins_dir}:\n\n"; foreach ($installed_plugins as $plugin) { echo " * " . $plugin . " (" . rtrim($PluginManager->getRepositoryForPlugin($plugin), '/') . "/{$plugin})\n"; } die("\n"); } } else { $plugins = $PluginManager->getPlugins(true); if (empty($plugins)) { AkConsole::displayError("Could not find remote plugins", true);