cvs: php-master-web /scripts rest_render

[email protected] ("Hannes Magnusson")
Newsgroups php.webmaster
Message-ID <cvsbjori1200049424@cvsserver>
bjori		Fri Jan 11 11:03:44 2008 UTC

  Modified files:              
    /php-master-web/scripts	rest_render 
  Log:
  Remove old cache files
  
  
http://cvs.php.net/viewvc.cgi/php-master-web/scripts/rest_render?r1=1.2&r2=1.3&diff_format=u
Index: php-master-web/scripts/rest_render
diff -u php-master-web/scripts/rest_render:1.2 php-master-web/scripts/rest_render:1.3
--- php-master-web/scripts/rest_render:1.2	Fri Dec 28 18:23:47 2007
+++ php-master-web/scripts/rest_render	Fri Jan 11 11:03:44 2008
@@ -1,5 +1,5 @@
 <?php /* vim: set noet ts=4 sw=4 ft=php: : */
-// $Id: rest_render,v 1.2 2007/12/28 18:23:47 bjori Exp $
+// $Id: rest_render,v 1.3 2008/01/11 11:03:44 bjori Exp $
 
 // usage: configure files to parse and render out of cvs.php.net
 // uses http://pear.horde.org/index.php?package=Text_reST
@@ -19,6 +19,7 @@
 
 	$base_url = 'http://cvs.php.net/viewvc.cgi/';
 
+	$filenames = array();
 	foreach ($urls as $rel_path) {
 		$url = $base_url.$rel_path.'?view=co';
 		$string = file_get_contents($url);
@@ -27,8 +28,13 @@
 
 		$formatter = Text_reST_Formatter::factory('html');
 
-		$filename = $rest_dir.str_replace('/', '_', $rel_path).'.rest';
+		$filenames[] = $filename = $rest_dir.str_replace('/', '_', $rel_path).'.rest';
 		file_put_contents($filename, $formatter->format($document));
 	}
+	// Remove old cache files
+	foreach(array_diff(glob($rest_dir."*.rest"), $filenames) as $old) {
+		echo "Removing old reST cache file: $old\n";
+		unlink($old);
+	}
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.