コード例 #1
0
ファイル: plugin.php プロジェクト: bermi/akelos
 */
if ($command == 'update') {
    $options = get_console_options_for('Update installed plugins.', array('externals' => array('short' => 'x', 'desc' => "Use svn:externals to grab the plugin. Enables plugin updates and plugin versioning.", 'max' => 0), 'checkout' => array('short' => 'o', 'desc' => "Use svn checkout to grab the plugin. Enables updating but does not add a svn:externals entry.", 'max' => 0)));
    $best = $PluginManager->guessBestInstallMethod($options);
    if ($best == 'http' && (!empty($options['externals']) || !empty($options['checkout']))) {
        AkConsole::displayError("Cannot install using subversion because `svn' cannot be found in your PATH", true);
    } elseif ($best == 'export' && !empty($options['externals'])) {
        AkConsole::displayError("Cannot install using externals because this project is not under subversion.", true);
    } elseif ($best == 'export' && !empty($options['checkout'])) {
        AkConsole::displayError("Cannot install using checkout because this project is not under subversion.", true);
    }
    $installed_plugins = $PluginManager->getInstalledPlugins();
    foreach ($installed_plugins as $plugin) {
        $repository_for_plugin = $PluginManager->getRepositoryForPlugin($plugin);
        echo "Updating {$plugin} from {$repository_for_plugin}.\n";
        $PluginManager->updatePlugin($plugin, $repository_for_plugin, $options);
    }
    echo "Done.\n";
    die;
}
/**
 * Remove plugins.
 */
if ($command == 'remove') {
    $options = get_console_options_for('Remove plugins.', array(CONSOLE_GETARGS_PARAMS => array('short' => 'p', 'desc' => "You can specify plugin names as given in 'plugin list' output or absolute URLs to a plugin repository.", 'max' => -1, 'min' => 1)));
    if (empty($options['parameters'])) {
        echo "You must supply at least one plugin name or plugin URL to uninstall.\n";
        echo "\nInstalled Plugins: ";
        echo join(', ', $PluginManager->getInstalledPlugins()) . '.';
        die;
    }