return 0;
}
- $fname = get_class( $this ) . '::recache';
+ $fname = static::class . '::recache';
$dbw = wfGetDB( DB_MASTER );
if ( !$dbw ) {
return false;
* @since 1.18
*/
public function reallyDoQuery( $limit, $offset = false ) {
- $fname = get_class( $this ) . "::reallyDoQuery";
+ $fname = static::class . '::reallyDoQuery';
$dbr = $this->getRecacheDB();
$query = $this->getQueryInfo();
$order = $this->getOrderFields();
$options = isset( $query['options'] ) ? (array)$query['options'] : [];
$join_conds = isset( $query['join_conds'] ) ? (array)$query['join_conds'] : [];
- if ( $order ) {
+ if ( count( $order ) ) {
$options['ORDER BY'] = $order;
}
if ( $limit !== false ) {
$options['LIMIT'] = intval( $limit );
}
-
if ( $offset !== false ) {
$options['OFFSET'] = intval( $offset );
}
-
- $orderFields = $this->getOrderFields();
- $order = [];
- $DESC = $this->sortDescending() ? ' DESC' : '';
- foreach ( $orderFields as $field ) {
- $order[] = "qc_${field}${DESC}";
- }
- if ( $order ) {
- $options['ORDER BY'] = $order;
+ if ( $this->sortDescending() ) {
+ $options['ORDER BY'] = 'qc_value DESC';
+ } else {
+ $options['ORDER BY'] = 'qc_value ASC';
}
-
return $dbr->select( 'querycache', [ 'qc_type',
'namespace' => 'qc_namespace',
'title' => 'qc_title',
'value' => 'qc_value' ],
[ 'qc_type' => $this->getName() ],
- __METHOD__,
- $options
+ __METHOD__, $options
);
}
public function getCachedTimestamp() {
if ( is_null( $this->cachedTimestamp ) ) {
$dbr = wfGetDB( DB_REPLICA );
- $fname = get_class( $this ) . '::getCachedTimestamp';
+ $fname = static::class . '::getCachedTimestamp';
$this->cachedTimestamp = $dbr->selectField( 'querycache_info', 'qci_timestamp',
[ 'qci_type' => $this->getName() ], $fname );
}