[Dehs-devel] r99 - trunk

atomo64-guest at alioth.debian.org atomo64-guest at alioth.debian.org
Fri Jan 25 23:56:03 UTC 2008


Author: atomo64-guest
Date: 2008-01-25 23:56:03 +0000 (Fri, 25 Jan 2008)
New Revision: 99

Modified:
   trunk/dehs.config.inc
   trunk/dehs_pg.php
Log:
Make the 'update_all' check only updated based on timestamps not updating packages which were checked in the last four days

Modified: trunk/dehs.config.inc
===================================================================
--- trunk/dehs.config.inc	2008-01-23 22:21:46 UTC (rev 98)
+++ trunk/dehs.config.inc	2008-01-25 23:56:03 UTC (rev 99)
@@ -1,29 +1,44 @@
 <?php
-$dbconn="dbname=dehs";
-$base="/org/home/groups/dehs/dehs_prj/dehs/";
-$dirs=array("diffs_dir"=>$base . "files/diffs",
-                     "sources_dir"=>$base. "files/sources",
-					 "popcon_dir"=>$base . "files/popcon");
-$dists=array(
-	unstable=>array("main","contrib","non-free"),
-	experimental=>array("main","contrib","non-free")
+
+$dbconn = 'dbname=dehs';
+
+$base = '/org/home/groups/dehs/dehs_prj/dehs/';
+
+$dirs = array('diffs_dir'   => $base . 'files/diffs',
+              'sources_dir' => $base . 'files/sources',
+              'popcon_dir'  => $base . 'files/popcon');
+
+$dists = array(
+            unstable     => array('main','contrib','non-free'),
+            experimental => array('main','contrib','non-free')
 );
+
 $mirrors=array(
-"unstable"=>"merkel.debian.org",
-"experimental"=>"merkel.debian.org",
+            'unstable'     => 'merkel.debian.org',
+            'experimental' => 'merkel.debian.org'
 );
+
 //list of addresses wishing to receive ALL the emails (even minor/less important reports)
-$email_all='atomo64 at gmail.com';
+$email_all = 'atomo64 at gmail.com';
+
 //list of addresses wishing to be notified when update_all runs
-$email="bluefuture at email.it,filippo at esaurito.net,$email_all";
-$uscan=$base.'/uscan.pl';
-$sfIgnore = array('dl','download','prdownload','downloads','lists','cvs','svn','www');
+$email = "bluefuture at email.it,filippo at esaurito.net,$email_all";
+
+$uscan = $base . '/uscan.pl';
+
+$sfIgnore = array('dl', 'download', 'prdownload', 'downloads', 'lists', 'cvs', 'svn', 'www');
 $watchFileExts = array('tar.*', 'tgz', 'zip', 'gz', 'bz2');
 $watchFileDversionMangle = array('cvs', 'svn', 'git', 'snapshot', 'pre', 'hg');
 /*1: watch url, 2: $space, 3: name, 4: file ext, 5: extra options*/
 $watchFormat = 'version=3' . "\n" . '%5$s' . "\n" . '%1$s%2$s%3$s-?_?([\d+\.]+|\d+)\.%4$s debian uupdate';
+
 $fetchUpstreamChanges = false;
+
 $sendNotifications = true;
 $notificationsMailFrom = 'Debian External Health System <dehs-devel at lists.alioth.debian.org>';
+
+$timeStamp_basedCheck = array('all');
+$minimumAge = 4;
+
 $_SERVER['SERVER_NAME']=shell_exec("hostname -f 2>&1");
 ?>
\ No newline at end of file

Modified: trunk/dehs_pg.php
===================================================================
--- trunk/dehs_pg.php	2008-01-23 22:21:46 UTC (rev 98)
+++ trunk/dehs_pg.php	2008-01-25 23:56:03 UTC (rev 99)
@@ -451,13 +451,26 @@
     passthru("dpkg --compare-versions '".escapeshellarg($up_vers)."' le '" . escapeshellarg(vers_conv($debian_vers)) . "'",$great);
     return (int)!($great);
 }
