Exemplo n.º 1
0
            report_error('Unable to save data!');
        } else {
            if (isset($_POST['tags']) && is_array($_POST['tags'])) {
                $manager = new Tags_Manager();
                $manager->clearTags($_POST['name']);
                foreach ($_POST['tags'] as $tag) {
                    if (!$tag) {
                        continue;
                    }
                    $manager->createPackageTag($tag, $_POST['name']);
                }
            }
            include_once 'pear-rest.php';
            $pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh);
            $pear_rest->saveAllPackagesREST();
            $pear_rest->savePackageREST($_POST['name']);
            $pear_rest->savePackagesCategoryREST(package::info($_POST['name'], 'category'));
            report_success('Package information successfully updated.');
        }
    }
} else {
    if (isset($_GET['action'])) {
        switch ($_GET['action']) {
            case 'release_remove':
                if (!isset($_GET['release'])) {
                    report_error('Missing package ID!');
                    break;
                }
                include_once 'pear-database-release.php';
                if (release::remove($_GET['id'], $_GET['release'])) {
                    echo "<b>Release successfully deleted.</b><br /><br />\n";
Exemplo n.º 2
0
     $query = "UPDATE packages SET approved = 1 WHERE approved = 0 AND id = " . (int) $_GET['approve'];
     $id = $_GET['approve'];
     $action = "approved";
 } elseif (!empty($_GET['reject'])) {
     $query = "DELETE FROM packages WHERE approved = 0 AND id = " . (int) $_GET['reject'];
     $id = $_GET['reject'];
     $action = "rejected";
 }
 $res = $dbh->query($query);
 if (!PEAR::isError($res) && $dbh->affectedRows() > 0) {
     $sql = 'SELECT * FROM packages WHERE id = ?';
     $row = $dbh->getRow($sql, array($id), DB_FETCHMODE_ASSOC);
     if ($action == 'approved') {
         include_once 'pear-rest.php';
         $pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh);
         $pear_rest->savePackageREST($row['name']);
         $pear_rest->saveAllPackagesREST();
         include_once 'pear-database-package.php';
         $pear_rest->savePackagesCategoryREST(package::info($row['name'], 'category'));
     }
     // {{{ Logging mechanism
     require_once "Damblan/Log.php";
     require_once "Damblan/Log/Mail.php";
     $logger = new Damblan_Log();
     $observer = new Damblan_Log_Mail();
     $observer->setRecipients(PEAR_GROUP_EMAIL);
     $observer->setHeader("In-Reply-To", "<approve-request-" . $row['id'] . "@" . PEAR_CHANNELNAME . ">");
     $observer->setHeader("Subject", "[" . SITE_BIG . " Group] Package " . $row['name'] . " has been " . $action);
     $logger->attach($observer);
     $logger->log($auth_user->handle . " " . $action . " " . $row['name']);
     // }}}
Exemplo n.º 3
0
    $pear_rest->saveMaintainerREST($maintainer['handle']);
    echo "done\n";
}
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')) {
            }
Exemplo n.º 4
0
 /**
  * Updates fields of an existant package
  *
  * @param int $pkgid The package ID to update
  * @param array $data Assoc in the form 'field' => 'value'.
  * @return mixed True or PEAR_Error
  */
 static function updateInfo($pkgid, $data)
 {
     global $dbh, $auth_user;
     $package_id = package::info($pkgid, 'id');
     if (PEAR::isError($package_id) || empty($package_id)) {
         return PEAR::raiseError('Package not registered or not approved. Please register it first with "New Package" or wait until it gets approved.');
     }
     if ($auth_user->isAdmin() === false && $auth_user->isQA() === false) {
         include_once 'pear-database-user.php';
         $role = user::maintains($auth_user->handle, $package_id);
         if ($role != 'lead' && $role != 'developer') {
             return PEAR::raiseError('package::updateInfo: insufficient privileges');
         }
     }
     // XXX (cox) what about 'name'?
     $allowed = array('license', 'summary', 'description', 'category');
     $fields = $prep = array();
     foreach ($allowed as $a) {
         if (isset($data[$a])) {
             $fields[] = "{$a} = ?";
             $prep[] = $data[$a];
         }
     }
     if (!count($fields)) {
         return;
     }
     $sql = 'UPDATE packages SET ' . implode(', ', $fields) . " WHERE id = {$package_id}";
     $row = package::info($pkgid, 'name');
     include_once 'pear-rest.php';
     $pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh);
     $pear_rest->saveAllPackagesREST();
     $pear_rest->savePackageREST($row);
     $pear_rest->savePackagesCategoryREST(package::info($pkgid, 'category'));
     return $dbh->query($sql, $prep);
 }