Jelajahi Sumber

Ticket #4711 - Automations. Todo for test evaluation.

AntonLV 2 tahun lalu
induk
melakukan
9fef952f44
2 mengubah file dengan 22 tambahan dan 12 penghapusan
  1. 17 9
      ai/BxDolAI.php
  2. 5 3
      studio/classes/BxDolStudioAgentsAutomatorsCmts.php

+ 17 - 9
ai/BxDolAI.php

@@ -162,13 +162,16 @@ class BxDolAI extends BxDolFactory implements iBxDolSingleton
         
         $this->evalCode($aParams['automator'], true);
     }
-    
-    
+
     public function evalCode($aAutomator, $isWriteLog = true, $aParams = null)
     {
+        /*
+         * TODO: Improve code evaluation.
+         * 
         ob_start();
         set_error_handler("evalErrorHandler");
-        try{
+         */
+        try {
              $sCode = '';
              if ($aAutomator['type'] == 'scheduler'){
                  $sCode = $aAutomator['code'] . '; onCron();';
@@ -187,18 +190,23 @@ class BxDolAI extends BxDolFactory implements iBxDolSingleton
                 $this->writeLog($oException->getFile() . ':' . $oException->getLine() . ' ' . $oException->getMessage());
             }
             return $oException->getMessage();
-        } finally {
-             $sOutput = ob_get_clean();
-             if ($sOutput != '')
+        } 
+        finally {
+            /*
+             * TODO: Improve code evaluation.
+             * 
+            $sOutput = ob_get_clean();
+            if ($sOutput != '')
                 return "Eval error: " . $sOutput;
             restore_error_handler();
+             */
         }
     }
-    
+
     private function writeLog($sString)
-	{
+    {
         bx_log('sys_agents', $sString);
-	}
+    }
 }
 
 class EvalException extends Exception {}

+ 5 - 3
studio/classes/BxDolStudioAgentsAutomatorsCmts.php

@@ -78,14 +78,16 @@ class BxDolStudioAgentsAutomatorsCmts extends BxTemplCmts
         
         $aAutomator = $this->_oAI->getAutomator($iObjId, true);
         $aAutomator['code'] = $aCmt['cmt_text'];
-        
+
+/*
+ * TODO: Improve code evaluation.
+ * 
         $oAlert = new BxDolAlerts('test', 'test', -1, -1, []);
         $sRv = $this->_oAI->evalCode($aAutomator, false, ['alert' => $oAlert]);
-        
-        
         if ($sRv != ''){
             return echoJson(['msg' => 'Error in code: ' . $sRv]);
         }
+*/
 
         if(!$this->_oQueryAgents->updateAutomators(['code' => $aCmt['cmt_text'], 'status' => 'ready'], ['id' => (int)$this->getId()]))
             return echoJson([]);