X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialExport.php;h=ef61ac5b3394e591cd05e221a82491ba9395e79a;hb=a1ef77b2d80830fbcb617a83961d78cff9d6e384;hp=be79cae68c8fa889a0c3852d02075e6ed1b25926;hpb=32fe4473e81e75c3dd085c5447390d4a4b1008f4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index be79cae68c..e680d240c0 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -23,6 +23,7 @@ * @ingroup SpecialPage */ +use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; /** @@ -98,6 +99,15 @@ class SpecialExport extends SpecialPage { $page = ''; $history = ''; } elseif ( $request->wasPosted() && $par == '' ) { + // Log to see if certain parameters are actually used. + // If not, we could deprecate them and do some cleanup, here and in WikiExporter. + LoggerFactory::getInstance( 'export' )->debug( + 'Special:Export POST, dir: [{dir}], offset: [{offset}], limit: [{limit}]', [ + 'dir' => $request->getRawVal( 'dir' ), + 'offset' => $request->getRawVal( 'offset' ), + 'limit' => $request->getRawVal( 'limit' ), + ] ); + $page = $request->getText( 'pages' ); $this->curonly = $request->getCheck( 'curonly' ); $rawOffset = $request->getVal( 'offset' ); @@ -317,7 +327,9 @@ class SpecialExport extends SpecialPage { * @return bool */ private function userCanOverrideExportDepth() { - return $this->getUser()->isAllowed( 'override-export-depth' ); + return MediaWikiServices::getInstance() + ->getPermissionManager() + ->userHasRight( $this->getUser(), 'override-export-depth' ); } /** @@ -369,29 +381,17 @@ class SpecialExport extends SpecialPage { } /* Ok, let's get to it... */ - if ( $history == WikiExporter::CURRENT ) { - $lb = false; - $db = wfGetDB( DB_REPLICA ); - $buffer = WikiExporter::BUFFER; - } else { - // Use an unbuffered query; histories may be very long! - $lb = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->newMainLB(); - $db = $lb->getConnection( DB_REPLICA ); - $buffer = WikiExporter::STREAM; - - // This might take a while... :D - Wikimedia\suppressWarnings(); - set_time_limit( 0 ); - Wikimedia\restoreWarnings(); - } + $db = wfGetDB( DB_REPLICA ); - $exporter = new WikiExporter( $db, $history, $buffer ); + $exporter = new WikiExporter( $db, $history ); $exporter->list_authors = $list_authors; $exporter->openStream(); if ( $exportall ) { $exporter->allPages(); } else { + $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); + foreach ( $pages as $page ) { # T10824: Only export pages the user can read $title = Title::newFromText( $page ); @@ -400,7 +400,7 @@ class SpecialExport extends SpecialPage { continue; } - if ( !$title->userCan( 'read', $this->getUser() ) ) { + if ( !$permissionManager->userCan( 'read', $this->getUser(), $title ) ) { // @todo Perhaps output an tag or something. continue; } @@ -410,10 +410,6 @@ class SpecialExport extends SpecialPage { } $exporter->closeStream(); - - if ( $lb ) { - $lb->closeAll(); - } } /**