Merge "Follow-up Id0021594: Remove extra code for redlink suggestions"
[lhc/web/wiklou.git] / includes / utils / UIDGenerator.php
index abba5a1..1fd830e 100644 (file)
@@ -21,6 +21,7 @@
  * @author Aaron Schulz
  */
 use Wikimedia\Assert\Assert;
+use MediaWiki\MediaWikiServices;
 
 /**
  * Class for getting statistically unique IDs
@@ -368,7 +369,7 @@ class UIDGenerator {
                // Counter values would not survive accross script instances in CLI mode.
                $cache = null;
                if ( ( $flags & self::QUICK_VOLATILE ) && PHP_SAPI !== 'cli' ) {
-                       $cache = ObjectCache::getLocalServerInstance();
+                       $cache = MediaWikiServices::getInstance()->getLocalServerObjectCache();
                }
                if ( $cache ) {
                        $counter = $cache->incrWithInit( $bucket, $cache::TTL_INDEFINITE, $count, $count );
@@ -553,9 +554,9 @@ class UIDGenerator {
                        $ts = ( 1000 * $sec + $msec ) * 10000 + (int)$offset + $delta;
                        $id_bin = str_pad( decbin( $ts % pow( 2, 60 ) ), 60, '0', STR_PAD_LEFT );
                } elseif ( extension_loaded( 'gmp' ) ) {
-                       $ts = gmp_add( gmp_mul( (string) $sec, '1000' ), (string) $msec ); // ms
+                       $ts = gmp_add( gmp_mul( (string)$sec, '1000' ), (string)$msec ); // ms
                        $ts = gmp_add( gmp_mul( $ts, '10000' ), $offset ); // 100ns intervals
-                       $ts = gmp_add( $ts, (string) $delta );
+                       $ts = gmp_add( $ts, (string)$delta );
                        $ts = gmp_mod( $ts, gmp_pow( '2', '60' ) ); // wrap around
                        $id_bin = str_pad( gmp_strval( $ts, 2 ), 60, '0', STR_PAD_LEFT );
                } elseif ( extension_loaded( 'bcmath' ) ) {