diff options
author | Remi Collet <fedora@famillecollet.com> | 2010-11-01 18:40:08 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2010-11-01 18:40:08 +0100 |
commit | db257c7de11da2771a9f61733f21a42c98cf2a97 (patch) | |
tree | 3a93d847a2917e27f9a4f8402735176244f6a101 /refresh.php | |
parent | 8b50ace3024268b3067c0bf43bbd68f824b90d81 (diff) |
add CommonTable->optimize() method and call it during refresh
Diffstat (limited to 'refresh.php')
-rw-r--r-- | refresh.php | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/refresh.php b/refresh.php index 6c7827b..6d934c5 100644 --- a/refresh.php +++ b/refresh.php @@ -49,8 +49,8 @@ require "include/main.php"; require "class/CommonTable.php"; if ($_SERVER['argc']>1 && in_array('help', $_SERVER['argv'])) { - echo "Options in: repo owner R pear pecl old\n"; - echo "Defaults: repo owner R pear pecl\n"; + echo "Options in: owner R pear pecl optimize repo old empty\n"; + echo "Defaults: owner R pear pecl optimize repo \n"; die("\n"); } @@ -62,6 +62,7 @@ try { // ------------------------------------------------------------------- echo date("r : ") . "Refreshing " . MYBASE . " database\n"; + $rpmtable = new TableRpm($db); if ($_SERVER['argc']==1 || in_array('repo', $_SERVER['argv'])) { if (in_array('empty', $_SERVER['argv'])) { @@ -72,7 +73,7 @@ try { $crit = array('active' => 1); } - Parser::readRpm(new TableRpm($db), new TableRpmRepo($db), $crit); + Parser::readRpm($rpmtable, new TableRpmRepo($db), $crit); } // ------------------------------------------------------------------- @@ -101,10 +102,25 @@ try { // ------------------------------------------------------------------- // Package Owners from pkgdb (thanks Smootherfrog) // ------------------------------------------------------------------- + $acltable = new TableAcls($db); if ($_SERVER['argc']==1 || in_array('owner', $_SERVER['argv'])) { $url = "https://admin.fedoraproject.org/pkgdb/lists/bugzilla?tg_format=plain"; - Parser::readAcls(new TableAcls($db), $url); + Parser::readAcls($acltable, $url); + } + + if ($_SERVER['argc']==1 || in_array('optimize', $_SERVER['argv'])) { + Parser::log("OPTIMIZE rpm table"); + $res = $rpmtable->optimize(); + Parser::log($res[0]['Msg_type'] . ' = ' . $res[0]['Msg_text']); + + Parser::log("OPTIMIZE upstream table"); + $res = $uptable->optimize(); + Parser::log($res[0]['Msg_type'] . ' = ' . $res[0]['Msg_text']); + + Parser::log("OPTIMIZE acls table"); + $res = $acltable->optimize(); + Parser::log($res[0]['Msg_type'] . ' = ' . $res[0]['Msg_text']); } } catch(PDOException $e) { |