[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#488751: Patch



On Saturday 19 July 2008 17:22, Frank Lichtenheld wrote:
> I believe the following patch should fix this issue, but my PHP
> is somewhat rusty...
>
> Index: developer.wml
> ===================================================================
> --- developer.wml	(Revision 1915)
> +++ developer.wml	(Arbeitskopie)
> @@ -713,6 +713,10 @@
>
>      if (!($bug_list = dba_fetch($package, $bugsdb))) $bug_list = '0(0)
> 0(0) 0(0) 0(0)'; $bug_list = explode(' ', $bug_list);
> +    if(count($bug_list) > 4)
> +    { #handle the new patch count
> +        array_pop($bug_list)
> +    }

The patch misses a ";" after the array_pop call.
Also it isn't robust against new additions of more information. That could be 
solved in the code above, however, I think the best way to handle it is to 
not jump through hoops to strip off any auxilary information, but just to 
adapt the loop over bug_list not to loop over all elements but just the first 
4 it needs, regardless of how many extra information items get added. Updated 
patch attached.

Thijs
Index: wml/developer.wml
===================================================================
--- wml/developer.wml	(revision 1917)
+++ wml/developer.wml	(working copy)
@@ -757,9 +757,8 @@
         $bug_count = $bug_list[0] + $bug_list[1] + $bug_list[2] + $bug_list[3];
         $real_bug_count = 0;
         $bug_data = "";
-        foreach($bug_list as $bug_item)
-        {
-            preg_match("/\d+\((\d+)\)/", $bug_item, $count_array);
+        for($i = 0; $i < 4; ++$i) {
+            preg_match("/\d+\((\d+)\)/", $bug_list[$i], $count_array);
             $real_bug_count += $count_array[1];
         }
         if($bug_count == 0)
Index: pts/www/xsl/pts.xsl
===================================================================
--- pts/www/xsl/pts.xsl	(revision 1917)
+++ pts/www/xsl/pts.xsl	(working copy)
@@ -917,6 +917,12 @@
       <xsl:if test="$other/bugs/@patch!='0'">
 	<li>The Bug Tracking System contains
           <a href="http://bugs.debian.org/cgi-bin/pkgreport.cgi?src={$escaped-package}&amp;include=tags:patch&amp;exclude=tags:pending&amp;pend-exc=done&amp;repeatmerged=no";>patches fixing
+<<<<<<< .mine
+	    <xsl:value-of select="$other/bugs/@patch"/> bug<xsl:if test="$other/bugs/@patch!='1'">s</xsl:if>
+          </a>, consider including or untagging
+	  <xsl:if test="$other/bugs/@patch!='1'">them</xsl:if>
+	  <xsl:if test="$other/bugs/@patch='1'">it</xsl:if>.
+=======
           <xsl:value-of select="$other/bugs/@patch"/> bug<xsl:if test="$other/bugs/@patch!='1'">s</xsl:if>
           </a>
 	  <xsl:if test="$other/bugs/@patch_m">
@@ -928,6 +934,7 @@
 	  </xsl:if>, consider including or untagging
           <xsl:if test="$other/bugs/@patch!='1'">them</xsl:if>
           <xsl:if test="$other/bugs/@patch='1'">it</xsl:if>.
+>>>>>>> .r1860
 	</li>
       </xsl:if>
     </xsl:if>

Attachment: pgpPbrKcv4pqg.pgp
Description: PGP signature


Reply to: