27use Wikimedia\Assert\Assert;
45 Assert::parameterType(
'array|callable',
$slots,
'$slots' );
47 if ( is_callable(
$slots ) ) {
58 Assert::parameterElementType( SlotRecord::class,
$slots,
'$slots' );
63 foreach (
$slots as $slot ) {
64 $role = $slot->getRole();
65 $this->slots[$role] = $slot;
75 throw new LogicException( __CLASS__ .
' is not serializable.' );
93 return $this->
getSlot( $role )->getContent()->copy();
109 if ( isset(
$slots[$role] ) ) {
126 return isset(
$slots[$role] );
137 return array_keys(
$slots );
150 return $accu + $slot->
getSize();
164 if ( is_callable( $this->slots ) ) {
165 $slots = call_user_func( $this->slots );
167 Assert::postcondition(
169 'Slots info callback should return an array of objects'
199 return $accu ===
null
249 if ( $other === $this ) {
254 $bSlots = $other->getSlots();
259 if ( array_keys( $aSlots ) !== array_keys( $bSlots ) ) {
263 foreach ( $aSlots as $role =>
$s ) {
266 if ( !
$s->hasSameContent(
$t ) ) {
284 if ( $other === $this ) {
289 $bSlots = $other->getSlots();
294 $different = array_keys( array_merge(
295 array_diff_key( $aSlots, $bSlots ),
296 array_diff_key( $bSlots, $aSlots )
300 $common = array_intersect_key( $aSlots, $bSlots );
302 foreach ( $common as $role =>
$s ) {
305 if ( !
$s->hasSameContent(
$t ) ) {
306 $different[] = $role;
319class_alias( RevisionSlots::class,
'MediaWiki\Storage\RevisionSlots' );
Base interface for content objects.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))