ApiPageSet is calling $this->profileOut(), then calling a function that
calls $this->profileDBIn(). Move that function to after a new
$this->profileIn().
Also, add a unit test for this situation.
Bug: 51821
Change-Id: Ib4dbfb567faadcd5e3d7d058ca6bdf8b4c83f634
if ( !$isDryRun ) {
$generator->executeGenerator( $this );
wfRunHooks( 'APIQueryGeneratorAfterExecute', array( &$generator, &$this ) );
- $this->resolvePendingRedirects();
} else {
// Prevent warnings from being reported on these parameters
$main = $this->getMain();
$generator->profileOut();
$this->profileIn();
+ if ( !$isDryRun ) {
+ $this->resolvePendingRedirects();
+ }
+
if ( !$isQuery ) {
// If this pageset is not part of the query, we called profileIn() above
$dbSource->profileOut();
self::$categorymembers ) );
}
+ /**
+ * Test bug 51821
+ */
+ public function testGeneratorRedirects() {
+ $this->editPage( 'AQBT-Target', 'test' );
+ $this->editPage( 'AQBT-Redir', '#REDIRECT [[AQBT-Target]]' );
+ $this->check( array(
+ array( 'generator' => 'backlinks', 'gbltitle' => 'AQBT-Target', 'redirects' => '1' ),
+ array(
+ 'redirects' => array(
+ array(
+ 'from' => 'AQBT-Redir',
+ 'to' => 'AQBT-Target',
+ )
+ ),
+ 'pages' => array(
+ '6' => array(
+ 'pageid' => 6,
+ 'ns' => 0,
+ 'title' => 'AQBT-Target',
+ )
+ ),
+ )
+ ) );
+ }
+
/**
* Recursively merges the expected values in the $item into the $all
*/