r72910 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72909‎ | r72910 | r72911 >
Date:15:32, 13 September 2010
Author:daniel
Status:deferred
Tags:
Comment:
ImportMAB2 --noblob option
Modified paths:
  • /trunk/extensions/DataTransclusion/ImportMAB2.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DataTransclusion/ImportMAB2.php
@@ -25,6 +25,7 @@
2626 $this->addOption( "create", "create database tables if they do not exist", false, false );
2727 $this->addOption( "truncate", "truncate (empty) database tables", false, false );
2828 $this->addOption( "prefix", "database table prefix. May contain a period (\".\") to reference tables in another database. If not given, the wiki's table prefix will be used", false, true );
 29+ $this->addOption( "noblob", "don't write blob data, import index fields only", false, false );
2930 $this->addOption( "limit", "max number of files to process", false, true );
3031 $this->addOption( "debug", "don't write to the database, dump to console instead", false, false );
3132 }
@@ -66,6 +67,7 @@
6768 global $wgDataTransclusionSources;
6869
6970 $this->debug = $this->hasOption( 'debug' );
 71+ $this->noblob = $this->hasOption( 'noblob' );
7072 $limit = (int)$this->getOption( 'limit' );
7173
7274 $src = $this->mArgs[0];
@@ -126,7 +128,7 @@
127129 if ( $ids ) {
128130 if ( $this->debug ) {
129131 var_export( $ids );
130 - var_export( $rec );
 132+ if ( !$this->noblob ) var_export( $rec );
131133 print "------------------------------------\n";
132134 } else {
133135 $this->output( "importing file $file\n" );
@@ -182,8 +184,12 @@
183185
184186 $insert = array( 'data' => serialize($rec) );
185187
186 - $db->insert( $this->blob_table, $insert );
187 - $id = $db->insertId();
 188+ if ( $this->noblob ) {
 189+ $id = 0;
 190+ } else {
 191+ $db->insert( $this->blob_table, $insert );
 192+ $id = $db->insertId();
 193+ }
188194
189195 $insert = array();
190196 foreach ( $ids as $field => $values ) {

Status & tagging log