ParserOutput: point to documentation for serialization compatibility.
Any changes to the way ParserOutput is serialized must follow the instructions at <https://www.mediawiki.org/wiki/Manual:Parser_cache/Serialization_compatibility>. Change-Id: Ic16a6804ca0a65f8f9abbc3112359cc239febde3
This commit is contained in:
parent
e3a6741ec1
commit
f2febebb30
2 changed files with 12 additions and 0 deletions
|
|
@ -254,6 +254,9 @@ class CacheTime implements ParserCacheMetadata, JsonUnserializable {
|
|||
* @return array
|
||||
*/
|
||||
protected function toJsonArray(): array {
|
||||
// WARNING: When changing how this class is serialized, follow the instructions
|
||||
// at <https://www.mediawiki.org/wiki/Manual:Parser_cache/Serialization_compatibility>!
|
||||
|
||||
return [
|
||||
'ParseUsedOptions' => $this->mParseUsedOptions,
|
||||
'CacheExpiry' => $this->mCacheExpiry,
|
||||
|
|
@ -274,6 +277,9 @@ class CacheTime implements ParserCacheMetadata, JsonUnserializable {
|
|||
* @param array $jsonData
|
||||
*/
|
||||
protected function initFromJson( JsonUnserializer $unserializer, array $jsonData ) {
|
||||
// WARNING: When changing how this class is serialized, follow the instructions
|
||||
// at <https://www.mediawiki.org/wiki/Manual:Parser_cache/Serialization_compatibility>!
|
||||
|
||||
if ( array_key_exists( 'AccessedOptions', $jsonData ) ) {
|
||||
// Backwards compatibility for ParserOutput
|
||||
$this->mParseUsedOptions = $jsonData['AccessedOptions'] ?: [];
|
||||
|
|
|
|||
|
|
@ -2419,6 +2419,9 @@ class ParserOutput extends CacheTime implements ContentMetadataCollector {
|
|||
* @return array
|
||||
*/
|
||||
protected function toJsonArray(): array {
|
||||
// WARNING: When changing how this class is serialized, follow the instructions
|
||||
// at <https://www.mediawiki.org/wiki/Manual:Parser_cache/Serialization_compatibility>!
|
||||
|
||||
$data = [
|
||||
'Text' => $this->mText,
|
||||
'LanguageLinks' => $this->mLanguageLinks,
|
||||
|
|
@ -2493,6 +2496,9 @@ class ParserOutput extends CacheTime implements ContentMetadataCollector {
|
|||
protected function initFromJson( JsonUnserializer $unserializer, array $jsonData ): void {
|
||||
parent::initFromJson( $unserializer, $jsonData );
|
||||
|
||||
// WARNING: When changing how this class is serialized, follow the instructions
|
||||
// at <https://www.mediawiki.org/wiki/Manual:Parser_cache/Serialization_compatibility>!
|
||||
|
||||
$this->mText = $jsonData['Text'];
|
||||
$this->mLanguageLinks = $jsonData['LanguageLinks'];
|
||||
$this->mCategories = $jsonData['Categories'];
|
||||
|
|
|
|||
Loading…
Reference in a new issue