22 protected $_aSkipFiles = array(
'functions.php',
'vendormetadata.php' );
31 return $this->
getConfig()->getAllModules();
44 if ( !is_array($aModulePaths) || count($aModulePaths) < 1 ) {
49 if ( is_array($aDisabledModules) && count($aDisabledModules) > 0 && count($aModulePaths) > 0 ) {
50 $aModulePaths = array_diff_key($aModulePaths, array_flip($aDisabledModules));
63 $aModulePaths = array();
65 if ( is_array($aDisabledModules) && count($aDisabledModules) > 0 ) {
69 if ( !is_array($aModulePaths) || count($aModulePaths) < 1 ) {
73 if ( is_array($aModulePaths) || count($aModulePaths) > 0 ) {
74 $aModulePaths = array_intersect_key($aModulePaths, array_flip($aDisabledModules));
88 return $this->
getConfig()->getConfigParam(
'aModuleVersions');
98 return $this->
getConfig()->getConfigParam(
'aModules');
108 return $this->
getConfig()->getConfigParam(
'aLegacyModules');
118 return $this->
getConfig()->getConfigParam(
'aDisabledModules');
128 return $this->
getConfig()->getConfigParam(
'aModulePaths');
138 return (array) $this->
getConfig()->getConfigParam(
'aModuleEvents');
149 $aModulePaths = array();
151 if (is_array($aModules) && count($aModules) > 0) {
152 foreach ($aModules as $aModuleClasses) {
153 foreach ($aModuleClasses as $sModule) {
154 $sModuleId = substr($sModule, 0, strpos($sModule,
"/"));
155 $aModulePaths[$sModuleId] = $sModuleId;
159 return $aModulePaths;
169 return $this->
getConfig()->getConfigParam(
'aModuleFiles');
179 return $this->
getConfig()->getConfigParam(
'aModuleTemplates');
196 $aDisabledModuleClasses = array();
197 if (isset($aDisabledModules) && is_array($aDisabledModules)) {
199 foreach ($aDisabledModules as $sId) {
200 $sPath = $aModulePaths[$sId];
201 if (!isset($sPath)) {
204 foreach ( $aModules as $sClass => $aModuleClasses ) {
205 foreach ( $aModuleClasses as $sModuleClass ) {
206 if (strpos($sModuleClass, $sPath.
"/") === 0 ) {
207 $aDisabledModuleClasses[] = $sModuleClass;
214 return $aDisabledModuleClasses;
266 $aDeletedExtIds = array();
267 if ( !empty($aDeletedExt) ) {
268 $oModule =
oxNew(
'oxModule');
269 foreach ( $aDeletedExt as $sOxClass => $aDeletedModules ) {
270 foreach ( $aDeletedModules as $sModulePath ) {
271 $aDeletedExtIds[] = $oModule->getIdByPath($sModulePath);
276 if ( !empty( $aDeletedExtIds ) ) {
277 $aDeletedExtIds = array_unique( $aDeletedExtIds );
280 return $aDeletedExtIds;
291 $aDeletedExt = array();
293 foreach ( $aModules as $sOxClass => $aModulesList ) {
294 foreach ( $aModulesList as $sModulePath ) {
295 $sExtPath = $this->
getConfig()->getModulesDir() . $sModulePath.
'.php';
296 if ( !file_exists( $sExtPath ) ) {
297 $aDeletedExt[$sOxClass][] = $sModulePath;
316 if (is_array($aAllModuleArray) && is_array($aRemModuleArray)) {
317 foreach ($aAllModuleArray as $sClass => $aModuleChain) {
318 if (!is_array($aModuleChain)) {
319 $aModuleChain = array($aModuleChain);
321 if (isset($aRemModuleArray[$sClass])) {
322 if (!is_array($aRemModuleArray[$sClass])) {
323 $aRemModuleArray[$sClass] = array($aRemModuleArray[$sClass]);
325 $aAllModuleArray[$sClass] = array();
326 foreach ($aModuleChain as $sModule) {
327 if (!in_array($sModule, $aRemModuleArray[$sClass])) {
328 $aAllModuleArray[$sClass][] = $sModule;
331 if (!count($aAllModuleArray[$sClass])) {
332 unset ($aAllModuleArray[$sClass]);
335 $aAllModuleArray[$sClass] = $aModuleChain;
341 return $aAllModuleArray;
354 if (is_array($aModuleArray)) {
355 foreach ($aModuleArray as $sClass => $aModuleChain) {
356 $aModules[$sClass] = implode(
'&', $aModuleChain);
375 $this->
getConfig()->saveShopConfVar(
'aarr',
'aModules', $aUpdatedExt );
389 $aDisabledExtensionIds = array_diff($aDisabledExtensionIds, $aDeletedExtIds);
390 $oConfig->saveShopConfVar(
'arr',
'aDisabledModules', $aDisabledExtensionIds );
404 foreach ( $aDeletedExtIds as $sDeletedExtId ) {
405 if ( isset($aLegacyExt[$sDeletedExtId]) ) {
406 unset( $aLegacyExt[$sDeletedExtId] );
410 $this->
getConfig()->saveShopConfVar(
'aarr',
'aLegacyModules', $aLegacyExt );
424 foreach ( $aDeletedModule as $sDeletedModuleId ) {
425 if ( isset($aModulePaths[$sDeletedModuleId]) ) {
426 unset( $aModulePaths[$sDeletedModuleId] );
430 $this->
getConfig()->saveShopConfVar(
'aarr',
'aModulePaths', $aModulePaths );
444 foreach ( $aDeletedModule as $sDeletedModuleId ) {
445 if ( isset($aModuleVersions[$sDeletedModuleId]) ) {
446 unset( $aModuleVersions[$sDeletedModuleId] );
450 $this->
getConfig()->saveShopConfVar(
'aarr',
'aModuleVersions', $aModuleVersions );
464 foreach ( $aDeletedModule as $sDeletedModuleId ) {
465 if ( isset($aModuleEvents[$sDeletedModuleId]) ) {
466 unset( $aModuleEvents[$sDeletedModuleId] );
470 $this->
getConfig()->saveShopConfVar(
'aarr',
'aModuleEvents', $aModuleEvents );
484 foreach ( $aDeletedModule as $sDeletedModuleId ) {
485 if ( isset($aModuleFiles[$sDeletedModuleId]) ) {
486 unset( $aModuleFiles[$sDeletedModuleId] );
490 $this->
getConfig()->saveShopConfVar(
'aarr',
'aModuleFiles', $aModuleFiles );
504 foreach ( $aDeletedModule as $sDeletedModuleId ) {
505 if ( isset($aModuleTemplates[$sDeletedModuleId]) ) {
506 unset( $aModuleTemplates[$sDeletedModuleId] );
510 $this->
getConfig()->saveShopConfVar(
'aarr',
'aModuleTemplates', $aModuleTemplates );
522 if ( !is_array($aDeletedExtIds) || !count($aDeletedExtIds) ) {
528 $aConfigIds = $sDelExtIds = array();
529 foreach ( $aDeletedExtIds as $sDeletedExtId ) {
530 $aConfigIds[] = $oDb->quote(
'module:'.$sDeletedExtId);
531 $sDelExtIds[] = $oDb->quote($sDeletedExtId);
534 $sConfigIds = implode(
', ', $aConfigIds );
535 $sDelExtIds = implode(
', ', $sDelExtIds );
537 $aSql[] =
"DELETE FROM oxconfig where oxmodule IN ($sConfigIds)";
538 $aSql[] =
"DELETE FROM oxconfigdisplay where oxcfgmodule IN ($sConfigIds)";
539 $aSql[] =
"DELETE FROM oxtplblocks where oxmodule IN ($sDelExtIds)";
541 foreach ( $aSql as $sQuery ) {
542 $oDb->execute( $sQuery );
557 $sModulesDir =
oxRegistry::get(
'oxUtilsFile')->normalizeDir( $sModulesDir );
559 foreach ( glob( $sModulesDir.
'*' ) as $sModuleDirPath ) {
561 $sModuleDirPath .= ( is_dir( $sModuleDirPath ) ) ?
'/':
'';
562 $sModuleDirName = basename( $sModuleDirPath );
565 if ( in_array( $sModuleDirName, $this->_aSkipFiles ) || (!is_dir( $sModuleDirPath ) && substr($sModuleDirName, -4) !=
".php")) {
574 $oModule =
oxNew(
'oxModule' );
575 $sModuleDirName = ( !empty($sVendorDir) ) ? $sVendorDir.
'/'.$sModuleDirName : $sModuleDirName;
576 $oModule->loadByDir( $sModuleDirName );
577 $sModuleId = $oModule->getId();
578 $this->_aModules[$sModuleId] = $oModule;
582 if ( !is_array($aModulePaths) || !array_key_exists( $sModuleId, $aModulePaths ) ) {
589 $oModule->deactivate();
595 if ( $this->_aModules !== null ) {
596 uasort($this->_aModules, array($this,
'_sortModules'));
612 return strcasecmp($oModule1->getTitle(), $oModule2->getTitle());
624 if ( is_dir( $sModuleDir ) && file_exists( $sModuleDir .
'vendormetadata.php' ) ) {
640 $aModules = $this->
getConfig()->getConfigParam(
'aModules' );
641 if (is_array($aModules)) {
642 $sModules = implode(
'&', $aModules );
644 if ( preg_match(
"@(^|&+)".$sModuleDir.
"\b@", $sModules ) ) {
664 $aModulePaths[$sModuleId] = $sModulePath;
665 $this->
getConfig()->saveShopConfVar(
'aarr',
'aModulePaths', $aModulePaths );