本文整理汇总了PHP中DevblocksPlatform::update方法的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform::update方法的具体用法?PHP DevblocksPlatform::update怎么用?PHP DevblocksPlatform::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevblocksPlatform
的用法示例。
在下文中一共展示了DevblocksPlatform::update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: catch
$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':
示例2: update
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;
}