X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiQueryAllPages.php;h=e441991af87f6114e4703d7e7bc474452fc62aad;hp=e243593b1b231812a06895b1f8bd183380fecda2;hb=59ebff658ce912c1b0e7ef8d8f9bfec5a4e17b39;hpb=31d0a18d3efd13f025633df1cc5a5be7b058f9a3 diff --git a/includes/api/ApiQueryAllPages.php b/includes/api/ApiQueryAllPages.php index e243593b1b..e441991af8 100644 --- a/includes/api/ApiQueryAllPages.php +++ b/includes/api/ApiQueryAllPages.php @@ -175,10 +175,14 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { // 1999 rules works fine, but that breaks other DBs. Sigh. /// @todo Once we drop support for 1992-rule DBs, we can simplify this. $dbType = $db->getType(); - if ( $dbType === 'mysql' || $dbType === 'sqlite' || - $dbType === 'postgres' && $db->getServerVersion() >= 9.1 - ) { - // 1999 rules, or screw-the-rules + if ( $dbType === 'mysql' || $dbType === 'sqlite' ) { + // Ignore the rules, or 1999 rules if you count unique keys + // over non-NULL columns as satisfying the requirement for + // "functional dependency" and don't require including + // constant-in-WHERE columns in the GROUP BY. + $this->addOption( 'GROUP BY', array( 'page_title' ) ); + } elseif ( $dbType === 'postgres' && $db->getServerVersion() >= 9.1 ) { + // 1999 rules only counting primary keys $this->addOption( 'GROUP BY', array( 'page_title', 'page_id' ) ); } else { // 1992 rules @@ -234,7 +238,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { } if ( is_null( $resultPageSet ) ) { - $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'p' ); + $result->addIndexedTagName( array( 'query', $this->getModuleName() ), 'p' ); } }