X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateRevisionSha1.php;h=113eef49bcada007abc40b2e580cb04296f91948;hb=ce1b556f225f81668274ca0c70223e5fe1d427df;hp=1d8e4c8ba6393740c41f827d764efe969ca0fd15;hpb=90108d8c93735d7d5964f907b999c3a326e87461;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateRevisionSha1.php b/maintenance/populateRevisionSha1.php index 1d8e4c8ba6..113eef49bc 100644 --- a/maintenance/populateRevisionSha1.php +++ b/maintenance/populateRevisionSha1.php @@ -18,11 +18,18 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * + * @file * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); +/** + * Maintenance script that fills the rev_sha1 and ar_sha1 columns of revision + * and archive tables for revisions created before MW 1.19. + * + * @ingroup Maintenance + */ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { public function __construct() { parent::__construct(); @@ -41,6 +48,9 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { $this->error( "revision table does not exist", true ); } elseif ( !$db->tableExists( 'archive' ) ) { $this->error( "archive table does not exist", true ); + } else if ( !$db->fieldExists( 'revision', 'rev_sha1', __METHOD__ ) ) { + $this->output( "rev_sha1 column does not exist\n\n", true ); + return false; } $this->output( "Populating rev_sha1 column\n" ); @@ -136,14 +146,14 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { $rev = ( $table === 'archive' ) ? Revision::newFromArchiveRow( $row ) : new Revision( $row ); - $text = $rev->getRawText(); + $text = $rev->getSerializedData(); } catch ( MWException $e ) { - $this->output( "Text of revision with {$idCol}={$row->$idCol} unavailable!\n" ); + $this->output( "Data of revision with {$idCol}={$row->$idCol} unavailable!\n" ); return false; // bug 22624? } if ( !is_string( $text ) ) { # This should not happen, but sometimes does (bug 20757) - $this->output( "Text of revision with {$idCol}={$row->$idCol} unavailable!\n" ); + $this->output( "Data of revision with {$idCol}={$row->$idCol} unavailable!\n" ); return false; } else { $db->update( $table, @@ -167,10 +177,10 @@ class PopulateRevisionSha1 extends LoggedUpdateMaintenance { $this->output( "Text of revision with timestamp {$row->ar_timestamp} unavailable!\n" ); return false; // bug 22624? } - $text = $rev->getRawText(); + $text = $rev->getSerializedData(); if ( !is_string( $text ) ) { # This should not happen, but sometimes does (bug 20757) - $this->output( "Text of revision with timestamp {$row->ar_timestamp} unavailable!\n" ); + $this->output( "Data of revision with timestamp {$row->ar_timestamp} unavailable!\n" ); return false; } else { # Archive table as no PK, but (NS,title,time) should be near unique.