Kaldari has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/74103


Change subject: Removing dependancy on SpecialDisambiguations since it's being 
axed.
......................................................................

Removing dependancy on SpecialDisambiguations since it's being axed.

This is a quick hack to make sure Special:PagesWithoutScans doesn't
break when https://gerrit.wikimedia.org/r/#/c/74096/ is merged. The
underlying logic of how it finds disambiguation pages should be
updated at some point to use the new 'disambiguations' property.

Bug: 35981
Change-Id: I41637ea43a9e5000bcb8a782441ce36f1068881f
---
M ProofreadPage.i18n.php
M SpecialPagesWithoutScans.php
2 files changed, 58 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage 
refs/changes/03/74103/1

diff --git a/ProofreadPage.i18n.php b/ProofreadPage.i18n.php
index 09c025d..c681813 100644
--- a/ProofreadPage.i18n.php
+++ b/ProofreadPage.i18n.php
@@ -89,6 +89,7 @@
        'proofreadpage-indexoai-eprint-content-text' => 'Metadata of books 
managed by ProofreadPage.',
        'proofreadpage-indexoai-error-schemanotfound' => 'Schema not found',
        'proofreadpage-indexoai-error-schemanotfound-text' => 'The $1 schema 
have not been found.',
+       'proofreadpage-disambiguationspage' => 'Template:disambig',
 );
 
 /** Message documentation (Message documentation)
@@ -174,6 +175,9 @@
        'proofreadpage-indexoai-error-schemanotfound' => 'Title of the error 
when a requested XML Schema does not exist.',
        'proofreadpage-indexoai-error-schemanotfound-text' => 'Text of the 
error when a requested XML schema does not exist. Parameters:
 * $1 is name of the schema.',
+       'proofreadpage-disambiguationspage' => 'This message is the name of the 
template used for marking disambiguation pages. It is used to find all pages 
which link to disambiguation pages.
+
+{{doc-important|Don\'t translate the "Template:" part!}}',
 );
 
 /** Achinese (Acèh)
diff --git a/SpecialPagesWithoutScans.php b/SpecialPagesWithoutScans.php
index 6125628..308ced5 100644
--- a/SpecialPagesWithoutScans.php
+++ b/SpecialPagesWithoutScans.php
@@ -23,13 +23,55 @@
  * Special page that lists the texts that have no transclusions
  * Pages in MediaWiki:Proofreadpage_notnaked_category are excluded.
  */
-class PagesWithoutScans extends DisambiguationsPage {
+class PagesWithoutScans extends QueryPage {
        function __construct( $name = 'PagesWithoutScans' ) {
                parent::__construct( $name );
        }
 
-       function getPageHeader() {
-               return '';
+       function isExpensive() {
+               return true;
+       }
+
+       function isSyndicated() {
+               return false;
+       }
+
+       /**
+        * Return a clause with the list of disambiguation templates.
+        * This function was copied verbatim from 
specials/SpecialDisambiguations.php
+        * @param $dbr DatabaseBase
+        * @return mixed
+        */
+       function disambiguation_templates( $dbr ) {
+               $dMsgText = 
wfMsgForContent('proofreadpage-disambiguationspage');
+
+               $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) {
+                               # FIXME we assume the disambiguation message is 
a template but
+                               # the page can potentially be from another 
namespace :/
+                               
wfDebug("Mediawiki:proofreadpage-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 ));
+                       }
+               }
+               return $linkBatch->constructSet( 'tl', $dbr );
        }
 
        function getQueryInfo() {
@@ -47,13 +89,19 @@
                );
 
                // Exclude disambiguation pages too
+               // FIXME: Update to filter against 'disambiguation' page 
property
+               // instead. See 
https://www.mediawiki.org/wiki/Extension:Disambiguator.
+               // May want to verify that wikis using ProofreadPage have 
implemented
+               // the __DISAMBIG__ magic word for their disambiguation pages 
before
+               // changing this.
+               $dt = $this->disambiguation_templates( $dbr );
                $disambigPagesSubquery = $dbr->selectSQLText(
                        array( 'page', 'templatelinks' ),
                        'page_id',
                        array(
                                'page_id=tl_from',
                                'page_namespace' => NS_MAIN,
-                               $this->getQueryFromLinkBatch(),
+                               $dt
                        )
                );
 
@@ -73,8 +121,8 @@
                );
        }
 
-       function getOrderFields() {
-               return array( 'value' );
+       function sortDescending() {
+               return true;
        }
 
        function formatResult( $skin, $result ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/74103
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I41637ea43a9e5000bcb8a782441ce36f1068881f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ProofreadPage
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to