require_once __DIR__ . '/Maintenance.php';
+use Wikimedia\Rdbms\IDatabase;
+
/**
* Usage:
* populateContentModel.php --ns=1 --table=page
*/
class PopulateContentModel extends Maintenance {
protected $wikiId;
-
+ /** @var WANObjectCache */
protected $wanCache;
public function __construct() {
$this->wanCache->delete( $revisionKey );
}
- private function updatePageRows( Database $dbw, $pageIds, $model ) {
+ private function updatePageRows( IDatabase $dbw, $pageIds, $model ) {
$count = count( $pageIds );
$this->output( "Setting $count rows to $model..." );
$dbw->update(
$this->output( "done.\n" );
}
- protected function populatePage( Database $dbw, $ns ) {
+ protected function populatePage( IDatabase $dbw, $ns ) {
$toSave = [];
$lastId = 0;
$nsCondition = $ns === 'all' ? [] : [ 'page_namespace' => $ns ];
}
}
- private function updateRevisionOrArchiveRows( Database $dbw, $ids, $model, $table ) {
+ private function updateRevisionOrArchiveRows( IDatabase $dbw, $ids, $model, $table ) {
$prefix = $table === 'archive' ? 'ar' : 'rev';
$model_column = "{$prefix}_content_model";
$format_column = "{$prefix}_content_format";
$this->output( "done.\n" );
}
- protected function populateRevisionOrArchive( Database $dbw, $table, $ns ) {
+ protected function populateRevisionOrArchive( IDatabase $dbw, $table, $ns ) {
$prefix = $table === 'archive' ? 'ar' : 'rev';
$model_column = "{$prefix}_content_model";
$format_column = "{$prefix}_content_format";