本文整理汇总了PHP中DatabaseUpdater类的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseUpdater类的具体用法?PHP DatabaseUpdater怎么用?PHP DatabaseUpdater使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DatabaseUpdater类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSchemaUpdate
/**
* Schema update to set up the needed database tables.
*
* @since 0.1
*
* @param DatabaseUpdater $updater
*
* @return true
*/
public static function onSchemaUpdate(DatabaseUpdater $updater)
{
global $wgDBtype;
$updater->addExtensionUpdate(array('addTable', 'surveys', dirname(__FILE__) . '/sql/Survey.sql', true));
$updater->addExtensionUpdate(array('addIndex', 'surveys', 'surveys_survey_title', dirname(__FILE__) . '/sql/AddMissingIndexes.sql', true));
return true;
}
示例2: SemanticMailMerge_SchemaUpdates
function SemanticMailMerge_SchemaUpdates(DatabaseUpdater $updater)
{
$sqldir = __DIR__ . '/maintenance/';
$updater->addExtensionTable('smw_mailmerge', $sqldir . 'table.sql');
$updater->addExtensionIndex('smw_mailmerge', 'title', $sqldir . 'index.sql');
return true;
}
示例3: onSchemaUpdate
/**
* Schema update to set up the needed database tables.
* @see https://www.mediawiki.org/wiki/Manual:Hooks/LoadExtensionSchemaUpdates
*
* @since 0.1
*
* @param DatabaseUpdater $updater
*
* @return true
*/
public static function onSchemaUpdate(DatabaseUpdater $updater)
{
$updater->addExtensionUpdate(array('addTable', 'contests', dirname(__FILE__) . '/Contest.sql', true));
$updater->addExtensionUpdate(array('addField', 'contests', 'contest_signup_email', dirname(__FILE__) . '/sql/AddContestEmailFields.sql', true));
$updater->addExtensionUpdate(array('applyPatch', dirname(__FILE__) . '/sql/UpdateContestantRatingField.sql', true));
return true;
}
示例4: onLoadExtensionSchemaUpdates
public static function onLoadExtensionSchemaUpdates(DatabaseUpdater $updater = null)
{
$dbDir = __DIR__ . '/db';
$updater->addExtensionUpdate(array('addtable', 'page_assessments', "{$dbDir}/addReviewsTable.sql", true));
$updater->addExtensionUpdate(array('addtable', 'page_assessments_log', "{$dbDir}/addLoggingTable.sql", true));
return true;
}
示例5: onLoadExtensionSchemaUpdates
/**
* LoadExtensionSchemaUpdates hook handler
* @see https://www.mediawiki.org/wiki/Manual:Hooks/LoadExtensionSchemaUpdates
* @param DatabaseUpdater $updater
*/
public static function onLoadExtensionSchemaUpdates(DatabaseUpdater $updater)
{
if ($updater->getDB()->getType() != 'mysql') {
throw new MWException('GeoData extension currently supports only MySQL');
}
$updater->addExtensionTable('geo_tags', dirname(__FILE__) . '/GeoData.sql');
return true;
}
示例6: SetupSchema
public static function SetupSchema( DatabaseUpdater $du ) {
$base = dirname( __FILE__ ) . '/schema';
$du->addExtensionTable( "ratings", "$base/ratings.sql");
$du->addExtensionTable( "project_stats", "$base/project_stats.sql" );
$du->addExtensionTable( "assessment_changelog", "$base/log.sql" );
$du->addExtensionTable( "selections", "$base/selections.sql" );
return true;
}
示例7: onSchemaUpdate
/**
* Schema update to set up the needed database tables.
*
* @since 0.1
*
* @param DatabaseUpdater $updater
*
* @return true
*/
public static function onSchemaUpdate($updater = null)
{
global $wgDBtype;
if ($wgDBtype == 'mysql') {
$updater->addExtensionUpdate(array('addTable', 'article_protection', dirname(__FILE__) . '/ArticleProtection.sql', true));
}
return true;
}
示例8: onSchemaUpdate
/**
* Schema update to set up the needed database tables.
* @see https://www.mediawiki.org/wiki/Manual:Hooks/LoadExtensionSchemaUpdates
*
* @since 0.1
*
* @param DatabaseUpdater $updater
*
* @return true
*/
public static function onSchemaUpdate(DatabaseUpdater $updater)
{
$updater->addExtensionTable('ep_orgs', dirname(__FILE__) . '/sql/EducationProgram.sql');
$updater->addExtensionUpdate(array('addTable', 'ep_oas_per_course', dirname(__FILE__) . '/sql/AddAmbassadorLinks.sql', true));
$updater->addExtensionUpdate(array('addField', 'ep_oas_per_course', 'opc_user_id', dirname(__FILE__) . '/sql/RenameAmbUserField.sql', true));
$updater->addExtensionUpdate(array('addField', 'ep_revisions', 'rev_object_identifier', dirname(__FILE__) . '/sql/AddRevIdentifier.sql', true));
return true;
}
示例9: onSchemaUpdate
/**
* Schema update to set up the needed database tables.
*
* @since 1.2
*
* @param DatabaseUpdater $updater
*
* @return true
*/
public static function onSchemaUpdate($updater = null)
{
$updater->addExtensionTable('uw_campaigns', dirname(__FILE__) . '/UploadWizard.sql');
$updater->addExtensionUpdate(array('addIndex', 'uw_campaigns', 'uw_campaigns_name', dirname(__FILE__) . '/sql/UW_IndexCampaignsName.sql', true));
$updater->addExtensionUpdate(array('addIndex', 'uw_campaign_conf', 'uw_cc_id_property', dirname(__FILE__) . '/sql/UW_IndexConfIdProp.sql', true));
$updater->addExtensionUpdate(array('addIndex', 'uw_campaign_conf', 'uw_cc_property', dirname(__FILE__) . '/sql/UW_IndexConfProp.sql', true));
return true;
}
示例10: describeDBSchema
public static function describeDBSchema(DatabaseUpdater $updater = null)
{
$dir = __DIR__ . '/sql';
// For now, there's just a single SQL file for all DB types.
$updater->addExtensionUpdate(array('addTable', 'approved_pages', "{$dir}/ApprovedRevs.sql", true));
$updater->addExtensionUpdate(array('modifyField', 'approved_pages', 'ap_user_group', "{$dir}/patch-ap_group-length-increase-255.sql", true));
$updater->addExtensionUpdate(array('addIndex', 'approved_pages', 'approved_pages_page_id', "{$dir}/patch-add-indices.sql", true));
return true;
}
示例11: ckSchema
/**
* @param DatabaseUpdater|null $updater
* @return bool
*/
public static function ckSchema($updater = null)
{
if ($updater !== null) {
$updater->addExtensionUpdate(array('addtable', 'online_status', dirname(__FILE__) . '/OnlineStatusBar.sql', true));
} else {
global $wgExtNewTables;
$wgExtNewTables[] = array('online_status', dirname(__FILE__) . '/OnlineStatusBar.sql');
}
return true;
}
示例12: onSchemaUpdate
/**
* Schema update to set up the needed database tables.
*
* @since 1.2
*
* @param DatabaseUpdater $updater
*
* @return true
*/
public static function onSchemaUpdate($updater = null)
{
$dbfile = dirname(__FILE__) . '/UploadWizard.' . $updater->getDB()->getType() . '.sql';
if (!file_exists($dbfile)) {
$dbfile = dirname(__FILE__) . '/UploadWizard.sql';
}
$updater->addExtensionTable('uw_campaigns', $dbfile);
$updater->addExtensionUpdate(array('addIndex', 'uw_campaigns', 'uw_campaigns_name', dirname(__FILE__) . '/sql/UW_IndexCampaignsName.sql', true));
$updater->addExtensionUpdate(array('addIndex', 'uw_campaigns', 'uw_campaigns_enabled', dirname(__FILE__) . '/sql/UW_IndexCampaignsEnabled.sql', true));
return true;
}
示例13: onSchemaUpdate
/**
* Schema update to set up the needed database tables.
*
* @since 0.1
*
* @param DatabaseUpdater $updater
*
* @return true
*/
public static function onSchemaUpdate($updater = null)
{
global $wgDBtype;
if ($wgDBtype == 'mysql') {
// Set up the current schema.
if ($updater === null) {
global $wgExtNewTables, $wgExtNewIndexes, $wgExtNewFields;
$wgExtNewTables[] = array('votes', dirname(__FILE__) . '/Ratings.sql', true);
$wgExtNewTables[] = array('votes_props', dirname(__FILE__) . '/Ratings.sql', true);
} else {
$updater->addExtensionUpdate(array('addTable', 'votes', dirname(__FILE__) . '/Ratings.sql', true));
$updater->addExtensionUpdate(array('addTable', 'votes_props', dirname(__FILE__) . '/Ratings.sql', true));
}
}
return true;
}
示例14: onLoadExtensionSchemaUpdates
public static function onLoadExtensionSchemaUpdates(DatabaseUpdater $updater)
{
$tables = array('wp_plan', 'wp_subscription', 'wp_old_usage', 'wp_wikiplace', 'wp_page', 'wp_old_subscription', 'wp_invitation', 'wp_invitation_category', 'wp_wpi_wpp', 'wp_member');
$mysql_dir = dirname(__FILE__) . '/schema/mysql';
foreach ($tables as $table) {
$updater->addExtensionUpdate(array('addTable', $table, "{$mysql_dir}/{$table}.sql", true));
}
$db = wfGetDB(DB_MASTER);
if ($db->tableExists('wp_subscription') && !$db->fieldExists('wp_subscription', 'wps_wpi_id', __METHOD__)) {
$db->sourceFile("{$mysql_dir}/add_wps_wpi_field.sql");
}
if ($db->tableExists('wp_old_subscription') && !$db->fieldExists('wp_old_subscription', 'wpos_wpi_id', __METHOD__)) {
$db->sourceFile("{$mysql_dir}/add_wpos_wpi_field.sql");
}
return true;
}
示例15: execute
function execute()
{
global $wgVersion, $wgTitle, $wgLang;
$wgLang = Language::factory('en');
$wgTitle = Title::newFromText("MediaWiki database updater");
$this->output("MediaWiki {$wgVersion} Updater\n\n");
if (!$this->hasOption('skip-compat-checks')) {
$this->compatChecks();
} else {
$this->output("Skipping compatibility checks, proceed at your own risk (Ctrl+C to abort)\n");
wfCountdown(5);
}
# Attempt to connect to the database as a privileged user
# This will vomit up an error if there are permissions problems
$db = wfGetDB(DB_MASTER);
$this->output("Going to run database updates for " . wfWikiID() . "\n");
$this->output("Depending on the size of your database this may take a while!\n");
if (!$this->hasOption('quick')) {
$this->output("Abort with control-c in the next five seconds (skip this countdown with --quick) ... ");
wfCountDown(5);
}
$shared = $this->hasOption('doshared');
$updates = array('core', 'extensions');
if (!$this->hasOption('nopurge')) {
$updates[] = 'purge';
}
$updater = DatabaseUpdater::newForDb($db, $shared, $this);
$updater->doUpdates($updates);
foreach ($updater->getPostDatabaseUpdateMaintenance() as $maint) {
$child = $this->runChild($maint);
$child->execute();
}
$this->output("\nDone.\n");
}