Page MenuHomePhabricator

textMigration.php

Authored By
bzimport
Nov 22 2014, 12:20 AM
Size
744 B
Referenced Files
None
Subscribers
None

textMigration.php

<?php
require_once 'Maintenance.php';
class TextMigration extends Maintenance {
public function __construct() {
parent::__construct();
}
public function execute() {
$this->output("Migrating the fields archive.ar_text and archive.ar_flags from archive table to text table\n");
$dbw = wfGetDB( DB_MASTER );
$result = $dbw ->select( 'archive',
array( 'ar_text', 'ar_flags' ),
NULL,
__METHOD__);
foreach( $result as $row) {
$dbw->insert( 'text',
array('old_text'=>$row->ar_text,'old_flags'=>$row->ar_flags),
__METHOD__,
'');
$count = $dbw->affectedRows();
$this->output( "Successfully migrated $count number of rows \n") ;
}
}
}
$maintClass = "TextMigration";
require_once RUN_MAINTENANCE_IF_MAIN;

File Metadata

Mime Type
text/x-php
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8733
Default Alt Text
textMigration.php (744 B)

Event Timeline