* @return IDatabase
*/
function getRecacheDB() {
- return wfGetDB( DB_SLAVE, [ $this->getName(), 'QueryPage::recache', 'vslow' ] );
+ return wfGetDB( DB_REPLICA, [ $this->getName(), 'QueryPage::recache', 'vslow' ] );
}
/**
* @since 1.18
*/
public function fetchFromCache( $limit, $offset = false ) {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$options = [];
if ( $limit !== false ) {
$options['LIMIT'] = intval( $limit );
public function getCachedTimestamp() {
if ( is_null( $this->cachedTimestamp ) ) {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$fname = get_class( $this ) . '::getCachedTimestamp';
$this->cachedTimestamp = $dbr->selectField( 'querycache_info', 'qci_timestamp',
[ 'qci_type' => $this->getName() ], $fname );
function feedUrl() {
return $this->getPageTitle()->getFullURL();
}
+
+ /**
+ * Creates a new LinkBatch object, adds all pages from the passed ResultWrapper (MUST include
+ * title and optional the namespace field) and executes the batch. This operation will pre-cache
+ * LinkCache information like page existence and information for stub color and redirect hints.
+ *
+ * @param ResultWrapper $res The ResultWrapper object to process. Needs to include the title
+ * field and namespace field, if the $ns parameter isn't set.
+ * @param null $ns Use this namespace for the given titles in the ResultWrapper object,
+ * instead of the namespace value of $res.
+ */
+ protected function executeLBFromResultWrapper( ResultWrapper $res, $ns = null ) {
+ if ( !$res->numRows() ) {
+ return;
+ }
+
+ $batch = new LinkBatch;
+ foreach ( $res as $row ) {
+ $batch->add( $ns !== null ? $ns : $row->namespace, $row->title );
+ }
+ $batch->execute();
+
+ $res->seek( 0 );
+ }
}