コード例 #1
0
ファイル: Parser.php プロジェクト: remicollet/rpmphp
 /**
  * Parse the Bugzilla ACL list from pkgdb
  *
  * @param TableAcl $acls the table to write to
  * @param string   $url  the file to read from
  *
  * @return integer number of parsed line
  */
 public static function readAcls(TableAcls $acls, $url)
 {
     $tot = 0;
     self::log("Read pkgdb/owner");
     $fic = fopen($url, 'r');
     if (!$fic) {
         self::log("ERROR reading '{$url}'");
     } else {
         $nb = $acls->getCount();
         $acls->truncate();
         self::log("Delete {$nb} owners");
         for ($tot = 0; $line = fgetcsv($fic, 1024, '|');) {
             if (count($line) > 5 && substr($line[0], 0, 1) != '#') {
                 for ($i = 0; $i < 6; $i++) {
                     $line[$i] = trim($line[$i]);
                 }
                 $input = array('collection' => $line[0], 'name' => $line[1], 'summary' => $line[2]);
                 if (!empty($line[3])) {
                     $input['owner'] = $line[3];
                 }
                 if (!empty($line[4])) {
                     $input['qa'] = $line[3];
                 }
                 if (!empty($line[5])) {
                     $input['cc'] = $line[3];
                 }
                 if ($acls->add($input)) {
                     $tot++;
                 }
             }
         }
         fclose($fic);
         self::log("wrote {$tot} package's owner");
     }
     return $tot;
 }
コード例 #2
0
ファイル: rpm.php プロジェクト: remicollet/rpmphp
    return $packages;
}
try {
    switch ($type) {
        case "pecl":
            $filter = 'php-pecl-%';
            break;
        case "composer":
        case "pear":
            $filter = 'php-%';
            break;
        case "R":
            $filter = 'R-%';
            break;
        default:
            $filter = '';
    }
    $db = new PDO("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS);
    $acl = new TableAcls($db);
    $smarty->assign('owners', $acl->getOwners($filter));
    $acl = new TableUpstream($db);
    $smarty->assign('channels', $acl->getChannels($type));
    $rpmrepo = new TableRpmRepo($db);
    $smarty->assign('repositories_update', date("r", $rpmrepo->getMaxStamp()));
    $smarty->assign('packages', report($db, $type));
} catch (PDOException $e) {
    $smarty->assign('error', sprintf("%s ERREUR : %s\n", date("r"), $e->getMessage()));
}
$page_content = $smarty->fetch('rpm.tpl');
$smarty->assign('page_content', $page_content);
$smarty->display('main.tpl');
コード例 #3
0
ファイル: testdb.php プロジェクト: remicollet/rpmphp
    echo "not found\n";
}
$up->record('test', 'bar', 'foo', '1.2', false, 'beta');
echo "record(foo-1.2) : {$rec}\n";
echo "find(foo,test):";
if ($row = $up->find(array('name' => 'foo', 'type' => 'test'))) {
    print_r($row);
} else {
    echo "not found\n";
}
echo "request(test) : ";
foreach ($up->request(array('type' => 'test', 'ORDER' => 'name')) as $upstr) {
    print_r($upstr);
}
$rpm = new TableRpm($db);
$acl = new TableAcls($db);
echo "Acls number : " . $acl->getCount() . "\n";
$res = $acl->optimize();
echo "Acls optimization : " . $res[0]['Msg_type'] . '=' . $res[0]['Msg_text'] . "\n";
echo "PHP owner:";
print_r($acl->getOwners('php'));
echo "PECL owner:";
print_r($acl->getOwners('php-pecl-%'));
echo "PEAR channels:";
print_r($up->getChannels('pear'));
$pkg = new TablePackagist($db);
$nb = $pkg->getCount();
echo "Pkgs number : {$nb}\n";
if ($nb) {
    $i = 0;
    foreach ($pkg->request(array('ORDER' => 'rpmname')) as $rec) {