Пример #1
0
 /**
  * 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
}
$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) {
        printf("%3d  %-30s %s\n", $rec['id'], $rec['pkgname'], $rec['rpmname']);