-function db_upstream($initial='%') {
-    global $dirs,$dbconn;
+function db_upstream($initial='%', $checkStamps = false, $limit = null) {
+    global $dirs, $dbconn, $minimumAge;
+
     check_db();
     $db = pg_pconnect($dbconn) ;
     events::DB($db);
-    $rsql=pg_exec($db, "SELECT id, name,dist,up_version,version,watch,lastupvsdebsync FROM pkgs WHERE watch is not null AND name LIKE '$initial' ORDER BY name DESC");
+
+    $postWHERE = '';
+    if ($checkStamps) {
+        $postWHERE = "AND (lastcheck<='".sqldate(time() - ($minimumAge*24*3600))."' OR lastcheck IS NULL)";
+    }
+
+    $postORDER = '';
+    if ($limit !== null && is_int($limit)) {
+    	$postORDER = 'LIMIT ' . $limit;
+    }
+
+    $rsql=pg_exec($db, "SELECT id, name,dist,up_version,version,watch,lastupvsdebsync FROM pkgs WHERE watch is not null AND name LIKE '$initial' $postWHERE ORDER BY lastcheck DESC $postORDER");
     $tot=pg_numrows($rsql);
+
     while ($res_array=pg_fetch_array($rsql)) {
 
         $uscan_res=uscan_foo($res_array['name'],$res_array['version'],$res_array['watch']);
@@ -665,8 +678,8 @@
     }
     pg_close($db);
 }
-function watch_wizard($src_name='%'){
-    global $dirs,$dbconn,$sfIgnore,$watchFileExts,$watchFileDversionMangle,$watchFormat;
+function watch_wizard($src_name='%', $checkStamps = false, $limit = null){
+    global $dirs,$dbconn,$sfIgnore,$watchFileExts,$watchFileDversionMangle,$watchFormat,$minimumAge;
     $db = pg_pconnect($dbconn) or die_status ("Db error");
     $checked=$errors=$notfound=$verok=$notmatch=0;
 
@@ -707,9 +720,19 @@
         }
     }
 
+    $postWHERE = '';
+    if ($checkStamps) {
+        $postWHERE = "AND (lastcheck<='".sqldate(time() - ($minimumAge*24*3600))."' OR lastcheck IS NULL)";
+    }
+
+    $postORDER = '';
+    if ($limit !== null && is_int($limit)) {
+    	$postORDER = 'LIMIT ' . $limit;
+    }
+
     $sqlstring="SELECT mpop_inst,name,pkgs.version,pkgs.dversionmangled,pkgs.section,pkgs.dist,tot_up_error, tot_avg_error_date, wwiz_version FROM pkgs INNER JOIN
 	(Select max(pop_inst) as mpop_inst,SUM(up_error) as tot_up_error,AVG(avg_error_date) as tot_avg_error_date,name,dist FROM binpkgs GROUP BY name,dist HAVING max(pop_inst) IS NOT NULL) as binpkgs using(name,dist)
-	WHERE (watch IS NULL OR watch='') AND name LIKE '$src_name' ORDER BY mpop_inst DESC";
+	WHERE (watch IS NULL OR watch='') AND name LIKE '$src_name' $postWHERE ORDER BY lastcheck DESC $postORDER";
     $rsql=pg_exec($db, $sqlstring);
 
     while ($res_array=pg_fetch_array($rsql)) {
@@ -900,7 +923,7 @@
     }
 }
 function update_all() {
-    global $email, $sendNotifications;
+    global $email, $sendNotifications, $timeStamp_basedCheck;
     $intime=gmdate('D, d M Y H:i:s \C\E\S\T',time()+3600*2);
     echo __FUNCTION__ . ' started the ' . $intime . "\n";
     // atm disable when performing an archive-wide check because
@@ -911,8 +934,8 @@
     db_popcon();
     dl_diffs();
     db_up_error();
-    db_upstream();
-    watch_wizard();
+    db_upstream('%', in_array('all', $timeStamp_basedCheck));
+    watch_wizard('%', in_array('all', $timeStamp_basedCheck));
     up_changes();
     dehsqa_db();
     $endtime=gmdate('D, d M Y H:i:s \C\E\S\T',time()+3600*2);




More information about the Dehs-devel mailing list