コード例 #1
0
ファイル: ModulesManager.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Check if the license is free
  *
  * @return boolean
  */
 public static function getHardDisableList()
 {
     $modules = array_filter(static::getActiveModules(), function ($module) {
         return !in_array($module['author'], array('CDev', 'XC'));
     });
     return array_keys($modules + \Includes\SafeMode::getUnsafeModulesList());
 }
コード例 #2
0
ファイル: ModulesManager.php プロジェクト: kewaunited/xcart
 /**
  * Disable some (or all) modules in SafeMode
  *
  * @return void
  */
 protected static function performSafeModeProtection()
 {
     if (\Includes\SafeMode::isSafeModeStarted()) {
         if (!\Includes\SafeMode::isRestoreDateSet()) {
             // Get unsafe modules list
             $modules = \Includes\SafeMode::isSoftResetRequested() ? \Includes\SafeMode::getUnsafeModulesList() : array_keys(static::$activeModules);
         } else {
             $restorePoint = static::getRestorePoint(\Includes\SafeMode::getRestoreDate());
             if (!empty($restorePoint)) {
                 //modules to disable
                 $modules = array();
                 $active = static::getActiveModules();
                 foreach ($active as $key => $module) {
                     $toDisable = true;
                     foreach ($restorePoint['current'] as $id => $moduleName) {
                         if ($moduleName != null && $key === $moduleName) {
                             $moduleName = null;
                             $toDisable = false;
                             break;
                         }
                     }
                     if ($toDisable) {
                         $modules[] = $key;
                     }
                 }
                 //modules to enable
                 $toEnable = array();
                 $installed = static::getModulesList();
                 foreach ($restorePoint['current'] as $id => $moduleName) {
                     $isInstalled = array_key_exists($moduleName, $installed);
                     $isActive = array_key_exists($moduleName, $active);
                     if ($isInstalled && !$isActive) {
                         $toEnable[] = $moduleName;
                     }
                 }
                 // Enable modules
                 array_walk($toEnable, array('static', 'enableModule'));
                 $date = \DateTime::createFromFormat(static::RESTORE_DATE_FORMAT, $restorePoint["date"]);
                 \Includes\Decorator\Utils\PersistentInfo::set('restoredTo', $date->getTimestamp());
                 $restorationRecord = static::getRestorationRecord($restorePoint["date"]);
                 static::updateModuleMigrationLog($restorationRecord);
             }
         }
         // Disable modules
         array_walk($modules, array('static', 'disableModule'));
         \Includes\SafeMode::cleanupIndicator();
     }
 }