From e517e9be57c455d7ab983d2c01fc9ea9df57cf58 Mon Sep 17 00:00:00 2001 From: kaldari Date: Tue, 16 Jul 2013 17:14:31 -0700 Subject: [PATCH] Removing all disambiguation code from core Disambiguation related functions have been re-implemented in the Disambiguator extension. Bug: 35981 Change-Id: I4afa30bf2677c6541ef355013f8eaef46abfbe03 Dependency: I41637ea43a9e5000bcb8a782441ce36f1068881f --- RELEASE-NOTES-1.22 | 4 + includes/AutoLoader.php | 1 - includes/QueryPage.php | 1 - includes/SpecialPageFactory.php | 1 - includes/specials/SpecialDisambiguations.php | 173 ------------------ languages/messages/MessagesEn.php | 10 +- maintenance/dictionary/mediawiki.dic | 1 - maintenance/language/messages.inc | 9 +- .../preprocess/All_system_messages.expected | 21 --- .../parser/preprocess/All_system_messages.txt | 21 --- 10 files changed, 6 insertions(+), 236 deletions(-) delete mode 100644 includes/specials/SpecialDisambiguations.php diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index 44b0faedca..8cdb985225 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -437,6 +437,10 @@ changes to languages because of Bugzilla reports. using properties in the SpecialPrefixindex class. * (bug 50310) BREAKING CHANGE: wikibits: Drop support for mwCustomEditButtons. It defaults to an empty array and emits mw.log.warn when accessed. +* BREAKING CHANGE: Special:Disambiguations has been removed from MediaWiki core. + Functions related to disambiguation pages are now handled by the Disambiguator + extension (https://www.mediawiki.org/wiki/Extension:Disambiguator) (bug + 35981). == Compatibility == diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 677bed3f31..604add33d8 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -920,7 +920,6 @@ $wgAutoloadLocalClasses = array( 'DeadendPagesPage' => 'includes/specials/SpecialDeadendpages.php', 'DeletedContribsPager' => 'includes/specials/SpecialDeletedContributions.php', 'DeletedContributionsPage' => 'includes/specials/SpecialDeletedContributions.php', - 'DisambiguationsPage' => 'includes/specials/SpecialDisambiguations.php', 'DoubleRedirectsPage' => 'includes/specials/SpecialDoubleRedirects.php', 'EditWatchlistCheckboxSeriesField' => 'includes/specials/SpecialEditWatchlist.php', 'EditWatchlistNormalHTMLForm' => 'includes/specials/SpecialEditWatchlist.php', diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 699c843c49..51b5706f10 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -35,7 +35,6 @@ $wgQueryPages = array( array( 'AncientPagesPage', 'Ancientpages' ), array( 'BrokenRedirectsPage', 'BrokenRedirects' ), array( 'DeadendPagesPage', 'Deadendpages' ), - array( 'DisambiguationsPage', 'Disambiguations' ), array( 'DoubleRedirectsPage', 'DoubleRedirects' ), array( 'FileDuplicateSearchPage', 'FileDuplicateSearch' ), array( 'LinkSearchPage', 'LinkSearch' ), diff --git a/includes/SpecialPageFactory.php b/includes/SpecialPageFactory.php index a412fdb8dd..c03f1ba5db 100644 --- a/includes/SpecialPageFactory.php +++ b/includes/SpecialPageFactory.php @@ -78,7 +78,6 @@ class SpecialPageFactory { 'Allpages' => 'SpecialAllpages', 'Prefixindex' => 'SpecialPrefixindex', 'Categories' => 'SpecialCategories', - 'Disambiguations' => 'DisambiguationsPage', 'Listredirects' => 'ListredirectsPage', 'PagesWithProp' => 'SpecialPagesWithProp', diff --git a/includes/specials/SpecialDisambiguations.php b/includes/specials/SpecialDisambiguations.php deleted file mode 100644 index ceecd15b97..0000000000 --- a/includes/specials/SpecialDisambiguations.php +++ /dev/null @@ -1,173 +0,0 @@ -msg( 'disambiguations-text' )->parseAsBlock(); - } - - /** - * @return string|bool False on failure - */ - function getQueryFromLinkBatch() { - $dbr = wfGetDB( DB_SLAVE ); - $dMsgText = $this->msg( 'disambiguationspage' )->inContentLanguage()->text(); - $linkBatch = new LinkBatch; - - # If the text can be treated as a title, use it verbatim. - # Otherwise, pull the titles from the links table - $dp = Title::newFromText( $dMsgText ); - if ( $dp ) { - if ( $dp->getNamespace() != NS_TEMPLATE ) { - # @todo FIXME: We assume the disambiguation message is a template but - # the page can potentially be from another namespace :/ - wfDebug( "Mediawiki:disambiguationspage message does not refer to a template!\n" ); - } - $linkBatch->addObj( $dp ); - } else { - # Get all the templates linked from the Mediawiki:Disambiguationspage - $disPageObj = Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage' ); - $res = $dbr->select( - array( 'pagelinks', 'page' ), - 'pl_title', - array( - 'page_id = pl_from', - 'pl_namespace' => NS_TEMPLATE, - 'page_namespace' => $disPageObj->getNamespace(), - 'page_title' => $disPageObj->getDBkey() - ), - __METHOD__ - ); - - foreach ( $res as $row ) { - $linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title ) ); - } - } - $set = $linkBatch->constructSet( 'tl', $dbr ); - - if ( $set === false ) { - # We must always return a valid SQL query, but this way - # the DB will always quickly return an empty result - $set = 'FALSE'; - wfDebug( "Mediawiki:disambiguationspage message does not link to any templates!\n" ); - } - - return $set; - } - - function getQueryInfo() { - // @todo FIXME: What are pagelinks and p2 doing here? - return array( - 'tables' => array( - 'templatelinks', - 'p1' => 'page', - 'pagelinks', - 'p2' => 'page' - ), - 'fields' => array( - 'namespace' => 'p1.page_namespace', - 'title' => 'p1.page_title', - 'value' => 'pl_from' - ), - 'conds' => array( - $this->getQueryFromLinkBatch(), - 'p1.page_id = tl_from', - 'pl_namespace = p1.page_namespace', - 'pl_title = p1.page_title', - 'p2.page_id = pl_from', - 'p2.page_namespace' => MWNamespace::getContentNamespaces() - ) - ); - } - - function getOrderFields() { - return array( 'tl_namespace', 'tl_title', 'value' ); - } - - function sortDescending() { - return false; - } - - /** - * Fetch links and cache their existence - * - * @param DatabaseBase $db - * @param ResultWrapper $res - */ - function preprocessResults( $db, $res ) { - if ( !$res->numRows() ) { - return; - } - - $batch = new LinkBatch; - foreach ( $res as $row ) { - $batch->add( $row->namespace, $row->title ); - } - $batch->execute(); - - $res->seek( 0 ); - } - - /** - * @param Skin $skin - * @param object $result Result row - * @return string - */ - function formatResult( $skin, $result ) { - $title = Title::newFromID( $result->value ); - $dp = Title::makeTitle( $result->namespace, $result->title ); - - $from = Linker::link( $title ); - $edit = Linker::link( - $title, - $this->msg( 'parentheses', $this->msg( 'editlink' )->text() )->escaped(), - array(), - array( 'redirect' => 'no', 'action' => 'edit' ) - ); - $arr = $this->getLanguage()->getArrow(); - $to = Linker::link( $dp ); - - return "$from $edit $arr $to"; - } - - protected function getGroupName() { - return 'pages'; - } -} diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index dc08e0fe41..b0477830ab 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -403,7 +403,6 @@ $specialPageAliases = array( 'CreateAccount' => array( 'CreateAccount' ), 'Deadendpages' => array( 'DeadendPages' ), 'DeletedContributions' => array( 'DeletedContributions' ), - 'Disambiguations' => array( 'Disambiguations' ), 'DoubleRedirects' => array( 'DoubleRedirects' ), 'EditWatchlist' => array( 'EditWatchlist' ), 'Emailuser' => array( 'EmailUser' ), @@ -904,7 +903,7 @@ $1', 'pool-queuefull' => 'Pool queue is full', 'pool-errorunknown' => 'Unknown error', -# All link text and link target definitions of links into project namespace that get used by other message strings, with the exception of user group pages (see grouppage) and the disambiguation template definition (see disambiguations). +# All link text and link target definitions of links into project namespace that get used by other message strings, with the exception of user group pages (see grouppage). 'aboutsite' => 'About {{SITENAME}}', 'aboutpage' => 'Project:About', 'copyright' => 'Content is available under $1.', @@ -2662,13 +2661,6 @@ Remember to check for other links to the templates before deleting them.', 'statistics-mostpopular' => 'Most viewed pages', 'statistics-footer' => '', # do not translate or duplicate this message to other languages -'disambiguations' => 'Pages linking to disambiguation pages', -'disambiguations-summary' => '', # do not translate or duplicate this message to other languages -'disambiguationspage' => 'Template:disambig', -'disambiguations-text' => "The following pages contain at least one link to a '''disambiguation page'''. -They may have to link to a more appropriate page instead.
-A page is treated as a disambiguation page if it uses a template that is linked from [[MediaWiki:Disambiguationspage]].", - 'pageswithprop' => 'Pages with a page property', 'pageswithprop-summary' => '', # do not translate or duplicate this message to other languages 'pageswithprop-legend' => 'Pages with a page property', diff --git a/maintenance/dictionary/mediawiki.dic b/maintenance/dictionary/mediawiki.dic index b86d2c52ee..0c1ace195a 100644 --- a/maintenance/dictionary/mediawiki.dic +++ b/maintenance/dictionary/mediawiki.dic @@ -74,7 +74,6 @@ Delete Deletedrevs Denied Dfile -Disambiguations Double Duplicate EAGAIN diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index f23f08c1d8..b2db694d07 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1726,12 +1726,6 @@ $wgMessageStructure = array( 'statistics-mostpopular', 'statistics-footer', ), - 'disambiguations' => array( - 'disambiguations', - 'disambiguations-summary', - 'disambiguationspage', - 'disambiguations-text', - ), 'pageswithprop' => array( 'pageswithprop', 'pageswithprop-summary', @@ -4004,7 +3998,7 @@ future releases. Also note that since each list value is wrapped in a unique 'cologneblue' => 'Cologne Blue skin', 'vector' => 'Vector skin', 'miscellaneous2' => '', - 'links' => 'All link text and link target definitions of links into project namespace that get used by other message strings, with the exception of user group pages (see grouppage) and the disambiguation template definition (see disambiguations).', + 'links' => 'All link text and link target definitions of links into project namespace that get used by other message strings, with the exception of user group pages (see grouppage).', 'badaccess' => '', 'versionrequired' => '', 'miscellaneous3' => '', @@ -4068,7 +4062,6 @@ future releases. Also note that since each list value is wrapped in a unique 'randomincategory' => 'Random page in category', 'randomredirect' => 'Random redirect', 'statistics' => 'Statistics', - 'disambiguations' => '', 'pageswithprop' => '', 'doubleredirects' => '', 'brokenredirects' => '', diff --git a/tests/parser/preprocess/All_system_messages.expected b/tests/parser/preprocess/All_system_messages.expected index 897c5fb00c..078d8f0d01 100644 --- a/tests/parser/preprocess/All_system_messages.expected +++ b/tests/parser/preprocess/All_system_messages.expected @@ -1239,27 +1239,6 @@ diff </td><td> </td></tr><tr><td> -[http://tl.wiktionary.org/w/wiki.phtml?title=MediaWiki:Disambiguations&action=edit disambiguations]<br> -[[MediaWiki_talk:Disambiguations|Talk]] -</td><td> -Disambiguation pages -</td><td> - -</td></tr><tr><td> -[http://tl.wiktionary.org/w/wiki.phtml?title=MediaWiki:Disambiguationspage&action=edit disambiguationspage]<br> -[[MediaWiki_talk:Disambiguationspage|Talk]] -</td><td> -Wiktionary:Links_to_disambiguating_pages -</td><td> - -</td></tr><tr><td> -[http://tl.wiktionary.org/w/wiki.phtml?title=MediaWiki:Disambiguationstext&action=edit disambiguationstext]<br> -[[MediaWiki_talk:Disambiguationstext|Talk]] -</td><td> -The following pages link to a &lt;i&gt;disambiguation page&lt;/i&gt;. They should link to the appropriate topic instead.&lt;br /&gt;A page is treated as dismbiguation if it is linked from $1.&lt;br /&gt;Links from other namespaces are &lt;i&gt;not&lt;/i&gt; listed here. -</td><td> - -</td></tr><tr><td> [http://tl.wiktionary.org/w/wiki.phtml?title=MediaWiki:Disclaimerpage&action=edit disclaimerpage]<br> [[MediaWiki_talk:Disclaimerpage|Talk]] </td><td> diff --git a/tests/parser/preprocess/All_system_messages.txt b/tests/parser/preprocess/All_system_messages.txt index fc10d7cfa4..3c30da94eb 100644 --- a/tests/parser/preprocess/All_system_messages.txt +++ b/tests/parser/preprocess/All_system_messages.txt @@ -1239,27 +1239,6 @@ diff {{int:Difference}} -[http://tl.wiktionary.org/w/wiki.phtml?title=MediaWiki:Disambiguations&action=edit disambiguations]
-[[MediaWiki_talk:Disambiguations|Talk]] - -Disambiguation pages - -{{int:Disambiguations}} - -[http://tl.wiktionary.org/w/wiki.phtml?title=MediaWiki:Disambiguationspage&action=edit disambiguationspage]
-[[MediaWiki_talk:Disambiguationspage|Talk]] - -Wiktionary:Links_to_disambiguating_pages - -{{int:Disambiguationspage}} - -[http://tl.wiktionary.org/w/wiki.phtml?title=MediaWiki:Disambiguationstext&action=edit disambiguationstext]
-[[MediaWiki_talk:Disambiguationstext|Talk]] - -The following pages link to a <i>disambiguation page</i>. They should link to the appropriate topic instead.<br />A page is treated as dismbiguation if it is linked from $1.<br />Links from other namespaces are <i>not</i> listed here. - -{{int:Disambiguationstext}} - [http://tl.wiktionary.org/w/wiki.phtml?title=MediaWiki:Disclaimerpage&action=edit disclaimerpage]
[[MediaWiki_talk:Disclaimerpage|Talk]] -- 2.20.1