diff --git a/includes/api/ApiQueryExtLinksUsage.php b/includes/api/ApiQueryExtLinksUsage.php index f4f6273e53d..e59fe055aeb 100644 --- a/includes/api/ApiQueryExtLinksUsage.php +++ b/includes/api/ApiQueryExtLinksUsage.php @@ -123,7 +123,12 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { } } - $orderBy[] = 'el_id'; + if ( $migrationStage & SCHEMA_COMPAT_READ_OLD ) { + $orderBy[] = 'el_id'; + } else { + // READ NEW doesn't need this complex continuation + $orderBy = [ 'el_id' ]; + } $this->addOption( 'ORDER BY', $orderBy ); $this->addFields( $orderBy ); // Make sure diff --git a/includes/api/ApiQueryExternalLinks.php b/includes/api/ApiQueryExternalLinks.php index d7893ae4e3f..2374db914d3 100644 --- a/includes/api/ApiQueryExternalLinks.php +++ b/includes/api/ApiQueryExternalLinks.php @@ -114,7 +114,12 @@ class ApiQueryExternalLinks extends ApiQueryBase { } } - $orderBy[] = 'el_id'; + if ( $migrationStage & SCHEMA_COMPAT_READ_OLD ) { + $orderBy[] = 'el_id'; + } else { + // READ NEW doesn't need this complex continuation + $orderBy = [ 'el_id' ]; + } $this->addOption( 'ORDER BY', $orderBy ); $this->addFields( $orderBy ); // Make sure diff --git a/includes/specials/SpecialLinkSearch.php b/includes/specials/SpecialLinkSearch.php index f7218db440c..f1a3987e059 100644 --- a/includes/specials/SpecialLinkSearch.php +++ b/includes/specials/SpecialLinkSearch.php @@ -217,7 +217,12 @@ class SpecialLinkSearch extends QueryPage { $orderBy[] = $field; } - $orderBy[] = 'el_id'; + if ( $migrationStage & SCHEMA_COMPAT_READ_OLD ) { + $orderBy[] = 'el_id'; + } else { + // READ NEW doesn't need this complex continuation + $orderBy = [ 'el_id' ]; + } $retval = [ 'tables' => [ 'page', 'externallinks' ],