Index: trunk/extensions/DataTransclusion/ImportMAB2.php |
— | — | @@ -25,6 +25,7 @@ |
26 | 26 | $this->addOption( "create", "create database tables if they do not exist", false, false ); |
27 | 27 | $this->addOption( "truncate", "truncate (empty) database tables", false, false ); |
28 | 28 | $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 ); |
29 | 30 | $this->addOption( "limit", "max number of files to process", false, true ); |
30 | 31 | $this->addOption( "debug", "don't write to the database, dump to console instead", false, false ); |
31 | 32 | } |
— | — | @@ -66,6 +67,7 @@ |
67 | 68 | global $wgDataTransclusionSources; |
68 | 69 | |
69 | 70 | $this->debug = $this->hasOption( 'debug' ); |
| 71 | + $this->noblob = $this->hasOption( 'noblob' ); |
70 | 72 | $limit = (int)$this->getOption( 'limit' ); |
71 | 73 | |
72 | 74 | $src = $this->mArgs[0]; |
— | — | @@ -126,7 +128,7 @@ |
127 | 129 | if ( $ids ) { |
128 | 130 | if ( $this->debug ) { |
129 | 131 | var_export( $ids ); |
130 | | - var_export( $rec ); |
| 132 | + if ( !$this->noblob ) var_export( $rec ); |
131 | 133 | print "------------------------------------\n"; |
132 | 134 | } else { |
133 | 135 | $this->output( "importing file $file\n" ); |
— | — | @@ -182,8 +184,12 @@ |
183 | 185 | |
184 | 186 | $insert = array( 'data' => serialize($rec) ); |
185 | 187 | |
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 | + } |
188 | 194 | |
189 | 195 | $insert = array(); |
190 | 196 | foreach ( $ids as $field => $values ) { |