r22123 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22122‎ | r22123 | r22124 >
Date:17:10, 12 May 2007
Author:aaron
Status:old
Tags:
Comment:
*Add link update hook, loosen specialimport.php restrictions back a little
Modified paths:
  • /branches/phase3_rev_deleted/includes/LinksUpdate.php (modified) (history)
  • /branches/phase3_rev_deleted/includes/SpecialImport.php (modified) (history)

Diff [purge]

Index: branches/phase3_rev_deleted/includes/SpecialImport.php
@@ -328,10 +328,12 @@
329329 } else {
330330 $created = false;
331331
332 - $latest = $dbw->selectField( 'revision', 'MAX(rev_timestamp)',
 332+ $result = $dbw->select( 'revision',
 333+ array('MIN(rev_timestamp) as created', 'MAX(rev_timestamp) as latest'),
333334 array( 'rev_page' => $pageId ), __METHOD__ );
 335+ $row = $dbw->fetchObject($result);
334336 // Don't make fucked up alternating page histories
335 - if( $latest && $latest > $this->timestamp ) {
 337+ if( $row && $row->latest > $this->timestamp && $row->created < $this->timestamp ) {
336338 wfDebug( __METHOD__ . ": skipping existing revision for [[" .
337339 $this->title->getPrefixedText() . "]], timestamp " .
338340 $this->timestamp . "\n" );
@@ -858,13 +860,13 @@
859861 }
860862 }
861863
862 - function newFromURL( $url, $method = 'GET' ) {
 864+ function newFromURL( $url ) {
863865 wfDebug( __METHOD__ . ": opening $url\n" );
864866 # Use the standard HTTP fetch function; it times out
865867 # quicker and sorts out user-agent problems which might
866868 # otherwise prevent importing from large sites, such
867869 # as the Wikimedia cluster, etc.
868 - $data = Http::request( $method, $url );
 870+ $data = Http::get( $url );
869871 if( $data !== false ) {
870872 $file = tmpfile();
871873 fwrite( $file, $data );
@@ -883,8 +885,7 @@
884886 } else {
885887 $params = $history ? 'history=1' : '';
886888 $url = $link->getFullUrl( $params );
887 - # For interwikis, use POST to avoid redirects.
888 - return ImportStreamSource::newFromURL( $url, "POST" );
 889+ return ImportStreamSource::newFromURL( $url );
889890 }
890891 }
891892 }
Index: branches/phase3_rev_deleted/includes/LinksUpdate.php
@@ -76,6 +76,7 @@
7777 } else {
7878 $this->doIncrementalUpdate();
7979 }
 80+ wfRunHooks( 'TitleLinkUpdatesAfterCompletion', array( &$this->mTitle ) );
8081 }
8182
8283 function doIncrementalUpdate() {