MediaWiki 1.42.0-rc.0
SerializedValueContainer.php
Go to the documentation of this file.
1<?php
2
9 private const SCHEMA = '__svc_schema__';
10 // 64 bit UID
11 private const SCHEMA_UNIFIED = 'DAAIDgoKAQw';
12 // 64 bit UID
13 private const SCHEMA_SEGMENTED = 'CAYCDAgCDw4';
14
18 public const UNIFIED_DATA = '__data__';
19 public const SEGMENTED_HASHES = '__hashes__';
20
25 public static function newSegmented( array $segmentHashList ) {
26 return (object)[
27 self::SCHEMA => self::SCHEMA_SEGMENTED,
28 self::SEGMENTED_HASHES => $segmentHashList
29 ];
30 }
31
37 public static function isUnified( $value ) {
38 wfDeprecated( __METHOD__, '1.42' );
39 return (
40 $value instanceof stdClass &&
41 ( $value->{self::SCHEMA} ?? null ) === self::SCHEMA_UNIFIED
42 );
43 }
44
49 public static function isSegmented( $value ) {
50 return (
51 $value instanceof stdClass &&
52 ( $value->{self::SCHEMA} ?? null ) === self::SCHEMA_SEGMENTED
53 );
54 }
55}
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
Helper class for segmenting large cache values without relying on serializing classes.
static newSegmented(array $segmentHashList)