[Aminet-commit] r135 - trunk/phpinclude/include

aminet-discuss at aminet.net aminet-discuss at aminet.net
Mon May 26 01:41:42 CEST 2008


Author: mendoza
Date: 2008-05-25 16:41:42 -0700 (Sun, 25 May 2008)
New Revision: 135

Modified:
   trunk/phpinclude/include/search.php
Log:
Use hierarchal structure for cache files to avoid all files residing in the same dir

Modified: trunk/phpinclude/include/search.php
===================================================================
--- trunk/phpinclude/include/search.php	2008-05-25 23:38:05 UTC (rev 134)
+++ trunk/phpinclude/include/search.php	2008-05-25 23:41:42 UTC (rev 135)
@@ -9,7 +9,11 @@
 function cachefile_hash($_SEARCH) {
    global $amirepo_root;
    $cachedir = $amirepo_root . '/cache';
-   $cachefile = $cachedir . '/' . md5(var_export($_SEARCH,true));
+   $cache_subpath = preg_replace('/(..)/','/$1',md5(var_export($_SEARCH,true)));
+   $cachefile = $cachedir . $cache_subpath;
+   if (!is_dir(dirname($cachefile)) {
+      mkdir(dirname($cachefile), 0777, true);
+   }
    return $cachefile;
 }
 




More information about the Aminet-commit mailing list