Merge "Only new vertical format login and signup forms"
[lhc/web/wiklou.git] / maintenance / backupTextPass.inc
index 0b8b344..c5e48f4 100644 (file)
@@ -24,7 +24,7 @@
  * @ingroup Maintenance
  */
 
-require_once( __DIR__ . '/backup.inc' );
+require_once __DIR__ . '/backup.inc';
 
 /**
  * @ingroup Maintenance
@@ -141,8 +141,9 @@ class TextPassDumper extends BackupDumper {
        function dump( $history, $text = WikiExporter::TEXT ) {
                // Notice messages will foul up your XML output even if they're
                // relatively harmless.
-               if ( ini_get( 'display_errors' ) )
+               if ( ini_get( 'display_errors' ) ) {
                        ini_set( 'display_errors', 'stderr' );
+               }
 
                $this->initProgress( $this->history );
 
@@ -182,7 +183,7 @@ class TextPassDumper extends BackupDumper {
                global $IP;
                $url = $this->processFileOpt( $val, $param );
 
-               switch( $opt ) {
+               switch ( $opt ) {
                case 'prefetch':
                        require_once "$IP/maintenance/backupPrefetch.inc";
                        $this->prefetch = new BaseDump( $url );
@@ -214,7 +215,7 @@ class TextPassDumper extends BackupDumper {
        function processFileOpt( $val, $param ) {
                $fileURIs = explode( ';', $param );
                foreach ( $fileURIs as $URI ) {
-                       switch( $val ) {
+                       switch ( $val ) {
                                case "file":
                                        $newURI = $URI;
                                        break;
@@ -298,7 +299,7 @@ class TextPassDumper extends BackupDumper {
        }
 
        function checkIfTimeExceeded() {
-               if ( $this->maxTimeAllowed &&  ( $this->lastTime - $this->timeOfCheckpoint  > $this->maxTimeAllowed ) ) {
+               if ( $this->maxTimeAllowed && ( $this->lastTime - $this->timeOfCheckpoint > $this->maxTimeAllowed ) ) {
                        return true;
                }
                return false;
@@ -611,17 +612,21 @@ class TextPassDumper extends BackupDumper {
 
        private function closeSpawn() {
                wfSuppressWarnings();
-               if ( $this->spawnRead )
+               if ( $this->spawnRead ) {
                        fclose( $this->spawnRead );
+               }
                $this->spawnRead = false;
-               if ( $this->spawnWrite )
+               if ( $this->spawnWrite ) {
                        fclose( $this->spawnWrite );
+               }
                $this->spawnWrite = false;
-               if ( $this->spawnErr )
+               if ( $this->spawnErr ) {
                        fclose( $this->spawnErr );
+               }
                $this->spawnErr = false;
-               if ( $this->spawnProc )
+               if ( $this->spawnProc ) {
                        pclose( $this->spawnProc );
+               }
                $this->spawnProc = false;
                wfRestoreWarnings();
        }
@@ -631,11 +636,15 @@ class TextPassDumper extends BackupDumper {
 
                $ok = fwrite( $this->spawnWrite, "$id\n" );
                // $this->progress( ">> $id" );
-               if ( !$ok ) return false;
+               if ( !$ok ) {
+                       return false;
+               }
 
                $ok = fflush( $this->spawnWrite );
                // $this->progress( ">> [flush]" );
-               if ( !$ok ) return false;
+               if ( !$ok ) {
+                       return false;
+               }
 
                // check that the text id they are sending is the one we asked for
                // this avoids out of sync revision text errors we have encountered in the past
@@ -649,18 +658,24 @@ class TextPassDumper extends BackupDumper {
 
                $len = fgets( $this->spawnRead );
                // $this->progress( "<< " . trim( $len ) );
-               if ( $len === false ) return false;
+               if ( $len === false ) {
+                       return false;
+               }
 
                $nbytes = intval( $len );
                // actual error, not zero-length text
-               if ( $nbytes < 0 ) return false;
+               if ( $nbytes < 0 ) {
+                       return false;
+               }
 
                $text = "";
 
                // Subprocess may not send everything at once, we have to loop.
                while ( $nbytes > strlen( $text ) ) {
                        $buffer = fread( $this->spawnRead, $nbytes - strlen( $text ) );
-                       if ( $buffer === false ) break;
+                       if ( $buffer === false ) {
+                               break;
+                       }
                        $text .= $buffer;
                }