BxDolStudioInstaller.php 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaStudio UNA Studio
  7. * @{
  8. */
  9. define("BX_DOL_STUDIO_INSTALLER_SUCCESS", 0);
  10. define("BX_DOL_STUDIO_INSTALLER_FAILED", 1);
  11. /**
  12. * Base class for Installer classes in modules engine.
  13. *
  14. * The class contains different check functions which are used during the installation process.
  15. * An object of the class is created automatically with modules installer.
  16. * Installation/Uninstallation process can be controlled with config.php file located in [module]/install/ folder.
  17. *
  18. *
  19. * Example of usage:
  20. * refer to the BoonEx modules
  21. *
  22. *
  23. * Memberships/ACL:
  24. * Doesn't depend on user's membership.
  25. *
  26. *
  27. * Alerts:
  28. * no alerts available
  29. *
  30. */
  31. class BxDolStudioInstaller extends BxDolInstallerUtils
  32. {
  33. protected $oDb;
  34. protected $_aConfig;
  35. protected $_sBasePath;
  36. protected $_sHomePath;
  37. protected $_sModulePath;
  38. protected $_bUseFtp;
  39. protected $_aActions;
  40. protected $_bShowOnSuccess = false;
  41. public function __construct($aConfig)
  42. {
  43. parent::__construct();
  44. $this->oDb = bx_instance('BxDolStudioInstallerQuery');
  45. $this->_aConfig = $aConfig;
  46. $this->_sBasePath = BX_DIRECTORY_PATH_MODULES;
  47. $this->_sHomePath = $this->_sBasePath . $aConfig['home_dir'];
  48. $this->_sModulePath = $this->_sBasePath . $aConfig['home_dir'];
  49. $this->_bUseFtp = BX_FORCE_USE_FTP_FILE_TRANSFER;
  50. $this->_aActions = array(
  51. 'perform_install' => array(
  52. 'title' => '',
  53. 'success' => _t('_adm_msg_modules_success_install'),
  54. 'failed' => ''
  55. ),
  56. 'perform_uninstall' => array(
  57. 'title' => '',
  58. 'success' => _t('_adm_msg_modules_success_uninstall'),
  59. 'failed' => ''
  60. ),
  61. 'perform_enable' => array(
  62. 'title' => '',
  63. 'success' => _t('_adm_msg_modules_success_enable'),
  64. 'failed' => ''
  65. ),
  66. 'perform_disable' => array(
  67. 'title' => '',
  68. 'success' => _t('_adm_msg_modules_success_disable'),
  69. 'failed' => ''
  70. ),
  71. 'check_script_version' => array(
  72. 'title' => _t('_adm_txt_modules_check_script_version'),
  73. ),
  74. 'check_dependencies' => array(
  75. 'title' => _t('_adm_txt_modules_check_dependencies'),
  76. ),
  77. 'show_introduction' => array(
  78. 'title' => _t('_adm_txt_modules_show_introduction'),
  79. ),
  80. 'move_sources' => array(
  81. 'title' => _t('_adm_txt_modules_move_sources'),
  82. ),
  83. 'execute_sql' => array(
  84. 'title' => _t('_adm_txt_modules_execute_sql'),
  85. ),
  86. 'install_language' => array(
  87. 'title' => _t('_adm_txt_modules_install_language'),
  88. ),
  89. 'update_languages' => array(
  90. 'title' => _t('_adm_txt_modules_update_languages'),
  91. ),
  92. 'update_relations' => array(
  93. 'title' => _t('_adm_txt_modules_update_relations'),
  94. ),
  95. 'update_relations_for_all' => array(
  96. 'title' => _t('_adm_txt_modules_update_relations_for_all'),
  97. ),
  98. 'process_connections' => array(
  99. 'title' => _t('_adm_txt_modules_process_connections'),
  100. ),
  101. 'process_deleted_profiles' => array(
  102. 'title' => _t('_adm_txt_modules_process_deleted_profiles'),
  103. ),
  104. 'process_menu_triggers' => array(
  105. 'title' => _t('_adm_txt_modules_process_menu_triggers'),
  106. ),
  107. 'process_page_triggers' => array(
  108. 'title' => _t('_adm_txt_modules_process_page_triggers'),
  109. ),
  110. 'process_storages' => array(
  111. 'title' => _t('_adm_txt_modules_process_storages'),
  112. ),
  113. 'process_esearches' => array(
  114. 'title' => _t('_adm_txt_modules_process_esearches'),
  115. ),
  116. 'register_transcoders' => array(
  117. 'title' => _t('_adm_txt_modules_register_transcoders'),
  118. ),
  119. 'unregister_transcoders' => array(
  120. 'title' => _t('_adm_txt_modules_unregister_transcoders'),
  121. ),
  122. 'clear_db_cache' => array(
  123. 'title' => _t('_adm_txt_modules_clear_db_cache'),
  124. ),
  125. 'clear_template_cache' => array(
  126. 'title' => _t('_adm_txt_modules_clear_template_cache'),
  127. ),
  128. 'show_conclusion' => array(
  129. 'title' => _t('_adm_txt_modules_show_conclusion'),
  130. ),
  131. );
  132. $this->_aNonHashableFiles = array(
  133. 'install',
  134. 'updates'
  135. );
  136. }
  137. public function install($aParams, $bAutoEnable = false)
  138. {
  139. //--- Auto uninstall before install ---//
  140. $this->disable($aParams);
  141. $this->uninstall($aParams);
  142. $bAutoEnable = $bAutoEnable || (isset($aParams['auto_enable']) && (bool)$aParams['auto_enable']);
  143. $bHtmlResponce = isset($aParams['html_response']) && (bool)$aParams['html_response'];
  144. //--- Check whether the module was already installed ---//
  145. if($this->oDb->isModule($this->_aConfig['home_uri']))
  146. return array(
  147. 'code' => BX_DOL_STUDIO_IU_RCE_ALREADY_PERFORMED,
  148. 'message' => _t('_adm_err_modules_already_installed'),
  149. 'result' => false
  150. );
  151. $aResult = array();
  152. bx_alert('system', 'before_install', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult));
  153. if ($aResult && !$aResult['result'])
  154. return $aResult;
  155. //--- Check mandatory settings ---//
  156. if($this->oDb->isModuleParamsUsed($this->_aConfig['name'], $this->_aConfig['home_uri'], $this->_aConfig['home_dir'], $this->_aConfig['db_prefix'], $this->_aConfig['class_prefix']))
  157. return array(
  158. 'code' => BX_DOL_STUDIO_IU_RCE_UNIQUE_PARAMS_USED,
  159. 'message' => _t('_adm_txt_modules_params_used'),
  160. 'result' => false
  161. );
  162. //--- Check version compatibility ---//
  163. if(!$this->_isCompatibleWith())
  164. return array(
  165. 'code' => BX_DOL_STUDIO_IU_RCE_WSV_MI,
  166. 'message' => $this->_displayResult('check_script_version', false, '_adm_err_modules_wrong_version_script', $bHtmlResponce),
  167. 'result' => false
  168. );
  169. //--- Check for available translations ---//
  170. $oFile = $this->_getFileManager();
  171. $sModuleUri = $this->_aConfig['home_uri'];
  172. $aLanguages = $this->oDb->getModulesBy(array('type' => 'languages'));
  173. foreach($aLanguages as $aLanguage) {
  174. if($aLanguage['uri'] == 'en')
  175. continue;
  176. $aLanguageConfig = self::getModuleConfig(BX_DIRECTORY_PATH_MODULES . $aLanguage['path'] . '/install/config.php');
  177. if(empty($aLanguageConfig))
  178. continue;
  179. if(!isset($aLanguageConfig['includes'][$sModuleUri]) || empty($aLanguageConfig['includes'][$sModuleUri]))
  180. continue;
  181. $sSrcPath = 'modules/' . $aLanguage['path'] . 'install/data/' . $aLanguageConfig['includes'][$sModuleUri];
  182. $sDstPath = $aLanguageConfig['includes'][$sModuleUri];
  183. $oFile->copy($sSrcPath, $sDstPath);
  184. }
  185. $aResultBefore = $this->_onInstallBefore();
  186. if($aResultBefore !== BX_DOL_STUDIO_INSTALLER_SUCCESS)
  187. return array(
  188. 'message' => $aResultBefore['content'],
  189. 'result' => false
  190. );
  191. //--- Check actions ---//
  192. $aResult = $this->_perform('install', $aParams);
  193. if($aResult['result']) {
  194. $iModuleId = $this->oDb->insertModule($this->_aConfig);
  195. if(($iModuleSubtypes = $this->getSubtypes($this->_aConfig['name'])) != 0)
  196. $this->oDb->updateModule(['subtypes' => $iModuleSubtypes], ['id' => $iModuleId]);
  197. $sTitleKey = BxDolModule::getTitleKey($this->_aConfig['home_uri']);
  198. $oLanguages = BxDolStudioLanguagesUtils::getInstance();
  199. $oLanguages->addLanguageString($sTitleKey, $this->_aConfig['title']);
  200. $oLanguages->compileLanguage();
  201. BxDolStudioInstallerUtils::getInstance()->checkModules();
  202. $aFiles = array();
  203. $this->hashFiles($this->_sModulePath, $aFiles);
  204. foreach($aFiles as $aFile)
  205. $this->oDb->insertModuleTrack($iModuleId, $aFile);
  206. $this->cleanupMemoryAfterAction($this->_aConfig['name'], $this->_aConfig['home_uri'], $iModuleId);
  207. $this->_onInstallAfter();
  208. if(!empty($this->_aConfig['install_success']))
  209. $this->_perform('install_success', $aParams);
  210. }
  211. else {
  212. if(!empty($this->_aConfig['install_failed']))
  213. $this->_perform('install_failed', $aParams);
  214. }
  215. bx_alert('system', 'install', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult));
  216. if($aResult['result'] && $bAutoEnable) {
  217. $aResultEnable = $this->enable($aParams);
  218. $aResult['result'] = $aResult['result'] & $aResultEnable['result'];
  219. $aResult['message'] = $aResult['message'] . $aResultEnable['message'];
  220. }
  221. return $aResult;
  222. }
  223. public function uninstall($aParams, $bAutoDisable = false)
  224. {
  225. $bAutoDisable = $bAutoDisable || (isset($aParams['auto_disable']) && (bool)$aParams['auto_disable']);
  226. $bHtmlResponce = isset($aParams['html_response']) && (bool)$aParams['html_response'];
  227. //--- Check whether the module was already uninstalled ---//
  228. if(!$this->oDb->isModule($this->_aConfig['home_uri']))
  229. return array(
  230. 'code' => BX_DOL_STUDIO_IU_RCE_ALREADY_PERFORMED,
  231. 'message' => _t('_adm_err_modules_already_uninstalled'),
  232. 'result' => false
  233. );
  234. if($bAutoDisable) {
  235. $aResultDisable = $this->disable($aParams);
  236. if(!$aResultDisable['result'])
  237. return $aResultDisable;
  238. }
  239. $aResult = array();
  240. bx_alert('system', 'before_uninstall', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult));
  241. if ($aResult && !$aResult['result'])
  242. return $aResult;
  243. //--- Check for dependent modules ---//
  244. $bDependent = false;
  245. $aDependents = $this->oDb->getDependent($this->_aConfig['name'], $this->_aConfig['home_uri']);
  246. if(is_array($aDependents) && !empty($aDependents)) {
  247. $bDependent = true;
  248. $sMessage = '<br />' . _t('_adm_err_modules_wrong_dependency_uninstall') . '<br />';
  249. foreach($aDependents as $aDependent)
  250. $sMessage .= $aDependent['title'] . '<br />';
  251. }
  252. if($bDependent)
  253. return array(
  254. 'message' => $this->_displayResult('check_dependencies', false, $sMessage, $bHtmlResponce),
  255. 'result' => false
  256. );
  257. //--- Process storages and comments ---//
  258. $aResultBefore = $this->_onUninstallBefore();
  259. if($aResultBefore !== BX_DOL_STUDIO_INSTALLER_SUCCESS)
  260. return array(
  261. 'message' => $aResultBefore['content'],
  262. 'result' => false
  263. );
  264. $aResult = $this->_perform('uninstall', $aParams);
  265. if($aResult['result']) {
  266. $iModuleId = $this->oDb->deleteModule($this->_aConfig);
  267. $sTitleKey = BxDolModule::getTitleKey($this->_aConfig['home_uri']);
  268. $oLanguages = BxDolStudioLanguagesUtils::getInstance();
  269. $oLanguages->deleteLanguageString($sTitleKey);
  270. $oLanguages->compileLanguage();
  271. $this->cleanupMemoryAfterAction($this->_aConfig['name'], $this->_aConfig['home_uri'], $iModuleId);
  272. $this->_onUninstallAfter();
  273. if(!empty($this->_aConfig['uninstall_success']))
  274. $this->_perform('uninstall_success', $aParams);
  275. }
  276. else {
  277. if(!empty($this->_aConfig['uninstall_failed']))
  278. $this->_perform('uninstall_failed', $aParams);
  279. }
  280. if($bAutoDisable) {
  281. $aResult['result'] = $aResultDisable['result'] & $aResult['result'];
  282. $aResult['message'] = $aResultDisable['message'] . $aResult['message'];
  283. }
  284. bx_alert('system', 'uninstall', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult));
  285. return $aResult;
  286. }
  287. public function delete($aParams)
  288. {
  289. $aError = array(
  290. 'message' => _t('_adm_err_modules_cannot_remove_package'),
  291. 'result' => false
  292. );
  293. $oFile = $this->_getFileManager();
  294. if(empty($oFile))
  295. return $aError;
  296. if(!$oFile->delete('modules/' . $this->_aConfig['home_dir']))
  297. return $aError;
  298. return array(
  299. 'message' => '', //_t('_adm_msg_modules_success_delete'),
  300. 'result' => true
  301. );
  302. }
  303. public function enable($aParams)
  304. {
  305. //--- Auto disable before enable ---//
  306. $this->disable($aParams);
  307. $aModule = $this->oDb->getModuleByUri($this->_aConfig['home_uri']);
  308. //--- Check whether the module is installed ---//
  309. if(empty($aModule) || !is_array($aModule))
  310. return array(
  311. 'code' => BX_DOL_STUDIO_IU_RCE_NOT_FOUND,
  312. 'message' => _t('_adm_err_modules_module_not_installed'),
  313. 'result' => false
  314. );
  315. //--- Check whether the module is already enabled ---//
  316. if((int)$aModule['enabled'] != 0)
  317. return array(
  318. 'code' => BX_DOL_STUDIO_IU_RCE_ALREADY_PERFORMED,
  319. 'message' => _t('_adm_err_modules_already_enabled'),
  320. 'result' => false
  321. );
  322. $aResult = array();
  323. if(!empty($this->_aConfig['before_enable'])) {
  324. $aResult = $this->_perform('before_enable', $aParams);
  325. if($aResult && !$aResult['result'])
  326. return $aResult;
  327. }
  328. $aResult = array();
  329. bx_alert('system', 'before_enable', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult));
  330. if ($aResult && !$aResult['result'])
  331. return $aResult;
  332. $aResultBefore = $this->_onEnableBefore();
  333. if($aResultBefore !== BX_DOL_STUDIO_INSTALLER_SUCCESS)
  334. return array(
  335. 'message' => $aResultBefore['content'],
  336. 'result' => false
  337. );
  338. $aResult = $this->_perform('enable', $aParams);
  339. if($aResult['result']) {
  340. $this->oDb->enableModuleByUri($aModule['uri']);
  341. $this->cleanupMemoryAfterAction($aModule['name'], $aModule['uri'], $aModule['id']);
  342. $this->_onEnableAfter();
  343. if(!empty($this->_aConfig['enable_success']))
  344. $this->_perform('enable_success', $aParams);
  345. }
  346. else {
  347. if(!empty($this->_aConfig['enable_failed']))
  348. $this->_perform('enable_failed', $aParams);
  349. }
  350. setParam('sys_revision', 1 + getParam('sys_revision'));
  351. bx_alert('system', 'enable', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult));
  352. return $aResult;
  353. }
  354. public function disable($aParams)
  355. {
  356. $bHtmlResponce = isset($aParams['html_response']) && (bool)$aParams['html_response'];
  357. $aModule = $this->oDb->getModuleByUri($this->_aConfig['home_uri']);
  358. //--- Check whether the module is installed ---//
  359. if(empty($aModule) || !is_array($aModule))
  360. return array(
  361. 'code' => BX_DOL_STUDIO_IU_RCE_NOT_FOUND,
  362. 'message' => _t('_adm_err_modules_module_not_installed'),
  363. 'result' => false
  364. );
  365. //--- Check whether the module is already disabled ---//
  366. if((int)$aModule['enabled'] == 0)
  367. return array(
  368. 'code' => BX_DOL_STUDIO_IU_RCE_ALREADY_PERFORMED,
  369. 'message' => _t('_adm_err_modules_already_disabled'),
  370. 'result' => false
  371. );
  372. $aResult = array();
  373. if(!empty($this->_aConfig['before_disable'])) {
  374. $aResult = $this->_perform('before_disable', $aParams);
  375. if($aResult && !$aResult['result'])
  376. return $aResult;
  377. }
  378. $aResult = array();
  379. bx_alert('system', 'before_disable', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult));
  380. if ($aResult && !$aResult['result'])
  381. return $aResult;
  382. //--- Check for dependent modules ---//
  383. $bDependent = false;
  384. $aDependents = $this->oDb->getDependent($this->_aConfig['name'], $this->_aConfig['home_uri']);
  385. if(is_array($aDependents) && !empty($aDependents)) {
  386. $bDependent = true;
  387. $sMessage = '<br />' . _t('_adm_err_modules_wrong_dependency_disable') . '<br />';
  388. foreach($aDependents as $aDependent)
  389. $sMessage .= $aDependent['title'] . '<br />';
  390. }
  391. if($bDependent)
  392. return array(
  393. 'message' => $this->_displayResult('check_dependencies', false, $sMessage, $bHtmlResponce),
  394. 'result' => false
  395. );
  396. $aResultBefore = $this->_onDisableBefore();
  397. if($aResultBefore !== BX_DOL_STUDIO_INSTALLER_SUCCESS)
  398. return array(
  399. 'message' => $aResultBefore['content'],
  400. 'result' => false
  401. );
  402. $aResult = $this->_perform('disable', $aParams);
  403. if($aResult['result']) {
  404. $this->oDb->disableModuleByUri($aModule['uri']);
  405. $this->cleanupMemoryAfterAction($aModule['name'], $aModule['uri'], $aModule['id']);
  406. $this->_onDisableAfter();
  407. if(!empty($this->_aConfig['disable_success']))
  408. $this->_perform('disable_success', $aParams);
  409. }
  410. else {
  411. if(!empty($this->_aConfig['disable_failed']))
  412. $this->_perform('disable_failed', $aParams);
  413. }
  414. bx_alert('system', 'disable', 0, false, array ('config' => $this->_aConfig, 'result' => &$aResult));
  415. return $aResult;
  416. }
  417. public function callAction($sOperation, $sAction)
  418. {
  419. $sMethod = 'action' . bx_gen_method_name($sAction);
  420. if(!method_exists($this, $sMethod))
  421. return ['code' => BX_DOL_STUDIO_INSTALLER_FAILED, 'msg' => _t('_sys_txt_not_found')];
  422. return $this->$sMethod($sOperation);
  423. }
  424. //--- Get/Set Methods ---//
  425. public function getVendor()
  426. {
  427. return $this->_aConfig['vendor'];
  428. }
  429. public function getName()
  430. {
  431. return $this->_aConfig['name'];
  432. }
  433. public function getTitle()
  434. {
  435. return $this->_aConfig['title'];
  436. }
  437. public function getHomeDir()
  438. {
  439. return $this->_aConfig['home_dir'];
  440. }
  441. //--- Action Methods ---//
  442. protected function actionOperationFailed($mixedResult)
  443. {
  444. return _t('_adm_err_modules_process_action_failed');
  445. }
  446. protected function actionCheckDependencies($sOperation)
  447. {
  448. $sContent = '';
  449. if(in_array($sOperation, array('install', 'enable', 'update'))) {
  450. if(!isset($this->_aConfig['dependencies']) || !is_array($this->_aConfig['dependencies']))
  451. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  452. foreach($this->_aConfig['dependencies'] as $sModule => $sModuleTitle) {
  453. if($this->oDb->isModule($sModule) && $this->oDb->isEnabled($sModule))
  454. continue;
  455. if($this->oDb->isModuleByName($sModule) && $this->oDb->isEnabledByName($sModule))
  456. continue;
  457. $sContent .= $sModuleTitle . '<br />';
  458. }
  459. if(!empty($sContent))
  460. $sContent = '<br />' . _t('_adm_err_modules_wrong_dependency_install') . '<br />' . $sContent;
  461. }
  462. return empty($sContent) ? BX_DOL_STUDIO_INSTALLER_SUCCESS : array('code' => BX_DOL_STUDIO_INSTALLER_FAILED, 'content' => $sContent);
  463. }
  464. protected function actionCheckDependenciesFailed($mixedResult)
  465. {
  466. return $mixedResult['content'];
  467. }
  468. protected function actionShowIntroduction($sOperation)
  469. {
  470. if(!isset($this->_aConfig[$sOperation . '_info']['introduction']))
  471. return BX_DOL_STUDIO_INSTALLER_FAILED;
  472. $sPath = $this->_sHomePath . 'install/info/' . $this->_aConfig[$sOperation . '_info']['introduction'];
  473. return file_exists($sPath) ? array("code" => BX_DOL_STUDIO_INSTALLER_SUCCESS, "content" => file_get_contents($sPath)) : BX_DOL_STUDIO_INSTALLER_FAILED;
  474. }
  475. protected function actionShowConclusion($sOperation)
  476. {
  477. if(!isset($this->_aConfig[$sOperation . '_info']['conclusion']))
  478. return BX_DOL_STUDIO_INSTALLER_FAILED;
  479. $sPath = $this->_sHomePath . 'install/info/' . $this->_aConfig[$sOperation . '_info']['conclusion'];
  480. return file_exists($sPath) ? array("code" => BX_DOL_STUDIO_INSTALLER_SUCCESS, "content" => file_get_contents($sPath)) : BX_DOL_STUDIO_INSTALLER_FAILED;
  481. }
  482. protected function actionMoveSources($sOperation)
  483. {
  484. $oFile = $this->_getFileManager();
  485. $aInstalled = array_merge(array('system'), $this->oDb->getModulesUri());
  486. $bResult = true;
  487. foreach($this->_aConfig['includes'] as $sUri => $sPath) {
  488. if(!in_array($sUri, $aInstalled) || empty($sPath))
  489. continue;
  490. if($sOperation == 'install') {
  491. $sSrcPath = 'modules/' . $this->_aConfig['home_dir'] . 'install/data/' . $sPath;
  492. $sDstPath = $sPath;
  493. $bResult &= $oFile->copy($sSrcPath, $sDstPath);
  494. } else if($sOperation == 'uninstall')
  495. $bResult &= $oFile->delete($sPath);
  496. }
  497. return $bResult ? BX_DOL_STUDIO_INSTALLER_SUCCESS : BX_DOL_STUDIO_INSTALLER_FAILED;
  498. }
  499. protected function actionExecuteSql($sOperation)
  500. {
  501. switch($sOperation) {
  502. case 'install':
  503. $this->actionExecuteSql('disable');
  504. $this->actionExecuteSql('uninstall');
  505. break;
  506. case 'enable':
  507. $this->actionExecuteSql('disable');
  508. break;
  509. }
  510. $mixedResult = $this->oDb->executeSQL($this->_sHomePath . 'install/sql/' . $sOperation . '.sql', $this->getMarkersForDb());
  511. return $mixedResult === true ? BX_DOL_STUDIO_INSTALLER_SUCCESS : array('code' => BX_DOL_STUDIO_INSTALLER_FAILED, 'content' => $mixedResult);
  512. }
  513. protected function actionExecuteSqlAddons($sOperation)
  514. {
  515. $sPath = $this->_sHomePath . 'install/sql/';
  516. $aMarkers = $this->getMarkersForDb();
  517. $aErrors = [];
  518. if(($rHandle = opendir($sPath)) !== false) {
  519. while(($sFile = readdir($rHandle)) !== false) {
  520. if(!is_file($sPath . $sFile) || substr($sFile, 0, strlen($sOperation) + 1) != $sOperation . '-')
  521. continue;
  522. if(($mixedResult = $this->oDb->executeSQL($sPath . $sFile, $aMarkers)) !== true)
  523. $aErrors += $mixedResult;
  524. }
  525. closedir($rHandle);
  526. }
  527. return !$aErrors ? BX_DOL_STUDIO_INSTALLER_SUCCESS : array('code' => BX_DOL_STUDIO_INSTALLER_FAILED, 'content' => $aErrors);
  528. }
  529. protected function actionExecuteSqlFailed($mixedResult)
  530. {
  531. if(is_int($mixedResult))
  532. return $this->actionOperationFailed($mixedResult);
  533. $sResult = _t('_adm_err_modules_wrong_mysql_query') . '<br />';
  534. foreach($mixedResult['content'] as $aQuery) {
  535. $sResult .= _t('_adm_err_modules_wrong_mysql_query_msg', $aQuery['error']) . '<br />';
  536. $sResult .= '<pre>' . $aQuery['query'] . '</pre>';
  537. }
  538. return $sResult;
  539. }
  540. protected function actionInstallLanguage($sOperation)
  541. {
  542. $oLanguages = BxDolStudioLanguagesUtils::getInstance();
  543. $sLanguage = isset($this->_aConfig['home_uri']) ? $this->_aConfig['home_uri'] : '';
  544. $bResult = true;
  545. if($sOperation == 'install')
  546. $bResult = $oLanguages->installLanguage(array('name' => $this->_aConfig['name'], 'path' => $this->_aConfig['home_dir'], 'uri' => $this->_aConfig['home_uri'], 'lang_category' => $this->_aConfig['language_category']), false);
  547. if($bResult)
  548. $bResult &= $oLanguages->compileLanguage(0, true);
  549. $oLanguages->fixLanguage($sLanguage);
  550. return $bResult ? BX_DOL_STUDIO_INSTALLER_SUCCESS : BX_DOL_STUDIO_INSTALLER_FAILED;
  551. }
  552. protected function actionUpdateLanguages($sOperation)
  553. {
  554. if(!isset($this->_aConfig['language_category']) || empty($this->_aConfig['language_category']))
  555. return BX_DOL_STUDIO_INSTALLER_FAILED;
  556. $oLanguages = BxDolStudioLanguagesUtils::getInstance();
  557. $bResult = true;
  558. $aResult = array();
  559. //--- Process Language Category ---//
  560. if($sOperation == 'install')
  561. $iCategoryId = $oLanguages->addLanguageCategory($this->_aConfig['language_category']);
  562. //--- Process languages' key=>value pears ---//
  563. $aModule = array(
  564. 'name' => $this->_aConfig['name'],
  565. 'path' => $this->_aConfig['home_dir'],
  566. 'uri' => $this->_aConfig['home_uri'],
  567. 'lang_category' => $this->_aConfig['language_category']
  568. );
  569. if($sOperation == 'install')
  570. $bResult = $oLanguages->restoreLanguage(0, $aModule, false);
  571. else if($sOperation == 'uninstall')
  572. $bResult = $oLanguages->removeLanguageByModule($aModule, false);
  573. if($sOperation == 'uninstall' && $bResult)
  574. $oLanguages->deleteLanguageCategory($this->_aConfig['language_category']);
  575. return $bResult && $oLanguages->compileLanguage(0, true) ? BX_DOL_STUDIO_INSTALLER_SUCCESS : BX_DOL_STUDIO_INSTALLER_FAILED;
  576. }
  577. /**
  578. * NOTE. The action is ONLY needed for dependent module to let
  579. * Notifications based module(s) know that he(they) should
  580. * update (request and save) handlers from this dependent module.
  581. */
  582. protected function actionUpdateRelations($sOperation)
  583. {
  584. if(!in_array($sOperation, array('install', 'uninstall', 'enable', 'disable')))
  585. return BX_DOL_STUDIO_INSTALLER_FAILED;
  586. if(empty($this->_aConfig['relations']) || !is_array($this->_aConfig['relations']))
  587. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  588. foreach($this->_aConfig['relations'] as $sModule) {
  589. if(!$this->oDb->isModuleByName($sModule))
  590. continue;
  591. $aRelation = $this->oDb->getRelationsBy(array('type' => 'module', 'value' => $sModule));
  592. if(empty($aRelation) || empty($aRelation['on_' . $sOperation]) || !BxDolRequest::serviceExists($aRelation['module'], $aRelation['on_' . $sOperation]))
  593. continue;
  594. bx_srv_ii($aRelation['module'], $aRelation['on_' . $sOperation], array($this->_aConfig['home_uri']));
  595. }
  596. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  597. }
  598. /**
  599. * NOTE. The action is ONLY needed for Notifications based modules
  600. * to update (request and save) handlers from all dependent modules.
  601. */
  602. protected function actionUpdateRelationsForAll($sOperation)
  603. {
  604. if(!in_array($sOperation, array('enable', 'disable')))
  605. return BX_DOL_STUDIO_INSTALLER_FAILED;
  606. if($sOperation == 'enable')
  607. $this->oDb->insertRelation($this->_aConfig['name'], $this->_aConfig['relation_handlers']);
  608. $aRelation = $this->oDb->getRelationsBy(array('type' => 'module', 'value' => $this->_aConfig['name']));
  609. if(empty($aRelation) || empty($aRelation['on_' . $sOperation]))
  610. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  611. $sHandlersMethod = isset($this->_aConfig['relation_handlers_method']) ? $this->_aConfig['relation_handlers_method'] : '';
  612. $aModules = $this->oDb->getModulesBy(array('type' => 'all', 'active' => 1));
  613. foreach($aModules as $aModule) {
  614. $aConfig = self::getModuleConfig($aModule);
  615. if(!empty($aConfig['relations']) && is_array($aConfig['relations']) && in_array($this->_aConfig['name'], $aConfig['relations']))
  616. bx_srv_ii($this->_aConfig['name'], $aRelation['on_' . $sOperation], array($aModule['uri']));
  617. else if($sHandlersMethod && bx_is_srv($aModule['name'], $sHandlersMethod) && (bx_srv('system', 'is_module_content', [$aModule['name']]) || bx_srv('system', 'is_module_context', [$aModule['name']])))
  618. bx_srv_ii($this->_aConfig['name'], $aRelation['on_' . $sOperation], array($aModule['uri']));
  619. }
  620. if($sOperation == 'disable')
  621. $this->oDb->deleteRelation($this->_aConfig['name']);
  622. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  623. }
  624. /**
  625. *
  626. * Connections objects associated with module data. It must be defined which content is associated with the connection.
  627. * The key is connection object name and value is array (possible array values: type, conn, table, field_id).
  628. * If 'type' == 'profiles', then it is considered profiles connection and other possible param is 'conn' ('initiator', 'content' or 'both')
  629. * If 'type' == 'custom' (or ommited), then other possible params are 'conn', 'table' and 'field_id'
  630. * @param string $sOperation - operation type.
  631. */
  632. protected function actionProcessConnections($sOperation)
  633. {
  634. if(!in_array($sOperation, array('uninstall')) || empty($this->_aConfig['connections']))
  635. return BX_DOL_STUDIO_INSTALLER_FAILED;
  636. foreach($this->_aConfig['connections'] as $sObjectConnections => $a) {
  637. $o = BxDolConnection::getObjectInstance($sObjectConnections);
  638. if(!$o)
  639. continue;
  640. $sFuncSuffix = 'DeleteInitiatorAndContent';
  641. if (isset($a['conn']) && 'initiator' == $a['conn'])
  642. $sFuncSuffix = 'DeleteInitiator';
  643. elseif (isset($a['conn']) && 'content' == $a['conn'])
  644. $sFuncSuffix = 'DeleteContent';
  645. if (isset($a['type']) && 'profiles' == $a['type']) {
  646. $sFunc = 'onModuleProfile' . $sFuncSuffix;
  647. $o->$sFunc($this->_aConfig['name']);
  648. } else {
  649. $sFunc = 'onModule' . $sFuncSuffix;
  650. $o->$sFunc($a['table'], $a['field_id']);
  651. }
  652. }
  653. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  654. }
  655. /**
  656. *
  657. * Process the list of menu triggers provided in config array.
  658. * It must be specified in the module which adds menu item and in modules where menu items are added, @see BxDolMenu::processMenuTrigger
  659. * @param string $sOperation - operation type.
  660. */
  661. protected function actionProcessMenuTriggers($sOperation)
  662. {
  663. if(empty($this->_aConfig['menu_triggers']))
  664. return BX_DOL_STUDIO_INSTALLER_FAILED;
  665. foreach($this->_aConfig['menu_triggers'] as $sMenuTriggerName)
  666. BxDolMenu::processMenuTrigger($sMenuTriggerName);
  667. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  668. }
  669. /**
  670. *
  671. * Process the list of page triggers provided in config array.
  672. * It must be specified in the module which adds page block and in modules where page blocks are added, @see BxDolPage::processPageTrigger
  673. * @param string $sOperation - operation type.
  674. */
  675. protected function actionProcessPageTriggers($sOperation)
  676. {
  677. if(empty($this->_aConfig['page_triggers']))
  678. return BX_DOL_STUDIO_INSTALLER_FAILED;
  679. foreach($this->_aConfig['page_triggers'] as $sPageTriggerName)
  680. BxDolPage::processPageTrigger($sPageTriggerName);
  681. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  682. }
  683. protected function actionProcessDeletedProfiles($sOperation)
  684. {
  685. if(!in_array($sOperation, array('install', 'uninstall', 'enable', 'disable')))
  686. return BX_DOL_STUDIO_INSTALLER_FAILED;
  687. $o = BxDolProfileQuery::getInstance();
  688. $o->processDeletedProfiles();
  689. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  690. }
  691. /**
  692. *
  693. * Process the list of extended search forms provided in config array.
  694. * @param string $sOperation - operation type.
  695. */
  696. protected function actionProcessEsearches($sOperation)
  697. {
  698. if(empty($this->_aConfig['esearches']))
  699. return BX_DOL_STUDIO_INSTALLER_FAILED;
  700. foreach($this->_aConfig['esearches'] as $sObject) {
  701. if(in_array($sOperation, array('install', 'enable', 'enable_success')))
  702. BxDolSearchExtended::getObjectInstance($sObject);
  703. else if(in_array($sOperation, array('uninstall', 'disable')))
  704. BxDolSearchExtended::getObjectInstance($sObject)->clean();
  705. }
  706. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  707. }
  708. /**
  709. *
  710. * Process the list of transcoders provided in config array.
  711. * Transcoder objects to automatically register/unregister necessary alerts for.
  712. * @param string $sOperation - operation type.
  713. */
  714. protected function actionRegisterTranscoders($sOperation)
  715. {
  716. if(empty($this->_aConfig['transcoders']))
  717. return BX_DOL_STUDIO_INSTALLER_FAILED;
  718. BxDolTranscoderImage::registerHandlersArray($this->_aConfig['transcoders']);
  719. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  720. }
  721. /**
  722. *
  723. * Process the list of transcoders provided in config array.
  724. * Transcoder objects to automatically register/unregister necessary alerts for.
  725. * @param string $sOperation - operation type.
  726. */
  727. protected function actionUnregisterTranscoders($sOperation)
  728. {
  729. if(empty($this->_aConfig['transcoders']))
  730. return BX_DOL_STUDIO_INSTALLER_FAILED;
  731. BxDolTranscoderImage::unregisterHandlersArray($this->_aConfig['transcoders']);
  732. BxDolTranscoderImage::cleanupObjectsArray($this->_aConfig['transcoders']);
  733. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  734. }
  735. protected function actionClearDbCache($sOperation)
  736. {
  737. $oCache = $this->oDb->getDbCacheObject();
  738. $bResult = $oCache->removeAllByPrefix('db_');
  739. $bResult &= $this->oDb->cleanMemoryAll();
  740. $aKeys = array_keys($GLOBALS);
  741. $aKeysPrefixes = array('bx_dol_cache_memory_');
  742. foreach($aKeysPrefixes as $sKeyPrefix)
  743. foreach($aKeys as $sKey)
  744. if(substr($sKey, 0, strlen($sKeyPrefix)) == $sKeyPrefix)
  745. unset($GLOBALS[$sKey]);
  746. if(!$bResult)
  747. return BX_DOL_STUDIO_INSTALLER_FAILED;
  748. bx_alert('system', 'clear_cache', 0, 0, array('type' => 'custom'));
  749. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  750. }
  751. protected function actionClearTemplateCache($sOperation)
  752. {
  753. $aCaches = array('template', 'css', 'js');
  754. $oCacheUtilities = BxDolCacheUtilities::getInstance();
  755. foreach($aCaches as $sCache) {
  756. $aResult = $oCacheUtilities->clear($sCache);
  757. if($aResult === false)
  758. continue;
  759. if(isset($aResult['code']) && $aResult['code'] != 0)
  760. return BX_DOL_STUDIO_INSTALLER_FAILED;
  761. }
  762. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  763. }
  764. protected function _onInstallBefore()
  765. {
  766. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  767. }
  768. protected function _onInstallAfter()
  769. {
  770. $this->actionExecuteSqlAddons('install');
  771. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  772. }
  773. protected function _onEnableBefore()
  774. {
  775. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  776. }
  777. protected function _onEnableAfter()
  778. {
  779. $this->actionExecuteSqlAddons('enable');
  780. BxDolCmts::onModuleEnable($this->_aConfig['name']);
  781. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  782. }
  783. protected function _onDisableBefore()
  784. {
  785. BxDolCmts::onModuleDisable($this->_aConfig['name']);
  786. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  787. }
  788. protected function _onDisableAfter()
  789. {
  790. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  791. }
  792. protected function _onUninstallBefore()
  793. {
  794. // check if module is already waiting while files are deleting
  795. if(self::isModulePendingUninstall($this->_aConfig['home_uri']))
  796. return array(
  797. 'code' => BX_DOL_STUDIO_INSTALLER_FAILED,
  798. 'content' => _t('_adm_err_modules_pending_uninstall_already'),
  799. );
  800. $bSetModulePendingUninstall = false;
  801. // delete comments and queue for deletion comments attachments
  802. $iFiles = 0;
  803. BxDolCmts::onModuleUninstall($this->_aConfig['name'], $iFiles);
  804. if($iFiles)
  805. $bSetModulePendingUninstall = true;
  806. // delete forms common data
  807. BxDolForm::onModuleUninstall($this->_aConfig['name'], $iFiles);
  808. // delete badges data
  809. BxDolBadges::onModuleUninstall($this->_aConfig['name'], $iFiles);
  810. // delete SEO links
  811. BxDolPage::deleteSeoLinkByModule($this->_aConfig['name']);
  812. // delete alerts
  813. BxDolAlerts::deleteModuleAlerts($this->_aConfig['name']);
  814. // queue for deletion storage files
  815. if(!empty($this->_aConfig['storages']) && is_array($this->_aConfig['storages']))
  816. foreach($this->_aConfig['storages'] as $s)
  817. if(($o = BxDolStorage::getObjectInstance($s)) && $o->queueFilesForDeletionFromObject())
  818. $bSetModulePendingUninstall = true;
  819. // if some files were added to the queue, set module as pending uninstall
  820. if ($bSetModulePendingUninstall) {
  821. self::setModulePendingUninstall($this->_aConfig['home_uri']);
  822. return array(
  823. 'code' => BX_DOL_STUDIO_INSTALLER_FAILED,
  824. 'content' => _t('_adm_err_modules_pending_uninstall'),
  825. );
  826. }
  827. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  828. }
  829. protected function _onUninstallAfter()
  830. {
  831. return BX_DOL_STUDIO_INSTALLER_SUCCESS;
  832. }
  833. protected function _perform($sOperationName, $aParams = array())
  834. {
  835. $bHtmlResponce = isset($aParams['html_response']) && (bool)$aParams['html_response'];
  836. if(!defined('BX_SKIP_INSTALL_CHECK') && !defined('BX_DOL_CRON_EXECUTE') && !$GLOBALS['logged']['admin'])
  837. return array(
  838. 'code' => BX_DOL_STUDIO_IU_RCE_NOT_AUTHORIZED,
  839. 'message' => '_adm_mod_err_only_admin_can_perform_operations_with_modules',
  840. 'result' => false
  841. );
  842. $sMessage = '';
  843. foreach($this->_aConfig[$sOperationName] as $sAction => $iEnabled) {
  844. $sMethod = 'action' . bx_gen_method_name($sAction);
  845. if($iEnabled == 0 || !method_exists($this, $sMethod))
  846. continue;
  847. if(isset($aParams['disabled_actions']) && in_array($sAction, $aParams['disabled_actions']))
  848. continue;
  849. $mixedResult = $this->$sMethod($sOperationName);
  850. //--- On Success ---//
  851. if((is_int($mixedResult) && (int)$mixedResult == BX_DOL_STUDIO_INSTALLER_SUCCESS) || (isset($mixedResult['code']) && (int)$mixedResult['code'] == BX_DOL_STUDIO_INSTALLER_SUCCESS)) {
  852. $sMessage .= $this->_displayResult($sAction, true, isset($mixedResult['content']) ? $mixedResult['content'] : '', $bHtmlResponce);
  853. continue;
  854. }
  855. //--- On Failed ---//
  856. $sMethodFailed = $sMethod . 'Failed';
  857. return array(
  858. 'code' => BX_DOL_STUDIO_IU_RCE_SUBACTION_FAILED,
  859. 'message' => $this->_displayResult($sAction, false, method_exists($this, $sMethodFailed) ? $this->$sMethodFailed($mixedResult) : $this->actionOperationFailed($mixedResult), $bHtmlResponce),
  860. 'result' => false
  861. );
  862. }
  863. if($this->_bShowOnSuccess)
  864. $sMessage = $this->_aActions['perform_' . $sOperationName]['success'] . $sMessage;
  865. return array('message' => $sMessage, 'result' => true);
  866. }
  867. protected function _displayResult($sAction, $bResult, $sResult = '', $bHtmlResponse = true)
  868. {
  869. if($bResult && !in_array($sAction, array('show_introduction', 'show_conclusion')) && !$this->_bShowOnSuccess)
  870. return '';
  871. $sTitle = $this->_aActions[$sAction]['title'] . ' ';
  872. if(!empty($sResult))
  873. $sResult = (substr($sResult, 0, 1) == '_' ? _t($sResult) : $sResult);
  874. $sContent = !empty($sResult) ? $sResult : _t($bResult ? '_adm_txt_modules_process_action_success' : '_adm_err_modules_process_action_failed');
  875. if(!$bHtmlResponse)
  876. return $sTitle . $sContent;
  877. return BxDolStudioTemplate::getInstance()->parseHtmlByName('mod_action_result_step.html', array(
  878. 'color' => $bResult ? 'green' : 'red',
  879. 'title' => $sTitle,
  880. 'content' => $sContent
  881. ));
  882. }
  883. protected function _getFileManager()
  884. {
  885. $oFile = null;
  886. if($this->_bUseFtp) {
  887. $oFile = new BxDolFtp(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost', getParam('sys_ftp_login'), getParam('sys_ftp_password'), getParam('sys_ftp_dir'));
  888. if(!$oFile->connect())
  889. return null;
  890. if(!$oFile->isUna())
  891. return null;
  892. }
  893. else
  894. $oFile = BxDolFile::getInstance();
  895. return $oFile;
  896. }
  897. protected function _isCompatibleWith()
  898. {
  899. $sVersionCur = bx_get_ver();
  900. $bCompatible = false;
  901. if(isset($this->_aConfig['compatible_with']) && is_array($this->_aConfig['compatible_with']))
  902. foreach($this->_aConfig['compatible_with'] as $iKey => $sVersionReq)
  903. $bCompatible = $bCompatible || (version_compare(strtolower($sVersionCur), strtolower($sVersionReq), '>=') == 1);
  904. return $bCompatible;
  905. }
  906. protected function filePathWithoutBase($sPath)
  907. {
  908. return bx_ltrim_str($sPath, $this->_sModulePath);
  909. }
  910. protected function getMarkersForDb()
  911. {
  912. $sDbName = defined('BX_DATABASE_NAME') ? BX_DATABASE_NAME : '';
  913. if (is_array($sDbName))
  914. $sDbName = array_shift($sDbName);
  915. return array(
  916. 'from' => array('{db_name}'),
  917. 'to' => array($sDbName),
  918. );
  919. }
  920. protected function cleanupMemoryAfterAction($sModuleName, $sModuleUri, $iModuleId)
  921. {
  922. $this->oDb->cleanMemory('sys_modules_' . $sModuleName);
  923. $this->oDb->cleanMemory('sys_modules_' . $sModuleUri);
  924. $this->oDb->cleanMemory('sys_modules_' . $iModuleId);
  925. $this->oDb->cleanMemory('sys_module_' . $sModuleName);
  926. $this->oDb->cleanMemory('sys_module_' . $sModuleUri);
  927. $this->oDb->cleanMemory('sys_module_enabled_' . $sModuleName);
  928. $this->oDb->cleanMemory('sys_module_enabled_' . $sModuleUri);
  929. $this->oDb->cleanMemory('sys_modules');
  930. $this->oDb->cleanMemory('sys_modules_modules');
  931. $this->oDb->cleanMemory('sys_modules_modules_active');
  932. }
  933. }
  934. /** @} */