]> _ Git - cubeextranet.git/commitdiff
#1933 @0.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 19 Feb 2018 16:14:25 +0000 (16:14 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 19 Feb 2018 16:14:25 +0000 (16:14 +0000)
inc/ws/Controlleur/class.ws.maintenance.php

index d820dd2e79c7ce443e2a6fc129cf4901a385ae7a..7901b37bd1d4674a4be9f7a14e9e9bb26ae2be08 100644 (file)
@@ -523,12 +523,10 @@ class wsMaintenance {
        }
 
        public static function cleanPackages() {
-               $limit = TIME - (4 * 3600); // 4 heures avant maintenant*
+               $limit = TIME - (2 * 3600); // 4 heures avant maintenant*
                //
-               $dirs = array(ROOT . '/cache/download',
-                             WS_FILES . '/packager/download/',
-                             // WS_FILES . '/packager/',
-                             //'/home/ws/www/download',
+               $dirs = array(
+                       WS_FILES . '/packager/'
                );
                // Clean downloads
 
@@ -542,6 +540,9 @@ class wsMaintenance {
                                        continue;
                                }
                                $f = $dir . $file;
+                               if ($file == 'download') {
+                                       continue;
+                               }
                                if (!is_dir($f)) {
                                        continue;
                                }
@@ -980,18 +981,14 @@ class wsMaintenance {
        }
 
        public static function cleanDownload($args) {
-               $root = ROOT . '/cache/download/';
-               cubeFiles::scanRecursiveDir($root, $files);
-               $limit = TIME - 14400;
-               foreach ($files as $f) {
-                       if (filemtime($f) < $limit) {
-                               unlink($f);
-                       }
-               }
-               $files = cubeFiles::scandir($root, true);
-               foreach ($files as $f) {
-                       if (cubeFiles::isEmpty($f)) {
-                               @rmdir($f);
+               $dirs = [ROOT . '/cache/download/', WS_FILES . '/packager/download'];
+               foreach ($dirs as $dir) {
+                       cubeFiles::scanRecursiveDir($dir, $files);
+                       $limit = TIME - 7200;
+                       foreach ($files as $f) {
+                               if (filemtime($f) < $limit) {
+                                       unlink($f);
+                               }
                        }
                }
        }