diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
commit | 6dc1997577fab2c366781fd7048144935afa0012 (patch) | |
tree | 8918d28c7ab4342f0738985e37af1dfc42d0e93a /includes/objectcache/MemcachedClient.php | |
parent | 150f94f051128f367bc89f6b7e5f57eb2a69fc62 (diff) | |
parent | fa89acd685cb09cdbe1c64cbb721ec64975bbbc1 (diff) |
Merge commit 'fa89acd'
# Conflicts:
# .gitignore
# extensions/ArchInterWiki.sql
Diffstat (limited to 'includes/objectcache/MemcachedClient.php')
-rw-r--r-- | includes/objectcache/MemcachedClient.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/includes/objectcache/MemcachedClient.php b/includes/objectcache/MemcachedClient.php index bc4a00b2..5010b899 100644 --- a/includes/objectcache/MemcachedClient.php +++ b/includes/objectcache/MemcachedClient.php @@ -94,6 +94,11 @@ class MWMemcached { */ const COMPRESSED = 2; + /** + * Flag: indicates data is an integer + */ + const INTVAL = 4; + // }}} /** @@ -745,13 +750,13 @@ class MWMemcached { $timeout = $this->_connect_timeout; $errno = $errstr = null; for ( $i = 0; !$sock && $i < $this->_connect_attempts; $i++ ) { - wfSuppressWarnings(); + MediaWiki\suppressWarnings(); if ( $this->_persistent == 1 ) { $sock = pfsockopen( $ip, $port, $errno, $errstr, $timeout ); } else { $sock = fsockopen( $ip, $port, $errno, $errstr, $timeout ); } - wfRestoreWarnings(); + MediaWiki\restoreWarnings(); } if ( !$sock ) { $this->_error_log( "Error connecting to $host: $errstr\n" ); @@ -979,6 +984,8 @@ class MWMemcached { */ if ( $flags & self::SERIALIZED ) { $ret[$rkey] = unserialize( $ret[$rkey] ); + } elseif ( $flags & self::INTVAL ) { + $ret[$rkey] = intval( $ret[$rkey] ); } } @@ -1027,7 +1034,9 @@ class MWMemcached { $flags = 0; - if ( !is_scalar( $val ) ) { + if ( is_int( $val ) ) { + $flags |= self::INTVAL; + } elseif ( !is_scalar( $val ) ) { $val = serialize( $val ); $flags |= self::SERIALIZED; if ( $this->_debug ) { |