]> git.agnieray.net Git - galette.git/commitdiff
Use Galette version in cache directory
authorJohan Cwiklinski <johan@x-tnd.be>
Sat, 17 Feb 2024 18:02:35 +0000 (19:02 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Sun, 18 Feb 2024 06:32:29 +0000 (07:32 +0100)
Reorganize cache directory contents a bit

closes #1787

bin/release
galette/config/paths.inc.php
galette/config/versions.inc.php
galette/includes/galette.inc.php
galette/lib/Galette/Core/Preferences.php
tests/TestsBootstrap.php

index 412bb84236d10ce8844938e9a1e0bbb78f51d605..39bd1e6cb402905c156ec35b4361adad6c300f54 100755 (executable)
@@ -314,11 +314,11 @@ def add_libs(rel_name, galette_archive):
     galette.close()
 
     #set galette nightly version
-    includes_dir = os.path.join(src_dir, rel_name, 'galette', 'includes')
+    config_dir = os.path.join(src_dir, rel_name, 'galette', 'config')
     if nightly_version != None:
-        sed_cmd = 'sed -e "s/GALETTE_NIGHTLY\', false/GALETTE_NIGHTLY\', \'%s\'/" -i galette.inc.php' % nightly_version
+        sed_cmd = 'sed -e "s/GALETTE_NIGHTLY\', false/GALETTE_NIGHTLY\', \'%s\'/" -i versions.inc.php' % nightly_version
         print(sed_cmd)
-        p1 = subprocess.Popen(sed_cmd, shell=True, cwd=includes_dir)
+        p1 = subprocess.Popen(sed_cmd, shell=True, cwd=config_dir)
         p1.wait()
 
     #install npm modules
index 5d1e3cea83df2c01ad599143b0ee0459139e860a..559d528abcf2aa34e978082631ad9c94d7c38ab8 100644 (file)
@@ -97,7 +97,7 @@ if (!defined('GALETTE_COMPILE_DIR')) {
     define('GALETTE_COMPILE_DIR', GALETTE_DATA_PATH . 'templates_c/');
 }
 if (!defined('GALETTE_CACHE_DIR')) {
-    define('GALETTE_CACHE_DIR', GALETTE_DATA_PATH . 'cache/');
+    define('GALETTE_CACHE_DIR', GALETTE_DATA_PATH . 'cache/' . GALETTE_VERSION . '/');
 }
 if (!defined('GALETTE_EXPORTS_PATH')) {
     define('GALETTE_EXPORTS_PATH', GALETTE_DATA_PATH . 'exports/');
index d7f8c149f9412ac3e906326ea80664a6f4853a0c..c41f1b00db1a832484a44941116d1ebdafd5cf66 100644 (file)
@@ -38,4 +38,8 @@
 define('GALETTE_PHP_MIN', '8.1');
 define('GALETTE_MYSQL_MIN', '5.7');
 define('GALETTE_MARIADB_MIN', '10.4');
-define('GALETTE_PGSQL_MIN', '11')  ;
\ No newline at end of file
+define('GALETTE_PGSQL_MIN', '11')  ;
+define('GALETTE_NIGHTLY', false);
+define('GALETTE_VERSION', 'v1.0.2');
+define('GALETTE_COMPAT_VERSION', '1.0.0');
+define('GALETTE_DB_VERSION', '0.960');
index 6a83526f542c7afc95de0b96a91d03986ee542aa..e69824a95a54dadd20e038ce4a228e268d80c063 100644 (file)
@@ -99,16 +99,11 @@ if (
     $profiler->start();
 }
 
-define('GALETTE_NIGHTLY', false);
-define('GALETTE_VERSION', 'v1.0.2');
-
 //Version to display
 if (!defined('GALETTE_HIDE_VERSION')) {
     define('GALETTE_DISPLAY_VERSION', \Galette\Core\Galette::gitVersion(false));
 }
 
-define('GALETTE_COMPAT_VERSION', '1.0.0');
-define('GALETTE_DB_VERSION', '0.960');
 if (!defined('GALETTE_MODE')) {
     define('GALETTE_MODE', \Galette\Core\Galette::MODE_PROD);
 }
index 9fdb84615347b480fb19e13b9e16641be3e565f2..dd10a3fb2eb7e0793ae4a96b73e3a5d13f017bac 100644 (file)
@@ -1358,7 +1358,11 @@ class Preferences
     public function cleanHtmlValue(string $value): string
     {
         $config = \HTMLPurifier_Config::createDefault();
-        $config->set('Cache.SerializerPath', GALETTE_CACHE_DIR);
+        $cache_dir = rtrim(GALETTE_CACHE_DIR, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'htmlpurifier';
+        if (!file_exists($cache_dir)) {
+            mkdir($cache_dir, 0755, true);
+        }
+        $config->set('Cache.SerializerPath', $cache_dir);
         $purifier = new \HTMLPurifier($config);
         return $purifier->purify($value);
     }
index 8fc67d729b982478f6ea5fdd13b1549cf4315861..9763de76fc17c501d5ab88c108b3cc6e40097773 100755 (executable)
@@ -47,6 +47,7 @@ define('GALETTE_PLUGINS_PATH', GALETTE_TESTS_PATH . '/plugins/');
 define('GALETTE_TPL_SUBDIR', 'templates/default/');
 define('GALETTE_THEME', 'themes/default/');
 define('GALETTE_DATA_PATH', GALETTE_TESTS_PATH . '/tests-data/');
+define('GALETTE_CACHE_DIR', GALETTE_DATA_PATH . 'cache/');
 if (is_dir(GALETTE_DATA_PATH)) {
     $files = new RecursiveIteratorIterator(
         new RecursiveDirectoryIterator(