jenkins-bot has submitted this change and it was merged. Change subject: Use MovePageIsValidMove hook if possible ......................................................................
Use MovePageIsValidMove hook if possible Change-Id: Ic5026384b92a0d68d628397ffe1de6e5b6183f02 --- M JsonConfig.php M includes/JCSingleton.php 2 files changed, 17 insertions(+), 4 deletions(-) Approvals: Aaron Schulz: Looks good to me, approved jenkins-bot: Verified diff --git a/JsonConfig.php b/JsonConfig.php index 9525934..b6f1974 100644 --- a/JsonConfig.php +++ b/JsonConfig.php @@ -128,6 +128,7 @@ 'CodeEditorGetPageLanguage', 'EditFilterMergedContent', 'BeforePageDisplay', + 'MovePageIsValidMove', 'AbortMove', 'ArticleDeleteComplete', 'ArticleUndelete', diff --git a/includes/JCSingleton.php b/includes/JCSingleton.php index de69b05..07d6042 100644 --- a/includes/JCSingleton.php +++ b/includes/JCSingleton.php @@ -517,19 +517,31 @@ return true; } - public static function onAbortMove( /** @noinspection PhpUnusedParameterInspection */ Title $title, Title $newTitle, $wgUser, &$err, $reason ) { - $conf = self::getMetadata( $title->getTitleValue() ); + public static function onMovePageIsValidMove( Title $oldTitle, Title $newTitle, \Status $status ) { + $conf = self::getMetadata( $oldTitle->getTitleValue() ); if ( $conf ) { $newConf = self::getMetadata( $newTitle->getTitleValue() ); if ( !$newConf ) { // @todo: is parse() the right func to use here? - $err = wfMessage( 'jsonconfig-move-aborted-ns' )->parse(); + $status->fatal( 'jsonconfig-move-aborted-ns' ); return false; } elseif ( $conf->model !== $newConf->model ) { - $err = wfMessage( 'jsonconfig-move-aborted-model', $conf->model, $newConf->model )->parse(); + $status->fatal( 'jsonconfig-move-aborted-model', $conf->model, $newConf->model ); return false; } } + + return true; + } + + public static function onAbortMove( /** @noinspection PhpUnusedParameterInspection */ Title $title, Title $newTitle, $wgUser, &$err, $reason ) { + $status = new \Status(); + self::onMovePageIsValidMove( $title, $newTitle, $status ); + if ( !$status->isOK() ) { + $err = $status->getHTML(); + return false; + } + return true; } -- To view, visit https://gerrit.wikimedia.org/r/169034 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic5026384b92a0d68d628397ffe1de6e5b6183f02 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/JsonConfig Gerrit-Branch: master Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits