Index: trunk/phase3/includes/objectcache/XCacheBagOStuff.php |
— | — | @@ -8,12 +8,27 @@ |
9 | 9 | */ |
10 | 10 | class XCacheBagOStuff extends BagOStuff { |
11 | 11 | /** |
| 12 | + * Are we operating in CLI mode? Since xcache doesn't work then and they |
| 13 | + * don't want to change that |
| 14 | + * @see bug 28752 |
| 15 | + * @var bool |
| 16 | + */ |
| 17 | + private $isCli = false; |
| 18 | + |
| 19 | + public function __construct() { |
| 20 | + $this->isCli = php_sapi_name() == 'cli'; |
| 21 | + } |
| 22 | + |
| 23 | + /** |
12 | 24 | * Get a value from the XCache object cache |
13 | 25 | * |
14 | 26 | * @param $key String: cache key |
15 | 27 | * @return mixed |
16 | 28 | */ |
17 | 29 | public function get( $key ) { |
| 30 | + if( $this->isCli ) { |
| 31 | + return false; |
| 32 | + } |
18 | 33 | $val = xcache_get( $key ); |
19 | 34 | |
20 | 35 | if ( is_string( $val ) ) { |
— | — | @@ -32,8 +47,9 @@ |
33 | 48 | * @return bool |
34 | 49 | */ |
35 | 50 | public function set( $key, $value, $expire = 0 ) { |
36 | | - xcache_set( $key, serialize( $value ), $expire ); |
37 | | - |
| 51 | + if( !$this->isCli ) { |
| 52 | + xcache_set( $key, serialize( $value ), $expire ); |
| 53 | + } |
38 | 54 | return true; |
39 | 55 | } |
40 | 56 | |
— | — | @@ -45,8 +61,9 @@ |
46 | 62 | * @return bool |
47 | 63 | */ |
48 | 64 | public function delete( $key, $time = 0 ) { |
49 | | - xcache_unset( $key ); |
50 | | - |
| 65 | + if( !$this->isCli ) { |
| 66 | + xcache_unset( $key ); |
| 67 | + } |
51 | 68 | return true; |
52 | 69 | } |
53 | 70 | } |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -255,6 +255,7 @@ |
256 | 256 | left-to-right. |
257 | 257 | * (bug 28719) Do not call mLinkHolders __destruct explicitly |
258 | 258 | * (bug 21196) Article::getContributors() no longer fail on PostgreSQL. |
| 259 | +* (bug 28752) XCache doesn't work in CLI mode. |
259 | 260 | |
260 | 261 | === API changes in 1.18 === |
261 | 262 | * (bug 26339) Throw warning when truncating an overlarge API result. |