Merge "installer: Avoid <doclink/> hack for 'config-sidebar' rendering"
[lhc/web/wiklou.git] / includes / libs / objectcache / BagOStuff.php
index 50441c5..00bf57d 100644 (file)
@@ -61,7 +61,7 @@ use Wikimedia\WaitConditionLoop;
  *
  * @ingroup Cache
  */
-abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface {
+abstract class BagOStuff implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInterface {
        /** @var array[] Lock tracking */
        protected $locks = [];
        /** @var int ERR_* class constant */
@@ -590,7 +590,11 @@ abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface {
         * @return bool Success
         */
        public function unlock( $key ) {
-               if ( isset( $this->locks[$key] ) && --$this->locks[$key]['depth'] <= 0 ) {
+               if ( !isset( $this->locks[$key] ) ) {
+                       return false;
+               }
+
+               if ( --$this->locks[$key]['depth'] <= 0 ) {
                        unset( $this->locks[$key] );
 
                        $ok = $this->doDelete( "{$key}:lock" );
@@ -651,11 +655,12 @@ abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface {
         * @param string $date The reference date in MW format
         * @param callable|bool $progressCallback Optional, a function which will be called
         *     regularly during long-running operations with the percentage progress
-        *     as the first parameter.
+        *     as the first parameter. [optional]
+        * @param int $limit Maximum number of keys to delete [default: INF]
         *
         * @return bool Success, false if unimplemented
         */
-       public function deleteObjectsExpiringBefore( $date, $progressCallback = false ) {
+       public function deleteObjectsExpiringBefore( $date, $progressCallback = false, $limit = INF ) {
                // stub
                return false;
        }