[Dehs-devel] r97 - trunk

atomo64-guest at alioth.debian.org atomo64-guest at alioth.debian.org
Wed Jan 23 21:58:07 UTC 2008


Author: atomo64-guest
Date: 2008-01-23 21:58:07 +0000 (Wed, 23 Jan 2008)
New Revision: 97

Modified:
   trunk/dehs_pg.php
Log:
Make sure is_updated returns an integer
Only send notifications when events::_searchEvent returns an empty value and not vice versa
Make the headers extractor not too strict

Modified: trunk/dehs_pg.php
===================================================================
--- trunk/dehs_pg.php	2008-01-23 21:26:57 UTC (rev 96)
+++ trunk/dehs_pg.php	2008-01-23 21:58:07 UTC (rev 97)
@@ -447,9 +447,9 @@
     @file_put_contents($localfile,file_get_contents($remotefile),'w') or die_status("Errore nello scaricare il file popcon\n");
 }
 function is_updated ($up_vers,$debian_vers) {
-    if ($up_vers=='') return true;
+    if ($up_vers=='') return 1;
     passthru("dpkg --compare-versions '".escapeshellarg($up_vers)."' le '" . escapeshellarg(vers_conv($debian_vers)) . "'",$great);
-    return !($great);
+    return (int)!($great);
 }
 function db_upstream($initial='%') {
     global $dirs,$dbconn;
@@ -1017,7 +1017,7 @@
 
         $eventsId = events::_searchEvent(__FUNCTION__, $sourcePackage, $newVersion);
 
-        if (empty($eventsId)) {
+        if (!empty($eventsId)) {
             echo "Skipping ".__FUNCTION__." event for v$newVersion of $sourcePackage; already sent";
             return null;
         }
@@ -1055,7 +1055,7 @@
 
     function _extractHeader($header, &$message)
     {
-        $regex  = '/^' . preg_quote($header, '/') . ':([ \t]*)(.*)$/i';
+        $regex  = '/' . preg_quote($header, '/') . ':([ \t]*)(.*)/i';
 
         $matches = array();
 
@@ -1064,7 +1064,7 @@
             $spacer = $matches[1];
             $value  = $matches[2];
 
-            $message = ltrim(preg_replace($regex, '', $message));
+            $message = trim(preg_replace($regex, '', $message));
 
             return $value;
 




More information about the Dehs-devel mailing list