r77725 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77724‎ | r77725 | r77726 >
Date:16:10, 4 December 2010
Author:vyznev
Status:ok (Comments)
Tags:
Comment:
Partial workaround for bug 6220: at least make files on shared repositories show up as (struck-out) bluelinks instead of redlinks on Special:WantedFiles. Also change the query slightly to join on the image table instead of page, since that would seem to make more sense.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/QueryPage.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialWantedfiles.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialWantedfiles.php
@@ -35,9 +35,19 @@
3636 return 'Wantedfiles';
3737 }
3838
 39+ /**
 40+ * KLUGE: The results may contain false positives for files
 41+ * that exist e.g. in a shared repo. Setting this at least
 42+ * keeps them from showing up as redlinks in the output, even
 43+ * if it doesn't fix the real problem (bug 6220).
 44+ */
 45+ function forceExistenceCheck() {
 46+ return true;
 47+ }
 48+
3949 function getSQL() {
4050 $dbr = wfGetDB( DB_SLAVE );
41 - list( $imagelinks, $page ) = $dbr->tableNamesN( 'imagelinks', 'page' );
 51+ list( $imagelinks, $image ) = $dbr->tableNamesN( 'imagelinks', 'image' );
4252 $name = $dbr->addQuotes( $this->getName() );
4353 return
4454 "
@@ -47,8 +57,8 @@
4858 il_to as title,
4959 COUNT(*) as value
5060 FROM $imagelinks
51 - LEFT JOIN $page ON il_to = page_title AND page_namespace = ". NS_FILE ."
52 - WHERE page_title IS NULL
 61+ LEFT JOIN $image ON il_to = img_name
 62+ WHERE img_name IS NULL
5363 GROUP BY il_to
5464 ";
5565 }
Index: trunk/phase3/includes/QueryPage.php
@@ -581,6 +581,17 @@
582582 }
583583
584584 /**
 585+ * Should formatResult() always check page existence, even if
 586+ * the results are fresh? This is a (hopefully temporary)
 587+ * kluge for Special:WantedFiles, which may contain false
 588+ * positives for files that exist e.g. in a shared repo (bug
 589+ * 6220).
 590+ */
 591+ function forceExistenceCheck() {
 592+ return false;
 593+ }
 594+
 595+ /**
585596 * Format an individual result
586597 *
587598 * @param $skin Skin to use for UI elements
@@ -590,8 +601,8 @@
591602 public function formatResult( $skin, $result ) {
592603 $title = Title::makeTitleSafe( $result->namespace, $result->title );
593604 if( $title instanceof Title ) {
594 - if( $this->isCached() ) {
595 - $pageLink = $title->exists()
 605+ if( $this->isCached() || $this->forceExistenceCheck() ) {
 606+ $pageLink = $title->isKnown()
596607 ? '<del>' . $skin->link( $title ) . '</del>'
597608 : $skin->link(
598609 $title,
Index: trunk/phase3/RELEASE-NOTES
@@ -447,6 +447,8 @@
448448 * (bug 26160) Upload description set by extensions are not propagated
449449 * (bug 9675) generateSitemap.php now takes an --urlpath parameter to allow
450450 absolute URLs in the sitemap index (as required e.g. by Google)
 451+* Partial workaround for bug 6220: at least make files on shared repositories
 452+ show up as (struck-out) bluelinks instead of redlinks on Special:WantedFiles
451453
452454 === API changes in 1.17 ===
453455 * (bug 22738) Allow filtering by action type on query=logevent.

Comments

#Comment by 😂 (talk | contribs)   19:14, 4 December 2010

If I saw this without reading the RELEASE-NOTES, it wouldn't make any sense to me. A strikethrough doesn't imply "this is elsewhere," it implies "this has been removed." Those who care about semantic markup would probably say you're abusing the

<del>

.

#Comment by Krinkle (talk | contribs)   00:44, 5 December 2010

This is the way all special pages work. For example WantedTemplates show redlinks for those still unexisting since the query was cached, striked blue links are those who have come into existance since then.

WantedFiles show redlinks for links to files that are missing, and blue striked links for links to files that were missing but since the query was ran have come into existance.

I agree that a del-tag is not suited for this, but it wasn't implemented in this commit.

#Comment by 😂 (talk | contribs)   00:47, 5 December 2010

Fair enough, if it's at least consistent.

Just seems unintuitive :)

#Comment by Krinkle (talk | contribs)   16:22, 31 January 2011

From an IRC convo earlier I just wanted to state here that is being used to indicate that a 'to do' item is "Done".

So the desired action is no longer required or it's already been executed: The template/file/page has been created or the links to it removed.

Status & tagging log