cvs: php-master-web /scripts event_listing update-backend

From: Date: Thu, 09 Aug 2007 12:17:01 +0000
Subject: cvs: php-master-web /scripts event_listing update-backend
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-36170@lists.php.net to get a copy of this message
bjori Thu Aug 9 12:17:01 2007 UTC Modified files: /php-master-web/scripts update-backend event_listing Log: Show upcoming events months from now in the calender but not int the "upcoming events" sections http://cvs.php.net/viewvc.cgi/php-master-web/scripts/update-backend?r1=1.25&r2=1.26&diff_format=u Index: php-master-web/scripts/update-backend diff -u php-master-web/scripts/update-backend:1.25 php-master-web/scripts/update-backend:1.26 --- php-master-web/scripts/update-backend:1.25 Thu Jun 7 13:01:35 2007 +++ php-master-web/scripts/update-backend Thu Aug 9 12:17:00 2007 @@ -23,14 +23,17 @@ fetch_into_file("http://master.php.net/fetch/countries.php?token=$token", "$root/include/countries.inc"); -// Get list of upcoming events (just current month if we are at the beginning of the month) -$nm = (date('j') < 10) ? 1:2; -fetch_into_file("http://master.php.net/fetch/events.php?nm=$nm&token=$token", + +// Get list of upcoming events +fetch_into_file("http://master.php.net/fetch/events.php?token=$token", "$root/backend/events.csv"); // Pregenerate event listing sidebar for homepage include "event_listing"; -pregenerate_events("$root/backend/events.csv", "$root/include/pregen-events.inc"); +// If we are in the first days of the month then only list current month +$months = (date('j') < 10) ? 1:2; +pregenerate_events("$root/backend/events.csv", "$root/include/pregen-events.inc", $months); + // Run ip-to-country fetch code include "ip-to-country"; http://cvs.php.net/viewvc.cgi/php-master-web/scripts/event_listing?r1=1.10&r2=1.11&diff_format=u Index: php-master-web/scripts/event_listing diff -u php-master-web/scripts/event_listing:1.10 php-master-web/scripts/event_listing:1.11 --- php-master-web/scripts/event_listing:1.10 Fri Mar 30 13:55:48 2007 +++ php-master-web/scripts/event_listing Thu Aug 9 12:17:01 2007 @@ -7,7 +7,7 @@ PHP code ready to be included to $outfile */ -function pregenerate_events($csvfile, $outfile) +function pregenerate_events($csvfile, $outfile, $months = 2) { // Try to open output file for reading $out = @fopen("$outfile~", "w"); @@ -32,6 +32,10 @@ ); $content = ""; $buffer = array(); + $endts = strtotime("+$months months"); + $endm = date("n", $endts); + $endy = date("Y", $endts); + // While we can read the events file while (TRUE) { @@ -39,6 +43,8 @@ $elems = fgetcsv($csv, 8192); if ($elems === FALSE) { break; } list($d, $m, $y, $ccode, $desc, $id, , , , , , , $cat) = $elems; + // Skip events way in the future + if (($endy == $y && $endm <= $m) || $endy < $y) { continue; } // Fgetcvs() returns an array with a single null element // for a blank line, which we need to skip @@ -106,6 +112,9 @@ fwrite($out, $headline); foreach($order as $category) { + if (!isset($buffer[$headline][$category])) { + continue; + } fwrite($out, $buffer[$headline][$category]); } }

« previous php.mirrors (#36170) next »