From 96178a0440a877299a126ac7d6e1bb08249c3a57 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 16 Aug 2018 08:39:37 +0800 Subject: [PATCH] UpdateDatabase.php --- UpdateDatabase.php | 56 +++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git a/UpdateDatabase.php b/UpdateDatabase.php index 5060eeee..c0020faa 100644 --- a/UpdateDatabase.php +++ b/UpdateDatabase.php @@ -216,7 +216,7 @@ class Pman_Core_UpdateDatabase extends Pman $this->clearApacheDataobjectsCache(); - $this->clearCompileFileCache(); + $this->clearApacheAssetCache(); } function output() { @@ -1207,6 +1207,28 @@ class Pman_Core_UpdateDatabase extends Pman } + + function clearApacheAssetCache() + { + $a = new Pman(); + $mods = $a->modulesList(); + + $url = "http://localhost{$this->local_base_url}/Core/Asset"; + $response = $this->curl($url, array( + '_clear_cache' => 1, + + )); + $json = json_decode($response, true); + + if(empty($json['success']) || !$json['success']) { + echo $response. "\n"; + echo "CURL clear compiled file failed\n"; + exit; + } + + } + + function curl($url, $request = array(), $method = 'GET') { if($method == 'GET'){ @@ -1222,7 +1244,6 @@ class Pman_Core_UpdateDatabase extends Pman curl_setopt($ch, CURLOPT_POSTFIELDS, $request); } else { - curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded", "Content-Length: " . strlen($request))); @@ -1242,35 +1263,4 @@ class Pman_Core_UpdateDatabase extends Pman 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; - } - } - - } - } -- 2.39.2