Added $wgMaxBacklinksInvalidate to avoid massive html cache invalidation.
[lhc/web/wiklou.git] / includes / Export.php
index 6053644..16c297e 100644 (file)
@@ -83,9 +83,9 @@ class WikiExporter {
         * @param $buffer Int: one of WikiExporter::BUFFER or WikiExporter::STREAM
         * @param $text Int: one of WikiExporter::TEXT or WikiExporter::STUB
         */
-       function __construct( &$db, $history = WikiExporter::CURRENT,
+       function __construct( $db, $history = WikiExporter::CURRENT,
                        $buffer = WikiExporter::BUFFER, $text = WikiExporter::TEXT ) {
-               $this->db =& $db;
+               $this->db = $db;
                $this->history = $history;
                $this->buffer  = $buffer;
                $this->writer  = new XmlDumpWriter();
@@ -427,10 +427,10 @@ class WikiExporter {
        protected function outputPageStream( $resultset ) {
                $last = null;
                foreach ( $resultset as $row ) {
-                       if ( is_null( $last ) ||
+                       if ( $last === null ||
                                $last->page_namespace != $row->page_namespace ||
                                $last->page_title     != $row->page_title ) {
-                               if ( isset( $last ) ) {
+                               if ( $last !== null ) {
                                        $output = '';
                                        if ( $this->dumpUploads ) {
                                                $output .= $this->writer->writeUploads( $last, $this->dumpUploadFileContents );
@@ -445,7 +445,7 @@ class WikiExporter {
                        $output = $this->writer->writeRevision( $row );
                        $this->sink->writeRevision( $row, $output );
                }
-               if ( isset( $last ) ) {
+               if ( $last !== null ) {
                        $output = '';
                        if ( $this->dumpUploads ) {
                                $output .= $this->writer->writeUploads( $last, $this->dumpUploadFileContents );
@@ -636,29 +636,29 @@ class XmlDumpWriter {
 
                $out  = "    <revision>\n";
                $out .= "      " . Xml::element( 'id', null, strval( $row->rev_id ) ) . "\n";
-               if( $row->rev_parent_id ) {
+               if( isset( $row->rev_parent_id ) && $row->rev_parent_id ) {
                        $out .= "      " . Xml::element( 'parentid', null, strval( $row->rev_parent_id ) ) . "\n";
                }
 
                $out .= $this->writeTimestamp( $row->rev_timestamp );
 
-               if ( $row->rev_deleted & Revision::DELETED_USER ) {
+               if ( isset( $row->rev_deleted ) && ( $row->rev_deleted & Revision::DELETED_USER ) ) {
                        $out .= "      " . Xml::element( 'contributor', array( 'deleted' => 'deleted' ) ) . "\n";
                } else {
                        $out .= $this->writeContributor( $row->rev_user, $row->rev_user_text );
                }
 
-               if ( $row->rev_minor_edit ) {
+               if ( isset( $row->rev_minor_edit ) && $row->rev_minor_edit ) {
                        $out .=  "      <minor/>\n";
                }
-               if ( $row->rev_deleted & Revision::DELETED_COMMENT ) {
+               if ( isset( $row->rev_deleted ) && ( $row->rev_deleted & Revision::DELETED_COMMENT ) ) {
                        $out .= "      " . Xml::element( 'comment', array( 'deleted' => 'deleted' ) ) . "\n";
                } elseif ( $row->rev_comment != '' ) {
                        $out .= "      " . Xml::elementClean( 'comment', array(), strval( $row->rev_comment ) ) . "\n";
                }
 
                $text = '';
-               if ( $row->rev_deleted & Revision::DELETED_TEXT ) {
+               if ( isset( $row->rev_deleted ) && ( $row->rev_deleted & Revision::DELETED_TEXT ) ) {
                        $out .= "      " . Xml::element( 'text', array( 'deleted' => 'deleted' ) ) . "\n";
                } elseif ( isset( $row->old_text ) ) {
                        // Raw text from the database may have invalid chars
@@ -673,7 +673,7 @@ class XmlDumpWriter {
                                "" ) . "\n";
                }
 
-               if ( $row->rev_sha1 && !( $row->rev_deleted & Revision::DELETED_TEXT ) ) {
+               if ( isset( $row->rev_sha1 ) && $row->rev_sha1 && !( $row->rev_deleted & Revision::DELETED_TEXT ) ) {
                        $out .= "      " . Xml::element('sha1', null, strval( $row->rev_sha1 ) ) . "\n";
                } else {
                        $out .= "      <sha1/>\n";
@@ -1347,6 +1347,7 @@ class DumpNamespaceFilter extends DumpFilter {
        /**
         * @param $sink DumpOutput
         * @param $param
+        * @throws MWException
         */
        function __construct( &$sink, $param ) {
                parent::__construct( $sink );