r25768 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25767‎ | r25768 | r25769 >
Date:08:10, 11 September 2007
Author:werdna
Status:old
Tags:
Comment:
* Speed up Special:UncategorizedPages and Special:Deadendpages (no longer marked as slow queries). They now add blank ('','') entries for pages without ANY links or categories. Note that these entries are now what is checked by Special:Uncategorizedpages and Special:Deadendpages. Thus, refreshLinks.php needs to be run before either of these pages will work correctly. An update script will be forthcoming.
* RELEASE-NOTES comments forgotten in a previous commit.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/LinksUpdate.php (modified) (history)
  • /trunk/phase3/includes/SpecialDeadendpages.php (modified) (history)
  • /trunk/phase3/includes/SpecialUncategorizedpages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialDeadendpages.php
@@ -18,13 +18,8 @@
1919 return wfMsgExt( 'deadendpagestext', array( 'parse' ) );
2020 }
2121
22 - /**
23 - * LEFT JOIN is expensive
24 - *
25 - * @return true
26 - */
2722 function isExpensive( ) {
28 - return 1;
 23+ return false;
2924 }
3025
3126 function isSyndicated() { return false; }
@@ -43,10 +38,12 @@
4439 $dbr = wfGetDB( DB_SLAVE );
4540 list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' );
4641 return "SELECT 'Deadendpages' as type, page_namespace AS namespace, page_title as title, page_title AS value " .
47 - "FROM $page LEFT JOIN $pagelinks ON page_id = pl_from " .
48 - "WHERE pl_from IS NULL " .
 42+ "FROM $page,$pagelinks " .
 43+ "WHERE page_id = pl_from " .
4944 "AND page_namespace = 0 " .
50 - "AND page_is_redirect = 0";
 45+ "AND page_is_redirect = 0 " .
 46+ "AND pl_title = '' " .
 47+ "AND pl_namespace = 0";
5148 }
5249 }
5350
Index: trunk/phase3/includes/SpecialUncategorizedpages.php
@@ -20,7 +20,7 @@
2121 }
2222
2323 function isExpensive() {
24 - return true;
 24+ return false;
2525 }
2626 function isSyndicated() { return false; }
2727
@@ -33,12 +33,11 @@
3434 "
3535 SELECT
3636 $name as type,
37 - page_namespace AS namespace,
38 - page_title AS title,
39 - page_title AS value
40 - FROM $page
41 - LEFT JOIN $categorylinks ON page_id=cl_from
42 - WHERE cl_from IS NULL AND page_namespace={$this->requestedNamespace} AND page_is_redirect=0
 37+ page.page_namespace AS namespace,
 38+ page.page_title AS title,
 39+ page.page_title AS value
 40+ FROM $page,$categorylinks
 41+ WHERE page_id=cl_from AND page_namespace={$this->requestedNamespace} AND page_is_redirect=0 AND cl_to=''
4342 ";
4443 }
4544 }
Index: trunk/phase3/includes/LinksUpdate.php
@@ -52,6 +52,10 @@
5353 $this->mExternals = $parserOutput->getExternalLinks();
5454 $this->mCategories = $parserOutput->getCategories();
5555
 56+ # Insert (0,'') entries if there are none of a given type of link (page and category links only)
 57+ $this->mLinks = $this->addNullEntries( $this->mLinks, array( 0 => array( '' => 0 ) ) );
 58+ $this->mCategories = $this->addNullEntries( $this->mCategories );
 59+
5660 # Convert the format of the interlanguage links
5761 # I didn't want to change it in the ParserOutput, because that array is passed all
5862 # the way back to the skin, so either a skin API break would be required, or an
@@ -69,6 +73,21 @@
7074 }
7175
7276 /**
 77+ * Add "no links" entries to the parser-output.
 78+ * @param $links array The links array to add null entries to.
 79+ * @param $replace array What to replace it with if $links is empty.
 80+ * @return array The links array, after being modified.
 81+ */
 82+ function addNullEntries( $links, $replace = array( '' => '' ) )
 83+ {
 84+ if ( count( $links ) == 0 ) {
 85+ $links = $replace;
 86+ }
 87+
 88+ return $links;
 89+ }
 90+
 91+ /**
7392 * Update link tables with outgoing links from an updated article
7493 */
7594 function doUpdate() {
@@ -322,6 +341,7 @@
323342 # array_diff_key() was introduced in PHP 5.1, there is a compatibility function
324343 # in GlobalFunctions.php
325344 $diffs = isset( $existing[$ns] ) ? array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
 345+
326346 foreach ( $diffs as $dbk => $id ) {
327347 $arr[] = array(
328348 'pl_from' => $this->mId,
Index: trunk/phase3/RELEASE-NOTES
@@ -19,6 +19,9 @@
2020 it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
2121
2222 === Configuration changes in 1.12 ===
 23+* The permission key required to edit another user's css/js subpage is now
 24+ editusercssjs, rather than editinterface, as it was previously. This permission
 25+ is assigned by default to the sysop group.
2326
2427 === New features in 1.12 ===
2528 * Add a warning for non-descriptive filenames at Special:Upload
@@ -45,8 +48,10 @@
4649 * (bug 11266) Set fallback language for Fulfulde (ff) to French
4750 * (bug 11179) Include image version deletion comment in public log
4851 * (bug 11158) Fix escaping in API HTML-formatted JSON
 52+* Speed up Special:UncategorizedPages and Special:Deadendpages (no longer marked
 53+ as slow queries). They now add blank ('','') entries for pages without ANY links
 54+ or categories.
4955
50 -
5156 === API changes in 1.12 ===
5257
5358 Full API documentation is available at http://www.mediawiki.org/wiki/API

Follow-up revisions

RevisionCommit summaryAuthorDate
r25778Revert r25768, r25771...brion15:03, 11 September 2007
r25804Merged revisions 25752-25803 via svnmerge from...david02:25, 12 September 2007

Status & tagging log