summaryrefslogtreecommitdiffstats
path: root/refresh.php
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2010-11-01 10:06:52 +0100
committerRemi Collet <fedora@famillecollet.com>2010-11-01 10:06:52 +0100
commit93c01077b80cc8d6044d1ec82e981c9f2b26f362 (patch)
tree5fa5216428ad0fbeb05a8310374be4ffeefe16bd /refresh.php
parent72eaeb9aedf14936ae7601ed0ac61c4014943129 (diff)
start to move the parsing from refresh.php to a Parser class
Diffstat (limited to 'refresh.php')
-rw-r--r--refresh.php86
1 files changed, 4 insertions, 82 deletions
diff --git a/refresh.php b/refresh.php
index 117af84..aa4d486 100644
--- a/refresh.php
+++ b/refresh.php
@@ -425,50 +425,8 @@ try {
// -------------------------------------------------------------------
if ($_SERVER['argc']==1 || in_array('R', $_SERVER['argv'])) {
- $tottot=0;
- $rrepo = new TableRRepo($db);
- foreach ($rrepo->request() as $repo) {
- echo date("r : ") . "Reading " . $repo["name"] . " (" .
- $repo["state"] . ")\n";
- $index = @file_get_contents($repo["url"]);
- if (!$index) {
- echo date("r : ") . "Can't read [" . $repo["url"] .
- "], skip this channel\n";
- continue;
- }
- if ($repo["state"]=="stable") {
- $crit = array('type'=>'R', 'channel'=>$repo['name']);
- $nb = $uptable->delete($crit);
- echo date("r : ") . "Delete $nb packages\n";
- }
- $results=array();
- $pat = '/Package: *(.*)\nVersion: *(.*)\n/i';
- if (preg_match_all($pat, $index, $results, PREG_SET_ORDER)) {
- $tot=0;
- foreach ($results as $result) {
- //echo $result[1]." = ".$result[2]."\n";
- $rpmname = "R-".$result[1];
- $ver = str_replace('-', '.', $result[2]);
- $add_upstream = $uptable->record(
- "R",
- $repo["name"],
- $rpmname,
- $ver,
- $repo["state"]=='stable',
- ($repo["state"]=="stable"?"":"devel")
- );
- if ($add_upstream) {
- $tot++;
- }
- }
- echo date("r : ") . "Write $tot packages in this channel\n";
- $tottot += $tot;
- } else {
- echo date("r : ") . "No package in this channel\n";
- }
- }
- echo date("r : ") . "Write $tottot packages in all channels\n";
+ Parser::readR($uptable, new TableRRepo($db));
} // If R in options
@@ -477,45 +435,9 @@ try {
// -------------------------------------------------------------------
if ($_SERVER['argc']==1 || in_array('owner', $_SERVER['argv'])) {
- $acls = new TableAcls($db);
- $fic=fopen(
- "https://admin.fedoraproject.org/pkgdb/lists/bugzilla?tg_format=plain",
- "r"
- );
- if (!$fic) {
- echo date("r : ") . "ERROR reading pkgdb\n";
- } else {
- $nb = $acls->getCount();
- $acls->truncate();
- echo date("r : ") . "Delete $nb owners\n";
-
- 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);
- echo date("r : ") . "wrote $tot package's owner\n";
- }
+ $url = "https://admin.fedoraproject.org/pkgdb/lists/bugzilla?tg_format=plain";
+ Parser::readAcls(new TableAcls($db), $url);
+
} // If in options
} catch(PDOException $e) {