Burthsceh has uploaded a new change for review. https://gerrit.wikimedia.org/r/80778
Change subject: (bug 53304) Add option to disable updating Repo on moving page ...................................................................... (bug 53304) Add option to disable updating Repo on moving page This change needs Change Ie86cdebabfb0036fc7225278c8f92b946eda92ce https://gerrit.wikimedia.org/r/#/c/80764/ Changes: * Add hooks ** \Wikibase\ClientHooks::onSpecialMovepageForm ** \Wikibase\ClientHooks::onAPIGetAllowedParams ** \Wikibase\ClientHooks::onAPIGetParamDescription * modify \Wikibase\ClientHooks::onTitleMoveComplete * add message wikibase-movepage-noupdatelinkitem bug: 53304 Change-Id: Ic4ed23e8d489a70ba9bacfebbc0cfb40c85f7f17 --- M client/WikibaseClient.hooks.php M client/WikibaseClient.i18n.php M client/WikibaseClient.php 3 files changed, 42 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/78/80778/1 diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php index e016971..79666b4 100644 --- a/client/WikibaseClient.hooks.php +++ b/client/WikibaseClient.hooks.php @@ -750,9 +750,15 @@ * @return bool */ public static function onTitleMoveComplete( $oldTitle, $newTitle, $user, $pageId, $redirectId ) { + global $wgRequest; wfProfileIn( __METHOD__ ); if ( Settings::get( 'propagateChangesToRepo' ) !== true ) { + wfProfileOut( __METHOD__ ); + return true; + } + + if ( $wgRequest->getBool( 'noupdatewikibaseitem', false ) ) { wfProfileOut( __METHOD__ ); return true; } @@ -796,4 +802,35 @@ wfProfileOut( __METHOD__ ); return true; } + + public static function onSpecialMovepageForm( \MovePageForm $movePage, &$formrows ) { + $c = $movePage->getRequest()->getBool( 'noupdatewikibaseitem', false ); + $formrows .= "\n<tr>\n<td></td>\n<td class=\"mw-input\">" + . Xml::checkLabel( + $movePage->msg( 'wikibase-movepage-noupdatelinkitem' )->text(), + 'noupdatewikibaseitem', 'noupdatewikibaseitem', $c + ) . "</td>\n</tr>"; + + return true; + } + + public static function onAPIGetAllowedParams( &$module, &$params ) { + if ( ! $module instanceof \ApiMove ) { + return true; + } + + $params['noupdatewikibaseitem'] = false; + + return true; + } + + public static function onAPIGetParamDescription( &$module, &$desc ) { + if ( ! $module instanceof \ApiMove ) { + return true; + } + + $desc['noupdatewikibaseitem'] = 'Do not update the associated Wikidata item'; + + return true; + } } diff --git a/client/WikibaseClient.i18n.php b/client/WikibaseClient.i18n.php index 01db230..ec77c2c 100644 --- a/client/WikibaseClient.i18n.php +++ b/client/WikibaseClient.i18n.php @@ -73,7 +73,8 @@ 'wikibase-unconnectedpages-format-row' => '($1 {{PLURAL:$1|interlanguage link|interlanguage links}} on the page)', 'wikibase-pageinfo-entity-id' => 'Wikidata Item ID', 'wikibase-pageinfo-entity-id-none' => 'None', - 'wikibase-property-render-error' => 'Failed to render property $1: $2' + 'wikibase-property-render-error' => 'Failed to render property $1: $2', + 'wikibase-movepage-noupdatelinkitem' => 'Do not update the associated Wikidata item', ); /** Message documentation (Message documentation) diff --git a/client/WikibaseClient.php b/client/WikibaseClient.php index 7bdaa41..6af4b6a 100644 --- a/client/WikibaseClient.php +++ b/client/WikibaseClient.php @@ -145,6 +145,9 @@ $wgHooks['SpecialWatchlistFilters'][] = '\Wikibase\ClientHooks::onSpecialWatchlistFilters'; $wgHooks['InfoAction'][] = '\Wikibase\ClientHooks::onInfoAction'; $wgHooks['TitleMoveComplete'][] = '\Wikibase\ClientHooks::onTitleMoveComplete'; + $wgHooks['SpecialMovepageForm'][] = '\Wikibase\ClientHooks::onSpecialMovepageForm'; + $wgHooks['APIGetAllowedParams'][] = '\Wikibase\ClientHooks::onAPIGetAllowedParams'; + $wgHooks['APIGetParamDescription'][] = '\Wikibase\ClientHooks::onAPIGetParamDescription'; // extension hooks $wgHooks['WikibaseDeleteData'][] = '\Wikibase\ClientHooks::onWikibaseDeleteData'; -- To view, visit https://gerrit.wikimedia.org/r/80778 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic4ed23e8d489a70ba9bacfebbc0cfb40c85f7f17 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Burthsceh <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
