From 0c8e11f2d9a2d22430cb94f41070d80ef18caec9 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 18 Jan 2016 05:28:04 +0100 Subject: [PATCH] cache changes to support scss, scssphp library reference included, system api contains cache call now --- api/api_system.php | 3 +++ cache/cache.php | 33 ++++++++++++++++---------------- cache/cache_scss.php | 15 +++++++++++++++ cache/qq/SYS_CACHE_CHECK.php | 8 ++++++-- cache/qq/SYS_CACHE_PUT.php | 6 +++++- files/files.php | 2 +- html/html.php | 2 ++ lib/autoload.inc | 3 ++- page/State.php | 8 ++++++++ sql/qt/mysql/data/system_api.sql | 3 +++ 10 files changed, 61 insertions(+), 22 deletions(-) create mode 100644 cache/cache_scss.php diff --git a/api/api_system.php b/api/api_system.php index 64fd869..436bacd 100644 --- a/api/api_system.php +++ b/api/api_system.php @@ -22,4 +22,7 @@ class api_system extends api_login{ public static function call_bug($message,$data){ return \SYSTEM\SAI\saimod_sys_todo::report($message,$data);} + + public static function call_cache($id,$ident){ + return \SYSTEM\CACHE\cache::get($id, $ident,true);} } \ No newline at end of file diff --git a/cache/cache.php b/cache/cache.php index 6fbfee6..d297a35 100644 --- a/cache/cache.php +++ b/cache/cache.php @@ -1,30 +1,29 @@ ';} public static function script($src,$type = 'text/javascript',$rel = 'stylesheet', $language = 'JavaScript', $script = ''){ return '';} + public static function style($style){ + return '';} } diff --git a/lib/autoload.inc b/lib/autoload.inc index 1b369e5..c203dd5 100644 --- a/lib/autoload.inc +++ b/lib/autoload.inc @@ -11,4 +11,5 @@ require_once dirname(__FILE__).'/animate/autoload.inc'; require_once dirname(__FILE__).'/lettering/autoload.inc'; require_once dirname(__FILE__).'/bootstrap_growl/autoload.inc'; require_once dirname(__FILE__).'/git/autoload.inc'; -require_once dirname(__FILE__).'/jqbootstrapvalidation/autoload.inc'; \ No newline at end of file +require_once dirname(__FILE__).'/jqbootstrapvalidation/autoload.inc'; +require_once dirname(__FILE__).'/scssphp/autoload.inc'; \ No newline at end of file diff --git a/page/State.php b/page/State.php index 51a995a..1fde7ac 100644 --- a/page/State.php +++ b/page/State.php @@ -31,6 +31,14 @@ class State { $row['css'] = $row['js'] = array(); if(\class_exists($row['php_class']) && \method_exists($row['php_class'], 'css') && \is_callable($row['php_class'].'::css')){ $row['css'] = array_merge($row['css'], \call_user_func($row['php_class'].'::css'));} + \LIB\lib_scssphp::php(); + if(\class_exists($row['php_class']) && \method_exists($row['php_class'], 'scss') && \is_callable($row['php_class'].'::scss')){ + $scss = \call_user_func($row['php_class'].'::scss'); + foreach($scss as $s){ + if(!\SYSTEM\CACHE\cache_scss::get($s)){ + \SYSTEM\CACHE\cache_scss::put($s, (new \Leafo\ScssPhp\Compiler())->compile(file_get_contents($s)));} + $row['css'][] = \SYSTEM\CACHE\cache_scss::url($s);} + } if(\class_exists($row['php_class']) && \method_exists($row['php_class'], 'js') && \is_callable($row['php_class'].'::js')){ $row['js'] = array_merge($row['js'], \call_user_func($row['php_class'].'::js'));} $row['php_class'] = ''; diff --git a/sql/qt/mysql/data/system_api.sql b/sql/qt/mysql/data/system_api.sql index 8e48fb9..e236252 100644 --- a/sql/qt/mysql/data/system_api.sql +++ b/sql/qt/mysql/data/system_api.sql @@ -28,6 +28,9 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (60, 0, 2, 10, 'bug', 'message', 'STRING'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (61, 0, 2, 10, 'bug', 'data', 'JSON'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (70, 0, 2, 10, 'cache', 'id', 'INT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (71, 0, 2, 10, 'cache', 'ident', 'STRING'); + INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (90, 0, 4, -1, NULL, '_lang', 'LANG'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (91, 0, 4, -1, NULL, '_result', 'RESULT'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (92, 0, 4, -1, NULL, '_escaped_fragment_', 'STRING'); \ No newline at end of file