function showTabPluginsAction() { $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->_TPL_PATH); // Auto synchronize when viewing Config->Extensions DevblocksPlatform::readPlugins(); $plugins = DevblocksPlatform::getPluginRegistry(); unset($plugins['cerberusweb.core']); $tpl->assign('plugins', $plugins); // $points = DevblocksPlatform::getExtensionPoints(); // $tpl->assign('points', $points); $license = CerberusLicense::getInstance(); $tpl->assign('license', $license); $tpl->display('file:' . $this->_TPL_PATH . 'configuration/tabs/plugins/index.tpl'); }
function showTabPluginsAction() { $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->_TPL_PATH); // Auto synchronize when viewing Config->Extensions DevblocksPlatform::readPlugins(); if (DEVELOPMENT_MODE) { DAO_Platform::cleanupPluginTables(); } $plugins = DevblocksPlatform::getPluginRegistry(); unset($plugins['devblocks.core']); unset($plugins['feg.core']); unset($plugins['feg.auditlog']); $tpl->assign('plugins', $plugins); $license = FegLicense::getInstance(); $tpl->assign('license', $license); $tpl->display('file:' . $this->_TPL_PATH . 'setup/tabs/plugins/index.tpl'); }
/** * 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; } }
/** * Checks to see if the application needs to patch * * @return boolean */ static function versionConsistencyCheck() { $cache = DevblocksPlatform::getCacheService(); /* @var _DevblocksCacheManager $cache */ if (null === ($build_cache = $cache->load("devblocks_app_build")) || $build_cache != APP_BUILD) { // If build changed, clear cache regardless of patch status // [TODO] We need to find a nicer way to not clear a shared memcached cluster when only one desk needs to $cache = DevblocksPlatform::getCacheService(); /* @var $cache _DevblocksCacheManager */ $cache->clean(); // Re-read manifests DevblocksPlatform::readPlugins(); if (self::_needsToPatch()) { return false; // the update script will handle new caches } else { $cache->save(APP_BUILD, "devblocks_app_build"); DAO_Translation::reloadPluginStrings(); // reload strings even without DB changes return true; } } return true; }
// 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. */ $plugins = DevblocksPlatform::getPluginRegistry(); // Tailor which plugins are enabled by default if (is_array($plugins)) { foreach ($plugins as $plugin_manifest) { /* @var $plugin_manifest DevblocksPluginManifest */ switch ($plugin_manifest->id) { case "app.core": $plugin_manifest->setEnabled(true); break; default:
static function update() { // Update the platform if (!DevblocksPlatform::update()) { throw new Exception("Couldn't update Devblocks."); } // Read in plugin information from the filesystem to the database DevblocksPlatform::readPlugins(); // Clean up missing plugins DAO_Platform::cleanupPluginTables(); // Registry $plugins = DevblocksPlatform::getPluginRegistry(); // Update the application core (version by version) if (!isset($plugins['feg.core'])) { throw new Exception("Couldn't read application manifest."); } $plugin_patches = array(); // Load patches foreach ($plugins as $p) { /* @var $p DevblocksPluginManifest */ if ('devblocks.core' == $p->id) { continue; } // Don't patch disabled plugins if ($p->enabled) { $plugin_patches[$p->id] = $p->getPatches(); } } $core_patches = $plugin_patches['feg.core']; unset($plugin_patches['feg.core']); /* * For each core release, patch plugins in dependency order */ foreach ($core_patches as $patch) { /* @var $patch DevblocksPatch */ if (!file_exists($patch->getFilename())) { throw new Exception("Missing application patch: " . $path); } $version = $patch->getVersion(); if (!$patch->run()) { throw new Exception("Application patch failed to apply: " . $path); } // Patch this version and then patch plugins up to this version foreach ($plugin_patches as $plugin_id => $patches) { $pass = true; foreach ($patches as $k => $plugin_patch) { // Recursive patch up to _version_ if ($pass && version_compare($plugin_patch->getVersion(), $version, "<=")) { if ($plugin_patch->run()) { unset($plugin_patches[$plugin_id][$k]); } else { $plugins[$plugin_id]->setEnabled(false); $pass = false; } } } } } return TRUE; }