[Mapbender-commits] r7458 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jan 19 07:47:11 EST 2011


Author: apour
Date: 2011-01-19 04:47:11 -0800 (Wed, 19 Jan 2011)
New Revision: 7458

Modified:
   trunk/mapbender/http/php/mod_savewmc_server.php
Log:
Remove wmc session files from tmp folder.

Modified: trunk/mapbender/http/php/mod_savewmc_server.php
===================================================================
--- trunk/mapbender/http/php/mod_savewmc_server.php	2011-01-19 07:04:28 UTC (rev 7457)
+++ trunk/mapbender/http/php/mod_savewmc_server.php	2011-01-19 12:47:11 UTC (rev 7458)
@@ -43,6 +43,19 @@
 }
 
 if ($saveInSession === 1) {
+    // CLEAN SESSION WMC FILES
+    $tmp = scandir(TMPDIR);
+    // get all files from tmp folder
+    for($p = 0; $p < count($tmp); $p++) {
+        // match timestamp on begin of the filename
+        if(preg_match("/^([\d]+).*$/i", $tmp[$p],$timestamp)) {
+            // if file older than 24h, remove it.
+            if((time() - $timestamp[1]) >= 86400) { // 86400 = 24h
+                unlink(TMPDIR."/".$tmp[$p]);
+            }
+        }
+    }
+    
 	// store XML in tmp folder
     if(Mapbender::session()->get("mb_wmc")) {
         $filename = Mapbender::session()->get("mb_wmc");



More information about the Mapbender_commits mailing list