Matthias Mullie has uploaded a new change for review. https://gerrit.wikimedia.org/r/81253
Change subject: Run Flow definitions insertion on update.php ...................................................................... Run Flow definitions insertion on update.php When running update.php, the maintenance script will now be run. Upon completion, it'll write an entry to table updatelog, so that a next run of update.php will not execute the maintenance script again. Meanwhile also fixed a small error; $dbw was not tossed in to insertDefinitions Change-Id: I152405d4b67e21cf14d044d8d5a6151505e03b44 --- M Hooks.php M maintenance/FlowInsertDefaultDefinitions.php 2 files changed, 16 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow refs/changes/53/81253/1 diff --git a/Hooks.php b/Hooks.php index ded1608..ab2aed1 100644 --- a/Hooks.php +++ b/Hooks.php @@ -17,6 +17,9 @@ $baseSQLFile = "$dir/flow.sql"; $updater->addExtensionTable( 'flow_revision', $baseSQLFile ); + require_once __DIR__.'/maintenance/FlowInsertDefaultDefinitions.php'; + $updater->addPostDatabaseUpdateMaintenance( 'FlowInsertDefaultDefinitions' ); + return true; } diff --git a/maintenance/FlowInsertDefaultDefinitions.php b/maintenance/FlowInsertDefaultDefinitions.php index f474ea5..5aa1d2e 100644 --- a/maintenance/FlowInsertDefaultDefinitions.php +++ b/maintenance/FlowInsertDefaultDefinitions.php @@ -16,9 +16,9 @@ * * @ingroup Maintenance */ -class FlowInsertDefaultDefinitions extends Maintenance { +class FlowInsertDefaultDefinitions extends LoggedUpdateMaintenance { - public function execute() { + protected function doDBUpdates() { $dbw = MWEchoDbFactory::getDB( DB_MASTER ); $res = $dbw->select( @@ -31,9 +31,10 @@ $res = $res->fetchRow(); } if ( !isset( $res['definition_id'] ) ) { - $this->insertDefinitions(); + $this->insertDefinitions( $dbw ); } + return true; } protected function insertDefinitions( DatabaseBase $dbw ) { @@ -67,6 +68,15 @@ __METHOD__ ); } + + /** + * Get the update key name to go in the update log table + * + * @return string + */ + protected function getUpdateKey() { + return 'FlowInsertDefaultDefinitions'; + } } $maintClass = 'FlowInsertDefaultDefinitions'; // Tells it to run the class -- To view, visit https://gerrit.wikimedia.org/r/81253 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I152405d4b67e21cf14d044d8d5a6151505e03b44 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits