Beispiel #1
0
    $ok = $cmd->run('config-set', array(), array('cache_dir', $dir . 'cache'));
    $ok = $cmd->run('config-set', array(), array('cache_ttl', 300));
    // Register packages
    $packages = array('Archive_Tar', 'Console_Getopt', 'HTML_Template_IT', 'Net_UserAgent_Detect', 'Pager', 'PEAR', 'PEAR_Frontend_Web', 'XML_RPC');
    $reg = new PEAR_Registry($dir . 'PEAR');
    if (!file_exists($dir . 'PEAR/.registry')) {
        PEAR::raiseError('Directory "' . $dir . 'PEAR/.registry" does not exist. please check your installation');
    }
    foreach ($packages as $pkg) {
        $info = $reg->packageInfo($pkg);
        foreach ($info['filelist'] as $fileName => $fileInfo) {
            if ($fileInfo['role'] == "php") {
                $info['filelist'][$fileName]['installed_as'] = str_replace('{dir}', $dir, $fileInfo['installed_as']);
            }
        }
        $reg->updatePackage($pkg, $info, false);
    }
}
// Handle some diffrent Commands
if (isset($_GET["command"])) {
    switch ($_GET["command"]) {
        case 'install':
        case 'uninstall':
        case 'upgrade':
            if (USE_DHTML_PROGRESS && isset($_GET['dhtml'])) {
                PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayErrorImg"));
            }
            $command = $_GET["command"];
            $params = array($_GET["pkg"]);
            $cmd = PEAR_Command::factory($command, $config);
            $ok = $cmd->run($command, $opts, $params);