Follow-up r66364: wincache fixes
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Mon, 13 Dec 2010 20:04:06 +0000 (20:04 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Mon, 13 Dec 2010 20:04:06 +0000 (20:04 +0000)
* Return the result of wincache_ucache_get() in get()
* In command line mode $info['ucache_entries'] returned from wincache_ucache_info() is null, so don't iterate over a non-array

includes/BagOStuff.php

index 70a87a7..6b93301 100644 (file)
@@ -863,9 +863,11 @@ class WinCacheBagOStuff extends BagOStuff {
         * @return bool
         */
        public function set( $key, $value, $expire = 0 ) {
-               wincache_ucache_set( $key, serialize( $value ), $expire );
+               $result = wincache_ucache_set( $key, serialize( $value ), $expire );
 
-               return true;
+               /* wincache_ucache_set returns an empty array on success if $value
+                  was an array, bool otherwise */
+               return ( is_array( $value ) && $result === array() ) || $result;
        }
 
        /**
@@ -886,6 +888,10 @@ class WinCacheBagOStuff extends BagOStuff {
                $list = $info['ucache_entries'];
                $keys = array();
 
+               if ( is_null( $list ) ) {
+                       return array();
+               }
+
                foreach ( $list as $entry ) {
                        $keys[] = $entry['key_name'];
                }