1
0

BxDolStudioInstallerUtils.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup TridentStudio Trident Studio
  7. * @{
  8. */
  9. bx_import('BxDolLanguages');
  10. define('BX_DOL_UNITY_URL_ROOT', 'http://www.boonex.com/');
  11. define('BX_DOL_UNITY_URL_MARKET', BX_DOL_UNITY_URL_ROOT . 'market/');
  12. define('BX_DOL_STUDIO_IU_RC_SUCCESS', 0);
  13. define('BX_DOL_STUDIO_IU_RC_FAILED', 1);
  14. define('BX_DOL_STUDIO_IU_RC_SCHEDULED', 2);
  15. class BxDolStudioInstallerUtils extends BxDolInstallerUtils implements iBxDolSingleton
  16. {
  17. protected $bUseFtp;
  18. protected $sAuthorizedAccessClass;
  19. public function __construct()
  20. {
  21. if (isset($GLOBALS['bxDolClasses'][get_class($this)]))
  22. trigger_error ('Multiple instances are not allowed for the class: ' . get_class($this), E_USER_ERROR);
  23. parent::__construct();
  24. $this->bUseFtp = BX_FORCE_USE_FTP_FILE_TRANSFER;
  25. $this->sAuthorizedAccessClass = 'BxDolStudioOAuthPlugin';
  26. }
  27. /**
  28. * Prevent cloning the instance
  29. */
  30. public function __clone()
  31. {
  32. if (isset($GLOBALS['bxDolClasses'][get_class($this)]))
  33. trigger_error('Clone is not allowed for the class: ' . get_class($this), E_USER_ERROR);
  34. }
  35. /**
  36. * Get singleton instance of the class
  37. */
  38. public static function getInstance()
  39. {
  40. if (!isset($GLOBALS['bxDolClasses'][__CLASS__]))
  41. $GLOBALS['bxDolClasses'][__CLASS__] = new BxDolStudioInstallerUtils();
  42. return $GLOBALS['bxDolClasses'][__CLASS__];
  43. }
  44. public static function getNamePerformAction($sParam)
  45. {
  46. return 'sys_perform_action_' . md5($sParam);
  47. }
  48. public static function getNameDownloadFile($sParam)
  49. {
  50. return 'sys_download_file_complete_' . $sParam;
  51. }
  52. public static function getNamePerformModulesUpgrade()
  53. {
  54. return 'sys_upgrade_modules_transient';
  55. }
  56. /*
  57. * Is used to complete Downloading inside Transient Cron Job.
  58. */
  59. public function serviceDownloadFileComplete($sFilePath, $aParams = array())
  60. {
  61. return $this->downloadFileComplete($sFilePath, array_merge($aParams, array('transient' => true)));
  62. }
  63. /*
  64. * Is used to perform action inside Transient Cron Job.
  65. */
  66. public function servicePerformAction($sDirectory, $sOperation, $aParams)
  67. {
  68. return $this->perform($sDirectory, $sOperation, array_merge($aParams, array('transient' => true)));
  69. }
  70. /*
  71. * Is used to perform modules upgrade inside Transient Cron Job.
  72. */
  73. public function servicePerformModulesUpgrade($bEmailNotify)
  74. {
  75. return $this->performModulesUpgrade(true, $bEmailNotify);
  76. }
  77. public function getAccessObject($bAuthorizedAccess)
  78. {
  79. $sClass = $bAuthorizedAccess ? $this->sAuthorizedAccessClass : 'BxDolStudioJson';
  80. bx_import($sClass);
  81. return $sClass::getInstance();
  82. }
  83. public function getModules($bTitleAsKey = true)
  84. {
  85. $aModules = array();
  86. $oTemplate = BxDolStudioTemplate::getInstance();
  87. $aInstalledInfo = $this->getInstalledInfo();
  88. $sPath = BX_DIRECTORY_PATH_MODULES;
  89. if(($rHandleVendor = opendir($sPath)) !== false) {
  90. while(($sVendor = readdir($rHandleVendor)) !== false) {
  91. if(substr($sVendor, 0, 1) == '.' || !is_dir($sPath . $sVendor))
  92. continue;
  93. if(($rHandleModule = opendir($sPath . $sVendor)) !== false) {
  94. while(($sModule = readdir($rHandleModule)) !== false) {
  95. if(!is_dir($sPath . $sVendor . '/' . $sModule) || substr($sModule, 0, 1) == '.')
  96. continue;
  97. $sModulePath = $sVendor . '/' . $sModule . '/';
  98. $aModule = $this->getConfigModule($sPath . $sModulePath . 'install/config.php', !empty($aInstalledInfo[$sModulePath]) ? $aInstalledInfo[$sModulePath] : array());
  99. if(empty($aModule))
  100. continue;
  101. $aModules[$bTitleAsKey ? $aModule['title'] : $aModule['name']] = $aModule;
  102. }
  103. closedir($rHandleModule);
  104. }
  105. }
  106. closedir($rHandleVendor);
  107. }
  108. ksort($aModules);
  109. return $aModules;
  110. }
  111. public function getUpdates()
  112. {
  113. $aUpdates = array();
  114. $oTemplate = BxDolStudioTemplate::getInstance();
  115. $aInstalledInfo = $this->getInstalledInfo();
  116. $sPath = BX_DIRECTORY_PATH_MODULES;
  117. if(($rHandleVendor = opendir($sPath)) !== false) {
  118. while(($sVendor = readdir($rHandleVendor)) !== false) {
  119. if(substr($sVendor, 0, 1) == '.' || !is_dir($sPath . $sVendor))
  120. continue;
  121. if(($rHandleModule = opendir($sPath . $sVendor . '/')) !== false) {
  122. while(($sModule = readdir($rHandleModule)) !== false) {
  123. if(!is_dir($sPath . $sVendor . '/' . $sModule) || substr($sModule, 0, 1) == '.')
  124. continue;
  125. $sModulePath = $sVendor . '/' . $sModule . '/';
  126. if(empty($aInstalledInfo[$sModulePath]))
  127. continue;
  128. $aUpdate = $this->getUpdate($aInstalledInfo[$sModulePath]);
  129. if(!empty($aUpdate))
  130. $aUpdates[$aUpdate['title']] = $aUpdate;
  131. }
  132. closedir($rHandleModule);
  133. }
  134. }
  135. closedir($rHandleVendor);
  136. }
  137. ksort($aUpdates);
  138. return $aUpdates;
  139. }
  140. public function getUpdate($mixedModule)
  141. {
  142. $aResult = array();
  143. if(!is_array($mixedModule))
  144. $mixedModule = BxDolModuleQuery::getInstance()->{is_numeric($mixedModule) ? 'getModuleById' : 'getModuleByName'}($mixedModule);
  145. if(empty($mixedModule) || !is_array($mixedModule))
  146. return $aResult;
  147. $sPathModule = BX_DIRECTORY_PATH_MODULES . $mixedModule['path'];
  148. $sPathUpdates = $sPathModule . 'updates/';
  149. $rHandleUpdate = @opendir($sPathUpdates);
  150. if($rHandleUpdate === false)
  151. return $aResult;
  152. while(($sUpdate = readdir($rHandleUpdate)) !== false) {
  153. $sPathUpdate = $sPathUpdates . $sUpdate . '/';
  154. if(substr($sUpdate, 0, 1) == '.' || !is_dir($sPathUpdate))
  155. continue;
  156. $aUpdate = $this->getConfigUpdate($sPathModule . 'install/config.php', $sPathUpdate . 'install/config.php', $mixedModule);
  157. if(empty($aUpdate) || !is_array($aUpdate) || version_compare($aUpdate['module_version'], $aUpdate['version_from']) != 0)
  158. continue;
  159. $aResult = $aUpdate;
  160. break;
  161. }
  162. closedir($rHandleUpdate);
  163. return $aResult;
  164. }
  165. public function perform($sDirectory, $sOperation, $aParams = array())
  166. {
  167. $bTransient = false;
  168. if(isset($aParams['transient']) && $aParams['transient'] === true) {
  169. $bTransient = true;
  170. unset($aParams['transient']);
  171. }
  172. if(!defined('BX_DOL_CRON_EXECUTE') && !self::isRealOwner() && !in_array($sOperation, array('install', 'uninstall', 'enable', 'disable'))) {
  173. if($this->addTransientJob(self::getNamePerformAction($sDirectory), 'perform_action', array($sDirectory, $sOperation, $aParams)))
  174. return array('code' => BX_DOL_STUDIO_IU_RC_SCHEDULED, 'message' => _t('_adm_mod_msg_process_operation_scheduled'));
  175. else
  176. return array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => _t('_adm_mod_err_process_operation_failed', $sOperation, $sDirectory));
  177. }
  178. $sConfigFile = 'install/config.php';
  179. $sInstallerFile = 'install/installer.php';
  180. $sInstallerClass = $sOperation == 'update' ? 'Updater' : 'Installer';
  181. $aConfig = self::getModuleConfig(BX_DIRECTORY_PATH_MODULES . $sDirectory . $sConfigFile);
  182. $sPathInstaller = BX_DIRECTORY_PATH_MODULES . $sDirectory . $sInstallerFile;
  183. if(empty($aConfig) || !file_exists($sPathInstaller)) {
  184. $sMessage = _t('_adm_mod_err_process_operation_failed', $sOperation, $sDirectory);
  185. if($bTransient)
  186. $this->emailNotify($sMessage);
  187. return array('code' => BX_DOL_STUDIO_IU_RC_FAILED, 'message' => $sMessage);
  188. }
  189. require_once($sPathInstaller);
  190. $sClassName = $aConfig['class_prefix'] . $sInstallerClass;
  191. $oInstaller = new $sClassName($aConfig);
  192. $aResult = $oInstaller->$sOperation($aParams);
  193. if(!$aResult['result'] && $bTransient)
  194. $this->emailNotify($aResult['message']);
  195. return array('code' => $aResult['result'] ? BX_DOL_STUDIO_IU_RC_SUCCESS : BX_DOL_STUDIO_IU_RC_FAILED, 'message' => $aResult['message']);
  196. }
  197. public function performModulesUpgrade($bDirectly = true, $bEmailNotify = true)
  198. {
  199. if(!defined('BX_DOL_CRON_EXECUTE') && !$bDirectly)
  200. return $this->addTransientJob(self::getNamePerformModulesUpgrade(), 'perform_modules_upgrade', array($bEmailNotify));
  201. $aFailed = array();
  202. $aUpdates = $this->checkUpdates();
  203. if(empty($aUpdates) || !is_array($aUpdates))
  204. return true;
  205. foreach($aUpdates as $aUpdate) {
  206. $mixedResult = $this->downloadUpdatePublic($aUpdate['name']);
  207. if($mixedResult !== true) {
  208. $aFailed[$aUpdate['name']] = $mixedResult;
  209. continue;
  210. }
  211. }
  212. $aSuccess = array();
  213. $aUpdates = $this->getUpdates();
  214. if(empty($aUpdates) || !is_array($aUpdates))
  215. return true;
  216. foreach($aUpdates as $aUpdate) {
  217. $aResult = $this->perform($aUpdate['dir'], 'update');
  218. if((int)$aResult['code'] != 0) {
  219. $aFailed[$aUpdate['module_name']] = $aResult['message'];
  220. continue;
  221. }
  222. $aSuccess[$aUpdate['module_name']] = $aUpdate['version_to'];
  223. }
  224. if($bEmailNotify && !empty($aSuccess))
  225. $this->emailNotifyModulesUpgrade('success', $aSuccess);
  226. if($bEmailNotify && !empty($aFailed))
  227. $this->emailNotifyModulesUpgrade('failed', $aFailed);
  228. return empty($aFailed);
  229. }
  230. public function checkModules($bAuthorizedAccess = false)
  231. {
  232. if($bAuthorizedAccess)
  233. $aProducts = $this->getAccessObject(true)->loadItems(array('dol_type' => 'purchased_products', 'dol_domain' => BX_DOL_URL_ROOT));
  234. else
  235. $aProducts = $this->getAccessObject(false)->load(BX_DOL_UNITY_URL_MARKET . 'json_browse_purchased', array('key' => getParam('sys_oauth_key')));
  236. $oModuleDb = BxDolModuleQuery::getInstance();
  237. $oModuleDb->updateModule(array('hash' => ''));
  238. if(!empty($aProducts) && is_array($aProducts))
  239. foreach ($aProducts as $aProduct)
  240. $oModuleDb->updateModule(array('hash' => $aProduct['hash']), array('name' => $aProduct['name']));
  241. return $aProducts;
  242. }
  243. public function checkUpdates($bAuthorizedAccess = false)
  244. {
  245. $aModules = BxDolModuleQuery::getInstance()->getModules();
  246. $aProducts = array();
  247. foreach($aModules as $aModule) {
  248. if(empty($aModule['name']))
  249. continue;
  250. $aProducts[] = array(
  251. 'name' => $aModule['name'],
  252. 'version' => $aModule['version'],
  253. 'hash' => $aModule['hash'],
  254. );
  255. }
  256. $sProducts = base64_encode(serialize($aProducts));
  257. if($bAuthorizedAccess)
  258. return $this->getAccessObject(true)->loadItems(array('dol_type' => 'available_updates', 'dol_products' => $sProducts));
  259. return $this->getAccessObject(false)->load(BX_DOL_UNITY_URL_MARKET . 'json_browse_updates', array(
  260. 'key' => getParam('sys_oauth_key'),
  261. 'products' => $sProducts
  262. ));
  263. }
  264. public function downloadFileAuthorized($iFileId)
  265. {
  266. $aItem = $this->getAccessObject(true)->loadItems(array('dol_type' => 'product_file', 'dol_file_id' => $iFileId));
  267. return $this->downloadFileInit($aItem, array('module_name' => $aItem['module_name']));
  268. }
  269. public function downloadUpdatePublic($sModuleName, $bAutoUpdate = false)
  270. {
  271. $aModule = BxDolModuleQuery::getInstance()->getModuleByName($sModuleName);
  272. $aItem = $this->getAccessObject(false)->load(BX_DOL_UNITY_URL_MARKET . 'json_download_update', array(
  273. 'key' => getParam('sys_oauth_key'),
  274. 'product' => base64_encode(serialize(array(
  275. 'name' => $aModule['name'],
  276. 'version' => $aModule['version'],
  277. 'hash' => $aModule['hash'],
  278. ))),
  279. ));
  280. return $this->downloadFileInit($aItem, array('module_name' => $sModuleName, 'auto_action' => $bAutoUpdate ? 'update' : ''));
  281. }
  282. protected function downloadFileInit($aItem, $aParams = array())
  283. {
  284. if(empty($aItem) || !is_array($aItem))
  285. return $aItem;
  286. //--- write ZIP archive.
  287. $sFilePath = '';
  288. $mixedResult = $this->performWrite($aItem, $sFilePath);
  289. if($mixedResult !== true)
  290. return $mixedResult;
  291. return $this->downloadFileComplete($sFilePath, $aParams);
  292. }
  293. protected function downloadFileComplete($sFilePath, $aParams = array())
  294. {
  295. $bTransient = false;
  296. if(isset($aParams['transient']) && $aParams['transient'] === true) {
  297. $bTransient = true;
  298. unset($aParams['transient']);
  299. }
  300. $sAutoAction = isset($aParams['auto_action']) ? $aParams['auto_action'] : '';
  301. $bAutoAction = !empty($sAutoAction);
  302. if(!defined('BX_DOL_CRON_EXECUTE') && !self::isRealOwner()) {
  303. if(!$this->addTransientJob(self::getNameDownloadFile($aParams['module_name']), 'download_file_complete', array($sFilePath, $aParams)))
  304. return _t('_adm_str_err_download_failed');
  305. return array('code' => BX_DOL_STUDIO_IU_RC_SCHEDULED, 'message' => _t('_adm_str_msg_download' . ($bAutoAction ? '_and_install' : '') . '_scheduled'));
  306. }
  307. //--- Unarchive package.
  308. $sPackagePath = '';
  309. $mixedResult = $this->performUnarchive($sFilePath, $sPackagePath);
  310. @unlink($sFilePath);
  311. if($mixedResult !== true) {
  312. if($bTransient)
  313. $this->emailNotify($mixedResult);
  314. return $mixedResult;
  315. }
  316. //--- Copy unarchived package.
  317. $sHomePath = '';
  318. $mixedResult = $this->performCopy($sPackagePath, $sHomePath);
  319. @bx_rrmdir($sPackagePath);
  320. if($mixedResult !== true) {
  321. if($bTransient)
  322. $this->emailNotify($mixedResult);
  323. return $mixedResult;
  324. }
  325. if(!$bAutoAction)
  326. return true;
  327. //--- Autoinstall the downloaded package if it's needed.
  328. $aResult = $this->perform($sHomePath, $sAutoAction, $aParams);
  329. if((int)$aResult['code'] != 0) {
  330. if($bTransient)
  331. $this->emailNotify($aResult['message']);
  332. return $aResult['message'];
  333. }
  334. return true;
  335. }
  336. protected function performWrite($aItem, &$sFilePath)
  337. {
  338. $sFilePath = BX_DIRECTORY_PATH_TMP . $aItem['name'];
  339. if(file_exists($sFilePath))
  340. @unlink($sFilePath);
  341. $iUmaskSave = umask(0);
  342. if(!$rHandler = fopen($sFilePath, 'w')) {
  343. umask($iUmaskSave);
  344. return _t('_adm_str_err_cannot_write');
  345. }
  346. $sContent = urldecode($aItem['content']);
  347. if(!fwrite($rHandler, $sContent, strlen($sContent))) {
  348. umask($iUmaskSave);
  349. return _t('_adm_str_err_cannot_write');
  350. }
  351. fclose($rHandler);
  352. umask($iUmaskSave);
  353. return true;
  354. }
  355. protected function performUnarchive($sFilePath, &$sPackagePath)
  356. {
  357. if(!class_exists('ZipArchive'))
  358. return _t('_adm_str_err_zip_not_available');
  359. $iUmaskSave = umask(0);
  360. $oZip = new ZipArchive();
  361. if($oZip->open($sFilePath) !== true) {
  362. umask($iUmaskSave);
  363. return _t('_adm_str_err_cannot_unzip_package');
  364. }
  365. $sPackageFolder = '';
  366. if($oZip->numFiles > 0)
  367. $sPackageFolder = $oZip->getNameIndex(0);
  368. if(empty($sPackageFolder)) {
  369. umask($iUmaskSave);
  370. return _t('_adm_str_err_cannot_unzip_package');
  371. }
  372. $sPackagePath = BX_DIRECTORY_PATH_TMP . $sPackageFolder;
  373. if(file_exists($sPackagePath)) // remove existing tmp folder with the same name
  374. @bx_rrmdir($sPackagePath);
  375. if(!$oZip->extractTo(BX_DIRECTORY_PATH_TMP)) {
  376. umask($iUmaskSave);
  377. return _t('_adm_str_err_cannot_unzip_package');
  378. }
  379. $oZip->close();
  380. umask($iUmaskSave);
  381. return true;
  382. }
  383. protected function performCopy($sPackagePath, &$sHomePath)
  384. {
  385. if($this->bUseFtp) {
  386. $sLogin = getParam('sys_ftp_login');
  387. $sPassword = getParam('sys_ftp_password');
  388. $sPath = getParam('sys_ftp_dir');
  389. if(empty($sLogin) || empty($sPassword) || empty($sPath))
  390. return _t('_adm_str_err_no_ftp_info');
  391. $oFile = new BxDolFtp($_SERVER['HTTP_HOST'], $sLogin, $sPassword, $sPath);
  392. if(!$oFile->connect())
  393. return _t('_adm_str_err_cannot_connect_to_ftp');
  394. if(!$oFile->isTrident())
  395. return _t('_adm_str_err_destination_not_valid');
  396. }
  397. else
  398. $oFile = BxDolFile::getInstance();
  399. $aConfig = self::getModuleConfig($sPackagePath . 'install/config.php');
  400. if(empty($aConfig) || !is_array($aConfig) || empty($aConfig['home_dir']))
  401. return _t('_adm_str_err_wrong_package_format');
  402. $sHomePath = $aConfig['home_dir'];
  403. if(!$oFile->copy($sPackagePath, 'modules/' . $sHomePath))
  404. return _t('_adm_str_err_files_copy_failed');
  405. return true;
  406. }
  407. protected function getConfigModule($sConfigPath, $aInstalled = array())
  408. {
  409. $aConfig = self::getModuleConfig($sConfigPath);
  410. if(empty($aConfig) || !is_array($aConfig))
  411. return array();
  412. $bInstalled = !empty($aInstalled);
  413. $bEnabled = $bInstalled && (int)$aInstalled['enabled'] == 1;
  414. $sVersion = $bInstalled ? $aInstalled['version'] : $aConfig['version'];
  415. return array(
  416. 'type' => $aConfig['type'],
  417. 'name' => isset($aConfig['name']) ? $aConfig['name'] : $aConfig['home_uri'],
  418. 'title' => bx_process_output($aConfig['title']),
  419. 'vendor' => $aConfig['vendor'],
  420. 'version' => $sVersion,
  421. 'uri' => $aConfig['home_uri'],
  422. 'dir' => $aConfig['home_dir'],
  423. 'note' => isset($aConfig['note']) ? bx_process_output($aConfig['note']) : '',
  424. 'installed' => $bInstalled,
  425. 'enabled' => $bEnabled
  426. );
  427. }
  428. protected function getConfigUpdate($sConfigPathModule, $sConfigPathUpdate, $aInstalledModule = array())
  429. {
  430. $aModule = $this->getConfigModule($sConfigPathModule, $aInstalledModule);
  431. if(empty($aModule) || !$aModule['installed'])
  432. return array();
  433. $aConfig = self::getModuleConfig($sConfigPathUpdate);
  434. if(empty($aConfig) || !is_array($aConfig))
  435. return array();
  436. return array(
  437. 'title' => bx_process_output($aConfig['title']),
  438. 'vendor' => $aConfig['vendor'],
  439. 'version_from' => $aConfig['version_from'],
  440. 'version_to' => $aConfig['version_to'],
  441. 'dir' => $aConfig['home_dir'],
  442. 'module_type' => $aModule['type'],
  443. 'module_name' => $aModule['name'],
  444. 'module_dir' => $aModule['dir'],
  445. 'module_version' => $aModule['version']
  446. );
  447. }
  448. private function getInstalledInfo()
  449. {
  450. $aModules = BxDolModuleQuery::getInstance()->getModules();
  451. $aInstalledInfo = array();
  452. foreach($aModules as $aModule)
  453. $aInstalledInfo[$aModule['path']] = $aModule;
  454. return $aInstalledInfo;
  455. }
  456. private function addTransientJob($sName, $sAction, $aParams)
  457. {
  458. if(BxDolCronQuery::getInstance()->addTransientJobService($sName, array('system', $sAction, $aParams, 'DolStudioInstallerUtils')))
  459. return true;
  460. return false;
  461. }
  462. private function emailNotify($sMessage)
  463. {
  464. sendMailTemplateSystem('t_BgOperationFailed', array (
  465. 'conclusion' => strip_tags($sMessage),
  466. ));
  467. }
  468. private function emailNotifyModulesUpgrade($sResult, $aData)
  469. {
  470. $oModuleQuery = BxDolModuleQuery::getInstance();
  471. $sConclusion = '';
  472. if(!empty($aData))
  473. foreach($aData as $sModule => $sMessage) {
  474. $aModule = $oModuleQuery->getModuleByName($sModule);
  475. $sConclusion .= _t('_sys_et_txt_body_modules_upgrade_' . $sResult, $aModule['title'], $sMessage);
  476. }
  477. sendMailTemplateSystem('t_UpgradeModules' . ucfirst($sResult), array (
  478. 'conclusion' => $sConclusion,
  479. ));
  480. }
  481. }
  482. /** @} */