]> _ Git - cubeextranet.git/commitdiff
wait #4840 @1.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 27 Oct 2021 11:03:17 +0000 (11:03 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 27 Oct 2021 11:03:17 +0000 (11:03 +0000)
inc/ws/Controlleur/class.ws.maintenance.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php

index 78eb1bfa716e3ded3a0eb41b971fed726a077329..c368c392b7124f64efd74846ddb511e8a4b18760 100644 (file)
@@ -30,6 +30,38 @@ class wsMaintenance
         }
     }
 
+    public static function cleanCompiledBooks()
+    {
+        cubePHP::neverStop();
+        $dir = WS_BOOKS . '/compiletime/';
+        $hdir = WS_BOOKS . '/html5/';
+        $limit = time() - (3600 * 24 * 7);
+        $stop = 1500;
+        $i = 0;
+        $dr = opendir($hdir);
+        while ($f = readdir($dr)) {
+            if ($f === '.' || $f === '..') {
+                continue;
+            }
+            $timefile = $dir . $f;
+            if (file_exists($timefile) && filemtime($timefile) >= $limit) {
+                continue;
+            }
+
+            $fbdir = $hdir . $f;
+            if (!file_exists($fbdir)) {
+                continue;
+            }
+
+            echo 'Clean ' . $f . "(" . $fbdir . ")<br>";
+            `rm -rf $fbdir`;
+            $i++;
+            if ($i === $stop) {
+                break;
+            }
+        }
+    }
+
     public static function initCompositionVersions($args)
     {
         global $core;
index f3c6927fa07b9bd4e71ec4217412ae81c279a64c..64848c9fab4d210dc78f8e3fdd0d806f03667e49 100644 (file)
@@ -934,6 +934,7 @@ class wsHTML5Compiler
         $this->log('Js written');
         $this->vdir->sync($delete, $this);
         $this->log('Files Synced');
+        touch(rtrim(str_replace('/html5/', '/compiletime/', $this->dir)));
     }
 
     protected function writeStats()