Fix usage of scroll and order in the same query (#88)

This commit is contained in:
Universal Omega 2022-02-06 16:27:50 -07:00 committed by GitHub
parent ce64f763a3
commit a0a2b862bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2052,23 +2052,25 @@ class Query {
* @param mixed $option
*/
private function _titlegt( $option ) {
$where = '(';
if ( substr( $option, 0, 2 ) == '=_' ) {
if ( $this->parameters->getParameter( 'openreferences' ) ) {
$where .= 'pl_title >= ' . $this->DB->addQuotes( substr( $option, 2 ) );
} else {
$where .= $this->tableNames['page'] . '.page_title >= ' . $this->DB->addQuotes( substr( $option, 2 ) );
}
} else {
if ( $this->parameters->getParameter( 'openreferences' ) ) {
$where .= 'pl_title > ' . $this->DB->addQuotes( $option );
} else {
$where .= $this->tableNames['page'] . '.page_title > ' . $this->DB->addQuotes( $option );
}
$operator = '>';
if ( substr( $option, 0, 2 ) === '=_' ) {
$option = substr( $option, 2 );
$operator = '>=';
}
if ( $option === '' ) {
$operator = 'LIKE';
$option = '%';
} else {
$option = $this->DB->addQuotes( $option );
}
if ( $this->parameters->getParameter( 'openreferences' ) ) {
$where = "(pl_title {$operator} {$option})";
} else {
$where = "({$this->tableNames['page']}.page_title {$operator} {$option})";
}
$where .= ')';
$this->addWhere( $where );
}
@ -2078,23 +2080,25 @@ class Query {
* @param mixed $option
*/
private function _titlelt( $option ) {
$where = '(';
if ( substr( $option, 0, 2 ) == '=_' ) {
if ( $this->parameters->getParameter( 'openreferences' ) ) {
$where .= 'pl_title <= ' . $this->DB->addQuotes( substr( $option, 2 ) );
} else {
$where .= $this->tableNames['page'] . '.page_title <= ' . $this->DB->addQuotes( substr( $option, 2 ) );
}
} else {
if ( $this->parameters->getParameter( 'openreferences' ) ) {
$where .= 'pl_title < ' . $this->DB->addQuotes( $option );
} else {
$where .= $this->tableNames['page'] . '.page_title < ' . $this->DB->addQuotes( $option );
}
$operator = '<';
if ( substr( $option, 0, 2 ) === '=_' ) {
$option = substr( $option, 2 );
$operator = '<=';
}
if ( $option === '' ) {
$operator = 'LIKE';
$option = '%';
} else {
$option = $this->DB->addQuotes( $option );
}
if ( $this->parameters->getParameter( 'openreferences' ) ) {
$where = "(pl_title {$operator} {$option})";
} else {
$where = "({$this->tableNames['page']}.page_title {$operator} {$option})";
}
$where .= ')';
$this->addWhere( $where );
}