Example #1
0
 /**
  * Runs patches for all active plugins
  *
  * @return boolean
  */
 static function runPluginPatches()
 {
     // Log out all sessions before patching
     $db = DevblocksPlatform::getDatabaseService();
     $db->Execute(sprintf("DELETE FROM %s_session", APP_DB_PREFIX));
     $patchMgr = DevblocksPlatform::getPatchService();
     //		echo "Patching platform... ";
     // [JAS]: Run our overloaded container for the platform
     $patchMgr->registerPatchContainer(new PlatformPatchContainer());
     // Clean script
     if (!$patchMgr->run()) {
         return false;
     } else {
         // success
         // Read in plugin information from the filesystem to the database
         DevblocksPlatform::readPlugins();
         $plugins = DevblocksPlatform::getPluginRegistry();
         //			DevblocksPlatform::clearCache();
         // Run enabled plugin patches
         $patches = DevblocksPlatform::getExtensions("devblocks.patch.container");
         if (is_array($patches)) {
             foreach ($patches as $patch_manifest) {
                 /* @var $patch_manifest DevblocksExtensionManifest */
                 $container = $patch_manifest->createInstance();
                 /* @var $container DevblocksPatchContainerExtension */
                 if (!is_null($container)) {
                     $patchMgr->registerPatchContainer($container);
                 }
             }
         }
         //			echo "Patching plugins... ";
         if (!$patchMgr->run()) {
             // fail
             return false;
         }
         //			echo "done!<br>";
         $cache = self::getCacheService();
         $cache->save(APP_BUILD, "devblocks_app_build");
         return true;
     }
 }
Example #2
0
 function savePluginsAction()
 {
     $translate = DevblocksPlatform::getTranslationService();
     $worker = CerberusApplication::getActiveWorker();
     if (!$worker || !$worker->is_superuser) {
         echo $translate->_('common.access_denied');
         return;
     }
     if (DEMO_MODE) {
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'plugins')));
         return;
     }
     @($plugins_enabled = DevblocksPlatform::importGPC($_REQUEST['plugins_enabled'], 'array'));
     $pluginStack = DevblocksPlatform::getPluginRegistry();
     if (is_array($plugins_enabled)) {
         foreach ($plugins_enabled as $plugin_id) {
             $plugin = $pluginStack[$plugin_id];
             $plugin->setEnabled(true);
             unset($pluginStack[$plugin_id]);
         }
     }
     // [JAS]: Clear unchecked plugins
     foreach ($pluginStack as $plugin) {
         // [JAS]: We can't force disable core here [TODO] Improve
         if ($plugin->id == 'cerberusweb.core') {
             continue;
         }
         $plugin->setEnabled(false);
     }
     DevblocksPlatform::clearCache();
     // Run any enabled plugin patches
     // [TODO] Should the platform do this automatically on enable in order?
     $patchMgr = DevblocksPlatform::getPatchService();
     $patches = DevblocksPlatform::getExtensions("devblocks.patch.container", false, true);
     if (is_array($patches)) {
         foreach ($patches as $patch_manifest) {
             /* @var $patch_manifest DevblocksExtensionManifest */
             $container = $patch_manifest->createInstance();
             /* @var $container DevblocksPatchContainerExtension */
             $patchMgr->registerPatchContainer($container);
         }
     }
     if (!$patchMgr->run()) {
         // fail
         die("Failed updating plugins.");
         // [TODO] Make this more graceful
     }
     // Reload plugin translations
     DAO_Translation::reloadPluginStrings();
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'plugins')));
 }
Example #3
0
         $tpl->assign('db_name', $db_name);
         $tpl->assign('db_user', $db_user);
         $tpl->assign('db_pass', $db_pass);
         $tpl->assign('failed', true);
         $tpl->assign('result', $result);
         $tpl->assign('config_path', realpath(APP_PATH . "/framework.config.php"));
         $tpl->assign('template', 'steps/step_config_file.tpl.php');
     }
     break;
     // Initialize the database
 // Initialize the database
 case STEP_INIT_DB:
     // [TODO] Add current user to patcher/upgrade authorized IPs
     if (CerberusInstaller::isDatabaseEmpty()) {
         // install
         $patchMgr = DevblocksPlatform::getPatchService();
         // [JAS]: Run our overloaded container for the platform
         $patchMgr->registerPatchContainer(new PlatformPatchContainer());
         // Clean script
         if (!$patchMgr->run()) {
             // [TODO] Show more info on the error
             $tpl->assign('template', 'steps/step_init_db.tpl.php');
         } else {
             // success
             // Read in plugin information from the filesystem to the database
             DevblocksPlatform::readPlugins();
             /*
              * [TODO] This possibly needs to only start with core, because as soon 
              * as we add back another feature with licensing we'll have installer 
              * errors trying to license plugins before core runs its DB install.
              */