Explorar o código

Merge branch 'master' of https://github.com/unaio/una

AntonLV %!s(int64=9) %!d(string=hai) anos
pai
achega
519c130cfb

+ 9 - 9
inc/classes/BxDolDb.php

@@ -995,36 +995,36 @@ class BxDolDb extends BxDolFactory implements iBxDolSingleton
 
     protected function executeStatement($oStatement, $aBindings = array(), $bVerbose = null)
     {
-    	$bResult = false;
-		
+        $bResult = false;
+
 		foreach($aBindings as $sKey => $mixedValue) {
 			if(is_null($mixedValue))
 				$oStatement->bindValue(":{$sKey}", $mixedValue, PDO::PARAM_NULL);
             else if(is_numeric($mixedValue))
                 $oStatement->bindValue(":{$sKey}", $mixedValue, PDO::PARAM_INT);
             else
-                $oStatement->bindValue(":{$sKey}", $mixedValue, PDO::PARAM_STR);		
+                $oStatement->bindValue(":{$sKey}", $mixedValue, PDO::PARAM_STR);
 		}
 
     	switch (self::$_rLink->getAttribute(PDO::ATTR_ERRMODE)) {
     		case PDO::ERRMODE_SILENT:
-    			$bResult = $this->executeStatementSilent($oStatement, $bVerbose);
+    			$bResult = $this->executeStatementSilent($oStatement, $aBindings, $bVerbose);
     			break;
 
     		case PDO::ERRMODE_EXCEPTION:
-    			$bResult = $this->executeStatementException($oStatement, $bVerbose);
+    			$bResult = $this->executeStatementException($oStatement, $aBindings, $bVerbose);
     			break;
     	}
 
     	return $bResult;
     }
 
-    protected function executeStatementException($oStatement, $bVerbose = null)
+    protected function executeStatementException($oStatement, $aBindings = array(), $bVerbose = null)
     {
     	$bResult = false;
 
     	try {
-			$bResult = $oStatement->execute();
+			$bResult = $oStatement->execute(!empty($aBindings) && is_array($aBindings) ? $aBindings : null);
 		}
 		catch (PDOException $oException) {
 			$aError = $oStatement->errorInfo();
@@ -1043,9 +1043,9 @@ class BxDolDb extends BxDolFactory implements iBxDolSingleton
 		return $bResult;
     }
 
-    protected function executeStatementSilent($oStatement, $bVerbose = null)
+    protected function executeStatementSilent($oStatement, $aBindings = array(), $bVerbose = null)
     {
-    	$bResult = $oStatement->execute();
+    	$bResult = $oStatement->execute(!empty($aBindings) && is_array($aBindings) ? $aBindings : null);
     	if($bResult)
     		return true;
 

+ 13 - 2
inc/classes/BxDolService.php

@@ -29,6 +29,8 @@
  */
 class BxDolService extends BxDol
 {
+    static protected $_aMemoryCache = array();
+
     /**
      * Perform serice call
      * @param $mixed module name or module id
@@ -37,7 +39,7 @@ class BxDolService extends BxDol
      * @param $sClass class to search for service method, by default it is main module class
      * @return service call result
      */
-    public static function call($mixed, $sMethod, $aParams = array(), $sClass = 'Module')
+    public static function call($mixed, $sMethod, $aParams = array(), $sClass = 'Module', $bIgnoreCache = false)
     {
         $oDb = BxDolModuleQuery::getInstance();
 
@@ -47,7 +49,16 @@ class BxDolService extends BxDol
         else
             $aModule = $oDb->getModuleById($mixed);
 
-        return empty($aModule) ? '' : BxDolRequest::processAsService($aModule, $sMethod, $aParams, $sClass);
+        if (empty($aModule))
+            return '';
+
+        $sKey = md5($mixed . $sMethod . print_r($aParams, true) . $sClass);
+        if (!$bIgnoreCache && isset(self::$_aMemoryCache[$sKey]))
+            return self::$_aMemoryCache[$sKey];
+
+        self::$_aMemoryCache[$sKey] = BxDolRequest::processAsService($aModule, $sMethod, $aParams, $sClass);
+
+        return self::$_aMemoryCache[$sKey];
     }
 
     /**

+ 1 - 0
modules/boonex/english/data/langs/system/en.xml

@@ -2083,6 +2083,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_menu_item_title_system_main_menu"><![CDATA[Main Menu]]></string>
 	<string name="_sys_menu_item_title_system_more"><![CDATA[More]]></string>
 	<string name="_sys_menu_item_title_system_orders"><![CDATA[Orders]]></string>
+	<string name="_sys_menu_item_title_system_powered_by"><![CDATA[Powered By]]></string>
 	<string name="_sys_menu_item_title_system_profile"><![CDATA[Profile]]></string>
 	<string name="_sys_menu_item_title_system_search"><![CDATA[Search]]></string>
 	<string name="_sys_menu_item_title_system_set_acl_level"><![CDATA[Set membership]]></string>

+ 2 - 1
modules/boonex/russian/data/langs/system/ru.xml

@@ -2080,7 +2080,8 @@
 	<string name="_sys_menu_item_title_system_logout"><![CDATA[Выйти]]></string>
 	<string name="_sys_menu_item_title_system_main_menu"><![CDATA[Главное Меню]]></string>
 	<string name="_sys_menu_item_title_system_more"><![CDATA[Ещё]]></string>
-	<string name="_sys_menu_item_title_system_orders"><![CDATA[Заказы]]></string>
+    <string name="_sys_menu_item_title_system_orders"><![CDATA[Заказы]]></string>
+    <string name="_sys_menu_item_title_system_powered_by"><![CDATA[Сделано с помощью]]></string>
 	<string name="_sys_menu_item_title_system_profile"><![CDATA[Профиль]]></string>
 	<string name="_sys_menu_item_title_system_search"><![CDATA[Поиск]]></string>
 	<string name="_sys_menu_item_title_system_set_acl_level"><![CDATA[Назначить членство]]></string>