X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FPageProps.php;h=d09e1fbf9dc5791ae5637a3ac9df548d7fb27ba4;hb=287bb1a064c48c8222a824452f1226e64816ffeb;hp=365438472280f92c34c5af1385d5fd1a3c928b6b;hpb=77579c6f1037daf2a053cab7ee51280f962f2e36;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/PageProps.php b/includes/PageProps.php index 3654384722..d09e1fbf9d 100644 --- a/includes/PageProps.php +++ b/includes/PageProps.php @@ -19,6 +19,7 @@ * * @file */ +use Wikimedia\ScopedCallback; /** * Gives access to properties of a page. @@ -84,6 +85,16 @@ class PageProps { $this->cache = new ProcessCacheLRU( self::CACHE_SIZE ); } + /** + * Ensure that cache has at least this size + * @param int $size + */ + public function ensureCacheSize( $size ) { + if ( $this->cache->getSize() < $size ) { + $this->cache->resize( $size ); + } + } + /** * Given one or more Titles and one or more names of properties, * returns an associative array mapping page ID to property value. @@ -92,7 +103,7 @@ class PageProps { * single Title is provided, it does not need to be passed in an array, * but an array will always be returned. If a single property name is * provided, it does not need to be passed in an array. In that case, - * an associtive array mapping page ID to property value will be + * an associative array mapping page ID to property value will be * returned; otherwise, an associative array mapping page ID to * an associative array mapping property name to property value will be * returned. An empty array will be returned if no matching properties @@ -130,7 +141,7 @@ class PageProps { } if ( $queryIDs ) { - $dbr = wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_REPLICA ); $result = $dbr->select( 'page_props', [ @@ -188,7 +199,7 @@ class PageProps { } if ( $queryIDs != [] ) { - $dbr = wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_REPLICA ); $result = $dbr->select( 'page_props', [