Don't explode in dump text prefetch when we fall off the end of the file :D
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 16 Oct 2005 23:53:29 +0000 (23:53 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 16 Oct 2005 23:53:29 +0000 (23:53 +0000)
maintenance/backupPrefetch.inc

index ddb0656..759220d 100644 (file)
@@ -92,6 +92,9 @@ class BaseDump {
         * @access private
         */
        function skipTo( $name ) {
+               if( $this->atEnd ) {
+                       return false;
+               }
                while( $this->reader->read() ) {
                        if( $this->reader->nodeType == XMLREADER_ELEMENT &&
                                $this->reader->name == $name ) {
@@ -109,6 +112,9 @@ class BaseDump {
         * @access private
         */
        function nodeContents() {
+               if( $this->atEnd ) {
+                       return false;
+               }
                if( $this->reader->isEmptyElement ) {
                        return "";
                }
@@ -132,7 +138,6 @@ class BaseDump {
         */
        function close() {
                $this->reader->close();
-               $this->reader = null;
                $this->atEnd = true;
                return false;
        }