[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    www/areas/cvs-digest/enzyme
From:       Derek Kite <dkite () netidea ! com>
Date:       2004-03-19 2:59:38
Message-ID: 20040319025938.D540A999A () office ! kde ! org
[Download RAW message or body]

CVS commit by dkite: 

Bug references added and working.


  M +44 -32    enzyme_bugdata.php   1.2
  M +13 -10    enzyme_format.php   1.8


--- www/areas/cvs-digest/enzyme/enzyme_bugdata.php  #1.1:1.2
@@ -29,19 +29,20 @@
 var $cachelocation = "cache/buglist.dat";
 var $bugdesc;
+var $bugnum;
 
 
 function enzyme_bugdata($bugnum)  {
-  $this->bugdesc = $this->check_cache($bugnum);  
+  $this->bugnum = $bugnum;
+  $this->get_bug();
   
 }
 
 
-function check_cache  ($bugnum)  {
+function check_cache  ()  {
   if (file_exists($this->cachelocation)) {
-    $res = `grep $bugnum $this->cachelocation`;
+    $res = `grep $this->bugnum $this->cachelocation`;
     if ($res == "")
       return false;
-    array_pop($res);
-    return $res[0];
+    return $res;
   }
   return false;
@@ -49,39 +50,50 @@
 
 
-function fetch_bug($bugnum)  {
-  $url = "$this->bugzilla$this->bugzillaquery$bugnum";
-  $cs = curl_init($url);
-  $str = curl_exec($cs);
-  echo $str;
+function fetch_bug()  {
+  $url = "$this->bugzilla$this->bugzillaquery$this->bugnum";
+  $bugxml = `wget -O- $url`;
+  $p = xml_parser_create();
+   xml_parse_into_struct($p, $bugxml, $vals, $index);
+   xml_parser_free($p);
+   foreach ($vals as $key=>$arr)  {
+     if ($arr["tag"] == "BUG_ID")  {
+       $bugid = $arr["value"];
+       continue;
+     }  
+     if ($arr["tag"] == "SHORT_DESC")  {
+       $this->bugdesc = $arr["value"];
+       break;
+     }  
+   }    
 }
   
+function save_cache()  {
+  if  ($fp = fopen("$this->cachelocation","a")) {
+    fwrite($fp,"$this->bugnum $this->bugdesc\n");
+    fclose($fp);
+  }  
+}
 
+function get_bug()  {
+  $res = $this->check_cache();
+  if ($res === false) {
+    $this->fetch_bug();
+    $this->save_cache();
+  }
+  else
+   $this->bugdesc = $res;
+}
 
 
-
-
-
-/*<bug_id>61467</bug_id>
-  <bug_status>RESOLVED</bug_status>
-  <product>konqueror</product>
-  <priority>NOR</priority>
-  <version>unspecified</version>
-  <rep_platform>Compiled Sources</rep_platform>
-  <assigned_to>konq-bugs@kde.org</assigned_to>
-  <delta_ts>20040209155307</delta_ts>
-  <component>kjs</component>
-  <reporter>kdebugs@ralfhoelzer.com</reporter>
-  <target_milestone>---</target_milestone>
-  <bug_severity>crash</bug_severity>
-  <creation_ts>2003-07-20 19:19</creation_ts>
-  <op_sys>Linux</op_sys>
-  <resolution>FIXED</resolution>
-  <short_desc>KJ*/
+function get_bugdesc()  {
+  return $this->bugdesc;
+}
+  
 }
 
 
-$i = new enzyme_bugdata("61467");
-$i->fetch_bug("61467");
-
+// $i = new enzyme_bugdata("69760");
+// $i->fetch_bug();
+// echo $i->get_bugdesc()
 
 

--- www/areas/cvs-digest/enzyme/enzyme_format.php  #1.7:1.8
@@ -24,5 +24,5 @@
 
 include_once("enzyme_cvsindex.php");
-include_once("enzyme_ugdata.php");
+include_once("enzyme_bugdata.php");
 
 
@@ -49,15 +49,18 @@
 
 function build_bugref($str) {
-  $str =  preg_replace_callback("/([\d]{5})/",array($this,bug_callback),$str);
-  foreach ($this->buglist as $bug)  {
-    $b = new enzyme_bugdata($bug);
-    $str .= "\nRefer to: <a href=\"http://bugs.kde.org/show_bug.cgi?id=$bug\">$b->get_bugdesc()</a>"
+  $str =  preg_replace_callback("/([\d]{5})/",array(&$this,bug_callback),$str);
+  if (is_array($this->buglist))  {
+    $this->buglist = array_unique($this->buglist);
+    $str .= "\n";
+    foreach ($this->buglist as $bug)  {
+      $b = new enzyme_bugdata($bug);
+      $bugdesc = $b->get_bugdesc();
+      $bugdesc = wordwrap($bugdesc,$this->width);
+      $str .= "Refer to: <a href=\"http://bugs.kde.org/show_bug.cgi?id=$bug\">$bugdesc</a>";
+    }
   }
+  return $str;
 }
 
-function get_bug_header($bugnum)  {
-  
-
-}
 
 function escape_tags($str)  {
@@ -157,5 +160,5 @@
      $t = "Source Code";  
    
-return "<a href=\"diff.php?file=$f&version=$v\">$c $pl View $t</a>";
+return "\n<a href=\"diff.php?file=$f&version=$v\">$c $pl View $t</a>";
 }
  


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic