$tpl->assign('db_user', $db_user); $tpl->assign('db_pass', $db_pass); $tpl->assign('failed', true); $tpl->assign('result', $result); $tpl->assign('config_path', APP_PATH . "/framework.config.php"); $tpl->assign('template', 'steps/step_config_file.tpl'); } break; // Initialize the database // Initialize the database case STEP_INIT_DB: // [TODO] Add current user to patcher/upgrade authorized IPs if (DevblocksPlatform::isDatabaseEmpty()) { // install try { DevblocksPlatform::update(); } catch (Exception $e) { $tpl->assign('error', $e->getMessage()); $tpl->assign('template', 'steps/step_init_db.tpl'); } // Read in plugin information from the filesystem to the database DevblocksPlatform::readPlugins(); $plugins = DevblocksPlatform::getPluginRegistry(); // Tailor which plugins are enabled by default if (is_array($plugins)) { foreach ($plugins as $plugin) { /* @var $plugin DevblocksPluginManifest */ switch ($plugin->id) { case 'devblocks.core': case 'feg.core': case 'feg.auditlog':
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; }