Пример #1
0
 /**
  * Add new maintainer
  *
  * @static
  * @param  mixed  Name of the package or it's ID
  * @param  string Handle of the user
  * @param  string Role of the user
  * @param  integer Is the developer actively working on the project?
  * @return mixed True or PEAR error object
  */
 static function add($package, $user, $role, $active = 1)
 {
     global $dbh;
     include_once 'pear-database-user.php';
     if (!user::exists($user)) {
         throw new InvalidArgumentException("User {$user} does not exist");
     }
     include_once 'pear-database-package.php';
     if (is_string($package)) {
         $package = package::info($package, 'id');
     }
     $sql = 'INSERT INTO maintains (handle, package, role, active) VALUES (?, ?, ?, ?)';
     $err = $dbh->query($sql, array($user, $package, $role, (int) $active));
     if (DB::isError($err)) {
         return $err;
     }
     $packagename = package::info($package, 'name');
     include_once 'pear-rest.php';
     $pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh);
     $pear_rest->savePackageMaintainerREST($packagename);
     return true;
 }
Пример #2
0
}
echo "Generating All Maintainers REST...\n";
$pear_rest->saveAllMaintainersREST();
echo "done\n";
echo "Generating Package REST...\n";
$pear_rest->saveAllPackagesREST();
require_once 'Archive/Tar.php';
require_once 'PEAR/PackageFile.php';
$config =& PEAR_Config::singleton();
$pkg = new PEAR_PackageFile($config);
include_once 'pear-database-package.php';
foreach (package::listAllNames() as $package) {
    echo "  {$package}\n";
    $pear_rest->savePackageREST($package);
    echo "     Maintainers...";
    $pear_rest->savePackageMaintainerREST($package);
    echo "...done\n";
    $releases = package::info($package, 'releases');
    if ($releases) {
        echo "     Processing All Releases...";
        $pear_rest->saveAllReleasesREST($package);
        echo "done\n";
        foreach ($releases as $version => $blah) {
            $sql = 'SELECT fullpath FROM files WHERE `release` = ?';
            $fileinfo = $dbh->getOne($sql, array($blah['id']));
            $tar =& new Archive_Tar($fileinfo);
            if ($pxml = $tar->extractInString('package2.xml')) {
            } elseif ($pxml = $tar->extractInString('package.xml')) {
            }
            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
            $pf = $pkg->fromAnyFile($fileinfo, PEAR_VALIDATE_NORMAL);
Пример #3
0
         $users[strtolower($user['handle'])] = array('role' => $user['role'], 'active' => !isset($user['active']) || $user['active'] == 'yes');
     }
     include_once 'pear-database-maintainer.php';
     $e = maintainer::updateAll($pacid, $users, false, true);
     if (PEAR::isError($e)) {
         $errors[] = $e->getMessage();
         break;
     }
     $e = package::updateInfo($pacid, array('summary' => $info->getSummary(), 'description' => $info->getDescription(), 'license' => $license));
     if (PEAR::isError($e)) {
         $errors[] = $e->getMessage();
         break;
     }
     include_once 'pear-rest.php';
     $pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh);
     $return = $pear_rest->savePackageMaintainerREST($info->getPackage());
     if (PEAR::isError($return)) {
         if (auth_check('pear.admin')) {
             $errors[] = $return->getMessage();
         } else {
             $errors[] = 'There seems to have been a problem with saving the REST files - please inform the webmasters at ' . PEAR_WEBMASTER_EMAIL;
         }
     }
     include_once 'pear-database-release.php';
     $file = release::upload($info->getPackage(), $info->getVersion(), $info->getState(), $info->getNotes(), $distfile, md5_file($distfile), $info, $packagexml, $compatible_pxml);
 }
 if (PEAR::isError($file)) {
     $ui = $file->getUserInfo();
     $errors[] = 'Error while uploading package: ' . $file->getMessage() . ($ui ? " ({$ui})" : '');
     break;
 }