X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Fexport%2FWikiExporter.php;h=6e2a5a4f0cd4f0d17bcb0cd8e8a5ffa1cdd509fd;hb=c99dbcc7d5fc3b320e288fe7550044adc36b7212;hp=943aa045f9820c83e1fcb875def9f19dfc4b3f44;hpb=f3a51244a3d19862044b4832dc2bd332c89fc028;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/export/WikiExporter.php b/includes/export/WikiExporter.php index 943aa045f9..6e2a5a4f0c 100644 --- a/includes/export/WikiExporter.php +++ b/includes/export/WikiExporter.php @@ -106,7 +106,7 @@ class WikiExporter { * various row objects and XML output for filtering. Filters * can be chained or used as callbacks. * - * @param DumpOutput $sink + * @param DumpOutput &$sink */ public function setOutputSink( &$sink ) { $this->sink =& $sink; @@ -253,13 +253,14 @@ class WikiExporter { /** * @param string $cond + * @param bool $orderRevs * @throws MWException * @throws Exception */ protected function dumpFrom( $cond = '', $orderRevs = false ) { # For logging dumps... if ( $this->history & self::LOGS ) { - $where = [ 'user_id = log_user' ]; + $where = []; # Hide private logs $hideLogs = LogEventsList::getExcludeClause( $this->db ); if ( $hideLogs ) { @@ -276,12 +277,16 @@ class WikiExporter { $prev = $this->db->bufferResults( false ); } $result = null; // Assuring $result is not undefined, if exception occurs early + + $commentQuery = CommentStore::newKey( 'log_comment' )->getJoin(); + try { - $result = $this->db->select( [ 'logging', 'user' ], - [ "{$logging}.*", 'user_name' ], // grab the user name + $result = $this->db->select( [ 'logging', 'user' ] + $commentQuery['tables'], + [ "{$logging}.*", 'user_name' ] + $commentQuery['fields'], // grab the user name $where, __METHOD__, - [ 'ORDER BY' => 'log_id', 'USE INDEX' => [ 'logging' => 'PRIMARY' ] ] + [ 'ORDER BY' => 'log_id', 'USE INDEX' => [ 'logging' => 'PRIMARY' ] ], + [ 'user' => [ 'JOIN', 'user_id = log_user' ] ] + $commentQuery['joins'] ); $this->outputLogStream( $result ); if ( $this->buffer == self::STREAM ) { @@ -394,8 +399,17 @@ class WikiExporter { Hooks::run( 'ModifyExportQuery', [ $this->db, &$tables, &$cond, &$opts, &$join ] ); + $commentQuery = CommentStore::newKey( 'rev_comment' )->getJoin(); + # Do the query! - $result = $this->db->select( $tables, '*', $cond, __METHOD__, $opts, $join ); + $result = $this->db->select( + $tables + $commentQuery['tables'], + [ '*' ] + $commentQuery['fields'], + $cond, + __METHOD__, + $opts, + $join + $commentQuery['joins'] + ); # Output dump results $this->outputPageStream( $result );