Mwalker has uploaded a new change for review. https://gerrit.wikimedia.org/r/55695
Change subject: Fixing database patch 2.3 for CentralNotice ...................................................................... Fixing database patch 2.3 for CentralNotice The original patch (https://gerrit.wikimedia.org/r/#/c/52913/) was badly broken and reverted by (https://gerrit.wikimedia.org/r/#/c/55587/) This patch fixes the issues found by Hashar. Change-Id: I2576b0f3230591d84d228c44fee9b4ea0997d566 --- M CentralNotice.php A patches/CNDatabasePatcher.php 2 files changed, 107 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice refs/changes/95/55695/1 diff --git a/CentralNotice.php b/CentralNotice.php index ead11ee..98656c5 100644 --- a/CentralNotice.php +++ b/CentralNotice.php @@ -631,3 +631,5 @@ return true; } + +$wgHooks[ 'LoadExtensionSchemaUpdates' ][ ] = 'CNDatabasePatcher::applyUpdates'; \ No newline at end of file diff --git a/patches/CNDatabasePatcher.php b/patches/CNDatabasePatcher.php new file mode 100644 index 0000000..25a9c88 --- /dev/null +++ b/patches/CNDatabasePatcher.php @@ -0,0 +1,105 @@ +<?php +/** + * @file + * @license GNU General Public Licence 2.0 or later + */ + +/** + * Maintenance helper class that updates the database schema when required. + * + * Apply patches with /maintenance/update.php + */ +class CNDatabasePatcher { + /** + * LoadExtensionSchemaUpdates hook handler + * This function makes sure that the database schema is up to date. + * + * @param $updater DatabaseUpdater|null + * @return bool + */ + public static function applyUpdates( $updater = null ) { + $base = __DIR__; + + if ( $updater->getDB()->getType() == 'mysql' ) { + $updater->addExtensionUpdate( + array( + 'addTable', 'cn_notices', + $base . '/../CentralNotice.sql', true + ) + ); + $updater->addExtensionUpdate( + array( + 'addField', 'cn_notices', 'not_preferred', + $base . '/patch-notice_preferred.sql', true + ) + ); + $updater->addExtensionUpdate( + array( + 'addTable', 'cn_notice_languages', + $base . '/patch-notice_languages.sql', true + ) + ); + $updater->addExtensionUpdate( + array( + 'addField', 'cn_templates', 'tmp_display_anon', + $base . '/patch-template_settings.sql', true + ) + ); + $updater->addExtensionUpdate( + array( + 'addField', 'cn_templates', 'tmp_fundraising', + $base . '/patch-template_fundraising.sql', true + ) + ); + $updater->addExtensionUpdate( + array( + 'addTable', 'cn_notice_countries', + $base . '/patch-notice_countries.sql', true + ) + ); + $updater->addExtensionUpdate( + array( + 'addTable', 'cn_notice_projects', + $base . '/patch-notice_projects.sql', true + ) + ); + $updater->addExtensionUpdate( + array( + 'addTable', 'cn_notice_log', + $base . '/patch-notice_log.sql', true + ) + ); + $updater->addExtensionUpdate( + array( + 'addTable', 'cn_template_log', + $base . '/patch-template_log.sql', true + ) + ); + $updater->addExtensionUpdate( + array( + 'addField', 'cn_templates', 'tmp_autolink', + $base . '/patch-template_autolink.sql', true + ) + ); + $updater->addExtensionUpdate( + array( + 'addField', 'cn_template_log', 'tmplog_begin_prioritylangs', + $base . '/patch-prioritylangs.sql', true + ) + ); + $updater->addExtensionUpdate( + array( + 'addField', 'cn_notices', 'not_buckets', + $base . '/patch-bucketing.sql', true + ) + ); + $updater->addExtensionUpdate( + array( + 'addTable', 'cn_template_mixins', + $base . '/patch-centralnotice-2_3.sql', true + ) + ); + } + return true; + } +} -- To view, visit https://gerrit.wikimedia.org/r/55695 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2576b0f3230591d84d228c44fee9b4ea0997d566 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CentralNotice Gerrit-Branch: master Gerrit-Owner: Mwalker <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
