예제 #1
0
파일: plugin.php 프로젝트: joeymetal/v1
            if (!empty($key)) {
                fgetc(STDIN);
            }
        }
    }
    die;
}
/**
 * Discover repositories referenced on a page.
 */
if ($command == 'install') {
    $options = get_console_options_for('Install one or more 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), '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), 'revision' => array('short' => 'r', 'desc' => "Checks out the given revision from subversion. Ignored if subversion is not used.", 'max' => 1, 'min' => 1), 'force' => array('short' => 'f', 'desc' => "Reinstalls a plugin if it's already installed.", 'max' => 0)));
    if (empty($options['parameters'])) {
        die("You must supply at least one plugin name or plugin URL to install.\n");
    }
    $best = $PluginManager->guessBestInstallMethod($options);
    if ($best == 'http' && (!empty($options['externals']) || !empty($options['checkout']))) {
        die("Cannot install using subversion because `svn' cannot be found in your PATH\n");
    } elseif ($best == 'export' && !empty($options['externals'])) {
        die("Cannot install using externals because this project is not under subversion.");
    } elseif ($best == 'export' && !empty($options['checkout'])) {
        die("Cannot install using checkout because this project is not under subversion.");
    }
    $plugins = Ak::toArray($options['parameters']);
    foreach ($plugins as $plugin) {
        $repository = null;
        $plugin_name = basename($plugin);
        if ($plugin_name != $plugin) {
            $repository = preg_replace('/\\/?' . $plugin_name . '$/', '', trim($plugin));
        }
        echo "\nInstalling {$plugin}\n";