if (empty($options['parameters'])) { die("You must supply at least one plugin name or plugin URL to uninstall.\n"); } $plugins = Ak::toArray($options['parameters']); foreach ($plugins as $plugin) { $plugin_name = basename($plugin); echo "\nUninstalling {$plugin}\n"; $PluginManager->uninstallPlugin($plugin_name); } echo "Done.\n"; die; } /** * Shows plugin info at plugin_path/ABOUT. */ if ($command == 'info') { $options = get_console_options_for('Remove plugins.', array(CONSOLE_GETARGS_PARAMS => array('short' => 'p', 'desc' => "Plugin names as given in 'plugin list' output or absolute URL to a plugin repository.", 'max' => 1, 'min' => 1))); if (empty($options['parameters'])) { die("You must supply a plugins name or plugin URL.\n"); } $plugin = $options['parameters']; $plugin_name = basename($plugin); if ($plugin_name != $plugin) { $repository = preg_replace('/\\/?' . $plugin_name . '$/', '', trim($plugin)); } else { $repository = $PluginManager->getRepositoryForPlugin($plugin_name); } $about = Ak::url_get_contents(rtrim($repository, '/') . '/' . $plugin_name . '/ABOUT', array('timeout' => 10)); echo empty($about) ? "Could not get plugin information." : $about; die("\n"); }
if ($command == 'test') { $options = get_console_options_for('Test plugin', array(CONSOLE_GETARGS_PARAMS => array('min' => 1, 'max' => 1, 'short' => 'p', 'desc' => "Specify the plugin name you wish to test"), 'phpbin' => array('short' => 'b', 'max' => 1, 'min' => 1, 'desc' => 'Path to the php binary', 'default' => '/usr/bin/env php'))); if (empty($options['parameters'])) { AkConsole::displayError("You must supply a plugin name.", true); } $plugin = $options['parameters']; $plugin_name = basename($plugin); $test_file = AK_PLUGINS_DIR . DS . $plugin_name . DS . 'test' . DS . $plugin_name . '.php'; if (file_exists($test_file)) { $exec_command = $options['phpbin'] . ' ' . $test_file; passthru($exec_command); } else { echo "The test file {$test_file} does not exist."; die("\n"); } } if ($command == 'help') { $options = get_console_options_for('Plugin help', array(CONSOLE_GETARGS_PARAMS => array('min' => 1, 'max' => 1, 'short' => 'p', 'desc' => "Specify a plugin name."), 'phpbin' => array('short' => 'b', 'max' => 1, 'min' => 1, 'desc' => 'Path to the php binary', 'default' => '/usr/bin/env php'))); if (empty($options['parameters'])) { AkConsole::displayError("You must supply a plugin name.", true); } $plugin = $options['parameters']; $plugin_name = basename($plugin); $help_file = AK_PLUGINS_DIR . DS . $plugin_name . DS . 'README'; if (file_exists($help_file)) { echo file_get_contents($help_file) . "\n"; } else { echo "Could not find a README help file for the {$plugin_name} plugin."; die("\n"); } }