(bug 26909) follow up r102947: fix the navigation with 'dir'
and 'continue' for some prop-Modules Due to missing change of the where for the query-continue in my first patch, using dir=descending will end up in a loop Change-Id: I6a9ade9feddcfd046de347cd83a756af828b5c18
This commit is contained in:
parent
613cf28820
commit
1b41425ee4
6 changed files with 41 additions and 25 deletions
|
|
@ -89,12 +89,13 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
|
|||
$this->dieUsage( "Invalid continue param. You should pass the " .
|
||||
"original value returned by the previous query", "_badcontinue" );
|
||||
}
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
$clfrom = intval( $cont[0] );
|
||||
$clto = $this->getDB()->strencode( $this->titleToKey( $cont[1] ) );
|
||||
$clto = $this->getDB()->addQuotes( $this->titleToKey( $cont[1] ) );
|
||||
$this->addWhere(
|
||||
"cl_from > $clfrom OR " .
|
||||
"cl_from $op $clfrom OR " .
|
||||
"(cl_from = $clfrom AND " .
|
||||
"cl_to >= '$clto')"
|
||||
"cl_to $op= $clto)"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,17 +80,27 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
|
|||
$this->dieUsage( 'Invalid continue param. You should pass the ' .
|
||||
'original value returned by the previous query', '_badcontinue' );
|
||||
}
|
||||
$orig = $this->getDB()->strencode( $this->titleTokey( $cont[0] ) );
|
||||
$dup = $this->getDB()->strencode( $this->titleToKey( $cont[1] ) );
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
$db = $this->getDB();
|
||||
$orig = $db->addQuotes( $this->titleTokey( $cont[0] ) );
|
||||
$dup = $db->addQuotes( $this->titleToKey( $cont[1] ) );
|
||||
$this->addWhere(
|
||||
"i1.img_name > '$orig' OR " .
|
||||
"(i1.img_name = '$orig' AND " .
|
||||
"i2.img_name >= '$dup')"
|
||||
"i1.img_name $op $orig OR " .
|
||||
"(i1.img_name = $orig AND " .
|
||||
"i2.img_name $op= $dup)"
|
||||
);
|
||||
}
|
||||
|
||||
$dir = ( $params['dir'] == 'descending' ? ' DESC' : '' );
|
||||
$this->addOption( 'ORDER BY', 'i1.img_name' . $dir );
|
||||
// Don't order by i1.img_name if it's constant in the WHERE clause
|
||||
if ( count( $this->getPageSet()->getGoodTitles() ) == 1 ) {
|
||||
$this->addOption( 'ORDER BY', 'i2.img_name' . $dir );
|
||||
} else {
|
||||
$this->addOption( 'ORDER BY', array(
|
||||
'i1.img_name' . $dir,
|
||||
'i2.img_name' . $dir
|
||||
));
|
||||
}
|
||||
$this->addOption( 'LIMIT', $params['limit'] + 1 );
|
||||
|
||||
$res = $this->select( __METHOD__ );
|
||||
|
|
|
|||
|
|
@ -62,15 +62,17 @@ class ApiQueryIWLinks extends ApiQueryBase {
|
|||
$this->dieUsage( 'Invalid continue param. You should pass the ' .
|
||||
'original value returned by the previous query', '_badcontinue' );
|
||||
}
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
$db = $this->getDB();
|
||||
$iwlfrom = intval( $cont[0] );
|
||||
$iwlprefix = $this->getDB()->strencode( $cont[1] );
|
||||
$iwltitle = $this->getDB()->strencode( $this->titleToKey( $cont[2] ) );
|
||||
$iwlprefix = $db->addQuotes( $cont[1] );
|
||||
$iwltitle = $db->addQuotes( $this->titleToKey( $cont[2] ) );
|
||||
$this->addWhere(
|
||||
"iwl_from > $iwlfrom OR " .
|
||||
"iwl_from $op $iwlfrom OR " .
|
||||
"(iwl_from = $iwlfrom AND " .
|
||||
"(iwl_prefix > '$iwlprefix' OR " .
|
||||
"(iwl_prefix = '$iwlprefix' AND " .
|
||||
"iwl_title >= '$iwltitle')))"
|
||||
"(iwl_prefix $op $iwlprefix OR " .
|
||||
"(iwl_prefix = $iwlprefix AND " .
|
||||
"iwl_title $op= $iwltitle)))"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,12 +65,13 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
|
|||
$this->dieUsage( 'Invalid continue param. You should pass the ' .
|
||||
'original value returned by the previous query', '_badcontinue' );
|
||||
}
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
$ilfrom = intval( $cont[0] );
|
||||
$ilto = $this->getDB()->strencode( $this->titleToKey( $cont[1] ) );
|
||||
$ilto = $this->getDB()->addQuotes( $this->titleToKey( $cont[1] ) );
|
||||
$this->addWhere(
|
||||
"il_from > $ilfrom OR " .
|
||||
"il_from $op $ilfrom OR " .
|
||||
"(il_from = $ilfrom AND " .
|
||||
"il_to >= '$ilto')"
|
||||
"il_to $op= $ilto)"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,12 +60,13 @@ class ApiQueryLangLinks extends ApiQueryBase {
|
|||
$this->dieUsage( 'Invalid continue param. You should pass the ' .
|
||||
'original value returned by the previous query', '_badcontinue' );
|
||||
}
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
$llfrom = intval( $cont[0] );
|
||||
$lllang = $this->getDB()->strencode( $cont[1] );
|
||||
$lllang = $this->getDB()->addQuotes( $cont[1] );
|
||||
$this->addWhere(
|
||||
"ll_from > $llfrom OR " .
|
||||
"ll_from $op $llfrom OR " .
|
||||
"(ll_from = $llfrom AND " .
|
||||
"ll_lang >= '$lllang')"
|
||||
"ll_lang $op= $lllang)"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,15 +116,16 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
|
|||
$this->dieUsage( 'Invalid continue param. You should pass the ' .
|
||||
'original value returned by the previous query', '_badcontinue' );
|
||||
}
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
$plfrom = intval( $cont[0] );
|
||||
$plns = intval( $cont[1] );
|
||||
$pltitle = $this->getDB()->strencode( $this->titleToKey( $cont[2] ) );
|
||||
$pltitle = $this->getDB()->addQuotes( $this->titleToKey( $cont[2] ) );
|
||||
$this->addWhere(
|
||||
"{$this->prefix}_from > $plfrom OR " .
|
||||
"{$this->prefix}_from $op $plfrom OR " .
|
||||
"({$this->prefix}_from = $plfrom AND " .
|
||||
"({$this->prefix}_namespace > $plns OR " .
|
||||
"({$this->prefix}_namespace $op $plns OR " .
|
||||
"({$this->prefix}_namespace = $plns AND " .
|
||||
"{$this->prefix}_title >= '$pltitle')))"
|
||||
"{$this->prefix}_title $op= $pltitle)))"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue