httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davi Arnaut <d...@haxent.com.br>
Subject [patch 08/16] dont delete empty cache directories
Date Wed, 20 Sep 2006 02:34:01 GMT
Don't delete empty cache directories, it is too expensive and unnecessary.
Later they can be removed with htcacheclean.

Index: modules/cache/mod_disk_cache.c
===================================================================
--- modules/cache/mod_disk_cache.c.orig
+++ modules/cache/mod_disk_cache.c
@@ -579,45 +579,6 @@
         }
     }
 
-    /* now delete directories as far as possible up to our cache root */
-    if (dobj->root) {
-        const char *str_to_copy;
-
-        str_to_copy = dobj->hdrsfile ? dobj->hdrsfile : dobj->datafile;
-        if (str_to_copy) {
-            char *dir, *slash, *q;
-
-            dir = apr_pstrdup(p, str_to_copy);
-
-            /* remove filename */
-            slash = strrchr(dir, '/');
-            *slash = '\0';
-
-            /*
-             * now walk our way back to the cache root, delete everything
-             * in the way as far as possible
-             *
-             * Note: due to the way we constructed the file names in
-             * header_file and data_file, we are guaranteed that the
-             * cache_root is suffixed by at least one '/' which will be
-             * turned into a terminating null by this loop.  Therefore,
-             * we won't either delete or go above our cache root.
-             */
-            for (q = dir + dobj->root_len; *q ; ) {
-                 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
-                              "disk_cache: Deleting directory %s from cache",
-                              dir);
-
-                 rc = apr_dir_remove(dir, p);
-                 if (rc != APR_SUCCESS && !APR_STATUS_IS_ENOENT(rc)) {
-                    break;
-                 }
-                 slash = strrchr(q, '/');
-                 *slash = '\0';
-            }
-        }
-    }
-
     return OK;
 }
 

--

Mime
View raw message