コード例 #1
0
 /**
  * Save action
  */
 function saveAction()
 {
     if ($this->getRequest()->isPost()) {
         try {
             $data = $this->getRequest()->getPost();
             //                Uni_Core_ModuleManager::runSqlUpgrade('News', 'Fox', 'core');
             //                exit;
             Uni_Core_ModuleManager::installModules();
             Uni_Core_ModuleManager::updateModuleStatus($data);
             Uni_Core_Preferences::loadPreferences(TRUE);
             Uni_Core_CacheManager::clearLayoutCache();
             Uni_Core_CacheManager::clearModuleCache();
             Fox::getHelper('core/message')->setInfo('Modules successfully saved.');
         } catch (Exception $e) {
             Fox::getHelper('core/message')->setError($e->getMessage());
         }
     }
     $this->sendRedirect('*/*/');
 }
コード例 #2
0
 /**
  * Update modules status
  * 
  * @param array $modules module data
  */
 public function updateModulesStatus($modules)
 {
     Uni_Core_ModuleManager::updateModuleStatus($modules);
 }
コード例 #3
0
 /**
  * Run installer
  */
 public static function runInstaller()
 {
     $data = Fox::getModel('installer/session')->getConfiguration();
     self::saveSystemConfig($data);
     Uni_Core_ModuleManager::installModules(TRUE);
     $model = Fox::getModel('core/preference');
     $model->setName('web/design/package');
     $model->setValue('core');
     $model->save();
     $model->unsetData();
     $model->setName('web/design/theme');
     $model->setValue('default');
     $model->save();
     $model->unsetData();
     $model->setName('web/unsecure/base_url');
     $model->setValue($data['site_base_url']);
     $model->save();
     $model->unsetData();
     $model->setName('web/secure/base_url');
     $model->setValue($data['site_secure_base_url']);
     $model->save();
     $model->unsetData();
     $model->setName('web/secure/use_in_frontend');
     $model->setValue(isset($data['site_secure_url_in_frontend']) ? $data['site_secure_url_in_frontend'] : 0);
     $model->save();
     $model->unsetData();
     $model->setName('web/secure/use_in_admin');
     $model->setValue(isset($data['site_secure_url_in_admin']) ? $data['site_secure_url_in_admin'] : 0);
     $model->save();
     $model->unsetData();
     $model->setName('admin/url/key');
     $adminPath = preg_replace('/\\s+/', ' ', $data['admin_path']);
     $adminPath = str_replace(' ', '_', $adminPath);
     $model->setValue($adminPath);
     $model->save();
     $model->unsetData();
     $model->setName('core/session/storage_type');
     $model->setValue($data['session_storage']);
     $model->save();
     $model->unsetData();
     $model->setName('general/website/name');
     $model->setValue('Zendfox');
     $model->save();
     $model->unsetData();
     $model->setName('website_email_addresses/general/sender_name');
     $model->setValue('Owner');
     $model->save();
     $model->unsetData();
     $model->setName('website_email_addresses/general/sender_email');
     $model->setValue('*****@*****.**');
     $model->save();
     $model->unsetData();
     $model->setName('website_email_addresses/custom1/sender_name');
     $model->setValue('Custom 1');
     $model->save();
     $model->unsetData();
     $model->setName('website_email_addresses/custom1/sender_email');
     $model->setValue('*****@*****.**');
     $model->save();
     $model->unsetData();
     $model->setName('website_email_addresses/custom2/sender_name');
     $model->setValue('Custom 2');
     $model->save();
     $model->unsetData();
     $model->setName('website_email_addresses/custom2/sender_email');
     $model->setValue('*****@*****.**');
     $model->save();
     $model->unsetData();
     $model->setName('contact/reply/name');
     $model->setValue('Support');
     $model->save();
     $model->unsetData();
     $model->setName('contact/reply/email');
     $model->setValue('*****@*****.**');
     $model->save();
     $model->unsetData();
     $model->setName('contact/receiver/email');
     $model->setValue('*****@*****.**');
     $model->save();
     $model->unsetData();
 }
コード例 #4
0
 /**
  * Install modules
  * 
  * @param boolean $isInstaller 
  */
 public static function installModules($isInstaller = FALSE)
 {
     self::$sqlSetup = new Uni_Core_Setup_Sql();
     self::$installedModules = array();
     self::$activeModules = self::getActiveModules();
     if (!$isInstaller) {
         $moduleModel = Fox::getModel('core/module');
         $collection = $moduleModel->getInstalledModules();
         foreach ($collection as $module) {
             self::$installedModules[] = $module['name'];
         }
     }
     $modulesArr = array_diff(array_keys(self::$activeModules), self::$installedModules);
     foreach ($modulesArr as $mdl) {
         self::$initialModules[$mdl] = $mdl;
     }
     while (count(self::$initialModules) > 0) {
         foreach (self::$initialModules as $moduleEle) {
             break;
         }
         $depQueue = array($moduleEle);
         while (count($depQueue) > 0) {
             $dependents = self::getDependents($depQueue[count($depQueue) - 1]);
             $ready = FALSE;
             if (empty($dependents)) {
                 $ready = TRUE;
             } else {
                 $depUninstCount = 0;
                 foreach ($dependents as $dependent) {
                     if (!self::isInstalled($dependent)) {
                         $depUninstCount++;
                         if (in_array($dependent, $depQueue)) {
                             throw new Exception('Circular module dependency detected in "' . $dependent . '"');
                         } else {
                             $depQueue[] = $dependent;
                             break;
                         }
                     }
                 }
                 if ($depUninstCount == 0) {
                     $ready = TRUE;
                 }
             }
             if ($ready) {
                 $cModule = array_pop($depQueue);
                 self::installModule($cModule);
             }
         }
     }
     foreach (self::$activeModules as $moduleName => $moduleArr) {
         self::runSqlUpgrade($moduleName, $moduleArr['namespace'], $moduleArr['package']);
     }
 }