function get($s='', $opts = Array())
{
+ if(
+ !empty($_REQUEST['_clear_cache']) &&
+ !empty($_REQUEST['_clear_module'])
+ ) {
+ $this->clearCompiledFilesCache($_REQUEST['_clear_module']);
+ }
+
$this->sessionState(0);
exit;
}
+
function post($s='') {
die('invalid');
}
- static function getCompileDir($type)
+ static function getCompileDir($type, $module = '', $is_mkdir = true)
{
$ff = HTML_FlexyFramework::get();
$compile_dir = session_save_path() . "/";
+ $module = (empty($module)) ? $ff->project : $module;
+
switch($type) {
case 'js':
case 'css':
$compile_dir .= implode("-", array(
$ui['name'],
- $ff->project,
+ $module,
$ff->version,
"{$type}compile"
));
return $compile_dir;
}
+ if(!$is_mkdir) {
+ return false;
+ }
+
if(mkdir($compile_dir, 0700, true)) {
return $compile_dir;
}
return false;
}
- function clearCompiledFilesCache()
+ function clearCompiledFilesCache($module)
{
- // using getCompileDir..
+ $compile_dir = $this->getCompileDir('js', $module, false);
+
+ if(empty($compile_dir)) {
+ $this->jok('EMPTY');
+ }
+
+ foreach(glob($compile_dir.'/*.*') as $v){
+ unlink($v);
+ }
- return;
+ $this->jok('DONE');
}
}
$this->runExtensions();
$this->clearApacheDataobjectsCache();
+
+ $this->clearCompileFileCache();
}
function output() {
return $response;
}
-
+ function clearCompileFileCache()
+ {
+ $a = new Pman();
+ $mods = $a->modulesList();
+
+ $url = "http://localhost{$this->local_base_url}/Core/Asset";
+
+ foreach ($mods as $mod) {
+
+ $response = $this->curl($url, array(
+ '_clear_cache' => 1,
+ '_clear_module' => $mod
+ ));
+
+ $json = json_decode($response, true);
+
+ if(
+ empty($json['data']) ||
+ (
+ $json['data'] != 'DONE' &&
+ $json['data'] != 'EMPTY'
+ )
+ ){
+ echo $response. "\n";
+ echo "CURL clear compiled file failed\n";
+ exit;
+ }
+ }
+
+ }
}