r72921 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72920‎ | r72921 | r72922 >
Date:18:45, 13 September 2010
Author:daniel
Status:deferred
Tags:
Comment:
improved error resilliance
Modified paths:
  • /trunk/extensions/DataTransclusion/ImportMAB2.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DataTransclusion/ImportMAB2.php
@@ -113,6 +113,11 @@
114114
115115 $this->output( "scanning directory $dir\n" );
116116 $d = opendir( $dir );
 117+ if ( !$d ) {
 118+ $this->error( "unable to open directory $dir!\n" );
 119+ return false;
 120+ }
 121+
117122 while( ( $file = readdir( $d ) ) ) {
118123 if ( $file == "." or $file == ".." ) {
119124 continue;
@@ -187,7 +192,7 @@
188193 if ( $this->noblob ) {
189194 $id = 0;
190195 } else {
191 - $db->insert( $this->blob_table, $insert );
 196+ $db->insert( $this->blob_table, $insert, __METHOD__ );
192197 $id = $db->insertId();
193198 }
194199
@@ -201,7 +206,7 @@
202207 }
203208 }
204209
205 - $db->insert( $this->index_table, $insert );
 210+ $db->insert( $this->index_table, $insert, __METHOD__, array( 'IGNORE' ) );
206211 }
207212
208213 public function readMabFile( $file ) {

Status & tagging log