MediaWiki REL1_31
|
Value object representing the set of slots belonging to a revision. More...
Public Member Functions | |
__construct ( $slots) | |
__sleep () | |
Implemented to defy serialization. | |
computeSha1 () | |
Computes the combined hash of the revisions's slots. | |
computeSize () | |
Computes the total nominal size of the revision's slots, in bogo-bytes. | |
getContent ( $role) | |
Returns the Content of the given slot. | |
getSlot ( $role) | |
Returns the SlotRecord of the given slot. | |
getSlotRoles () | |
Returns the slot names (roles) of all slots present in this revision. | |
getSlots () | |
Returns an associative array that maps role names to SlotRecords. | |
hasSlot ( $role) | |
Returns whether the given slot is set. | |
Protected Attributes | |
SlotRecord[] callable | $slots |
Private Member Functions | |
setSlotsInternal (array $slots) | |
Value object representing the set of slots belonging to a revision.
Definition at line 34 of file RevisionSlots.php.
MediaWiki\Storage\RevisionSlots::__construct | ( | $slots | ) |
SlotRecord[] | callable | $slots | SlotRecords, or a callback that returns such a structure. |
Definition at line 43 of file RevisionSlots.php.
References MediaWiki\Storage\RevisionSlots\$slots, and MediaWiki\Storage\RevisionSlots\setSlotsInternal().
MediaWiki\Storage\RevisionSlots::__sleep | ( | ) |
Implemented to defy serialization.
LogicException | always |
Definition at line 71 of file RevisionSlots.php.
MediaWiki\Storage\RevisionSlots::computeSha1 | ( | ) |
Computes the combined hash of the revisions's slots.
@warn This is potentially expensive! It may cause all slot's content to be loaded and deserialized, then re-serialized and hashed.
Definition at line 187 of file RevisionSlots.php.
References MediaWiki\Storage\RevisionSlots\$slots, MediaWiki\Storage\SlotRecord\base36Sha1(), MediaWiki\Storage\SlotRecord\getSha1(), and MediaWiki\Storage\RevisionSlots\getSlots().
Referenced by MediaWiki\Tests\Storage\RevisionArchiveRecordTest\testConstructorAndGetters(), and MediaWiki\Tests\Storage\RevisionStoreRecordTest\testConstructorAndGetters().
MediaWiki\Storage\RevisionSlots::computeSize | ( | ) |
Computes the total nominal size of the revision's slots, in bogo-bytes.
@warn This is potentially expensive! It may cause all slot's content to be loaded and deserialized.
Definition at line 145 of file RevisionSlots.php.
References MediaWiki\Storage\SlotRecord\getSize(), and MediaWiki\Storage\RevisionSlots\getSlots().
Referenced by MediaWiki\Tests\Storage\RevisionArchiveRecordTest\testConstructorAndGetters(), and MediaWiki\Tests\Storage\RevisionStoreRecordTest\testConstructorAndGetters().
MediaWiki\Storage\RevisionSlots::getContent | ( | $role | ) |
Returns the Content of the given slot.
Call getSlotNames() to get a list of available slots.
Note that for mutable Content objects, each call to this method will return a fresh clone.
string | $role | The role name of the desired slot |
RevisionAccessException | if the slot does not exist or slot data could not be lazy-loaded. |
Definition at line 88 of file RevisionSlots.php.
References MediaWiki\Storage\RevisionSlots\getSlot().
MediaWiki\Storage\RevisionSlots::getSlot | ( | $role | ) |
Returns the SlotRecord of the given slot.
Call getSlotNames() to get a list of available slots.
string | $role | The role name of the desired slot |
RevisionAccessException | if the slot does not exist or slot data could not be lazy-loaded. |
Definition at line 103 of file RevisionSlots.php.
References MediaWiki\Storage\RevisionSlots\$slots, and MediaWiki\Storage\RevisionSlots\getSlots().
Referenced by MediaWiki\Storage\RevisionSlots\getContent().
MediaWiki\Storage\RevisionSlots::getSlotRoles | ( | ) |
Returns the slot names (roles) of all slots present in this revision.
getContent() will succeed only for the names returned by this method.
Definition at line 132 of file RevisionSlots.php.
References MediaWiki\Storage\RevisionSlots\$slots, and MediaWiki\Storage\RevisionSlots\getSlots().
Referenced by MediaWiki\Tests\Storage\RevisionArchiveRecordTest\testConstructorAndGetters(), and MediaWiki\Tests\Storage\RevisionStoreRecordTest\testConstructorAndGetters().
MediaWiki\Storage\RevisionSlots::getSlots | ( | ) |
Returns an associative array that maps role names to SlotRecords.
Each SlotRecord represents the content meta-data of a slot, together they define the content of a revision.
Definition at line 160 of file RevisionSlots.php.
References MediaWiki\Storage\RevisionSlots\$slots, and MediaWiki\Storage\RevisionSlots\setSlotsInternal().
Referenced by MediaWiki\Storage\RevisionSlots\computeSha1(), MediaWiki\Storage\RevisionSlots\computeSize(), MediaWiki\Storage\MutableRevisionSlots\getInheritedSlots(), MediaWiki\Storage\RevisionSlots\getSlot(), MediaWiki\Storage\RevisionSlots\getSlotRoles(), MediaWiki\Storage\MutableRevisionSlots\getTouchedSlots(), MediaWiki\Storage\RevisionSlots\hasSlot(), MediaWiki\Storage\MutableRevisionSlots\removeSlot(), and MediaWiki\Storage\MutableRevisionSlots\setSlot().
MediaWiki\Storage\RevisionSlots::hasSlot | ( | $role | ) |
Returns whether the given slot is set.
string | $role | The role name of the desired slot |
Definition at line 120 of file RevisionSlots.php.
References MediaWiki\Storage\RevisionSlots\$slots, and MediaWiki\Storage\RevisionSlots\getSlots().
|
private |
SlotRecord[] | $slots |
Definition at line 56 of file RevisionSlots.php.
References MediaWiki\Storage\RevisionSlots\$slots.
Referenced by MediaWiki\Storage\RevisionSlots\__construct(), and MediaWiki\Storage\RevisionSlots\getSlots().
|
protected |
Definition at line 37 of file RevisionSlots.php.
Referenced by MediaWiki\Storage\RevisionSlots\__construct(), MediaWiki\Storage\MutableRevisionSlots\__construct(), MediaWiki\Storage\RevisionSlots\computeSha1(), MediaWiki\Storage\RevisionSlots\getSlot(), MediaWiki\Storage\RevisionSlots\getSlotRoles(), MediaWiki\Storage\RevisionSlots\getSlots(), MediaWiki\Storage\RevisionSlots\hasSlot(), MediaWiki\Storage\MutableRevisionSlots\newFromParentRevisionSlots(), and MediaWiki\Storage\RevisionSlots\setSlotsInternal().