Пример #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;
 }