Simplify NewFilesPager::getQueryInfo
authorUmherirrender <umherirrender_de.wp@web.de>
Mon, 19 Aug 2019 19:57:32 +0000 (21:57 +0200)
committerUmherirrender <umherirrender_de.wp@web.de>
Sat, 21 Sep 2019 11:01:37 +0000 (11:01 +0000)
The query here is not used for the images to display, so the query must
not include all columns from the images table, because that is not used

The gallery itself will load the necessary information for the display
in separate queries

Bug: T227608
Change-Id: I70b0d1bcdc155c38d69b5dd52bf4e3898920ab76

includes/specials/pagers/NewFilesPager.php

index be4a1bd..9a78c5d 100644 (file)
@@ -64,11 +64,11 @@ class NewFilesPager extends RangeChronologicalPager {
        function getQueryInfo() {
                $opts = $this->opts;
                $conds = [];
-               $imgQuery = LocalFile::getQueryInfo();
-               $tables = $imgQuery['tables'];
-               $fields = [ 'img_name', 'img_timestamp' ] + $imgQuery['fields'];
+               $actorQuery = ActorMigration::newMigration()->getJoin( 'img_user' );
+               $tables = [ 'image' ] + $actorQuery['tables'];
+               $fields = [ 'img_name', 'img_timestamp' ] + $actorQuery['fields'];
                $options = [];
-               $jconds = $imgQuery['joins'];
+               $jconds = $actorQuery['joins'];
 
                $user = $opts->getValue( 'user' );
                if ( $user !== '' ) {
@@ -89,7 +89,7 @@ class NewFilesPager extends RangeChronologicalPager {
                                        'LEFT JOIN',
                                        [
                                                'ug_group' => $groupsWithBotPermission,
-                                               'ug_user = ' . $imgQuery['fields']['img_user'],
+                                               'ug_user = ' . $actorQuery['fields']['img_user'],
                                                'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() )
                                        ]
                                ];
@@ -107,7 +107,7 @@ class NewFilesPager extends RangeChronologicalPager {
                                'JOIN',
                                [
                                        'rc_title = img_name',
-                                       'rc_actor = ' . $imgQuery['fields']['img_actor'],
+                                       'rc_actor = ' . $actorQuery['fields']['img_actor'],
                                        'rc_timestamp = img_timestamp'
                                ]
                        ];