UpdateDatabase.php
authorAlan Knowles <alan@roojs.com>
Thu, 16 Aug 2018 00:39:37 +0000 (08:39 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 16 Aug 2018 00:39:37 +0000 (08:39 +0800)
UpdateDatabase.php

index 5060eee..c0020fa 100644 (file)
@@ -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;
-            }
-        }
-        
-    }
-    
 }