26use InvalidArgumentException;
28use OutOfBoundsException;
81 $row = clone $slot->row;
84 foreach ( $overrides as $key =>
$value ) {
111 'slot_revision_id' =>
null,
130 Assert::parameterType(
'string', $role,
'$role' );
134 'slot_revision_id' =>
null,
135 'slot_origin' =>
null,
136 'content_size' =>
null,
137 'content_sha1' =>
null,
138 'slot_content_id' =>
null,
139 'content_address' =>
null,
140 'role_name' => $role,
170 Assert::parameterType(
'integer', $revisionId,
'$revisionId' );
172 Assert::parameterType(
'integer|null', $contentId,
'$contentId' );
173 Assert::parameterType(
'string', $contentAddress,
'$contentAddress' );
175 if ( $protoSlot->hasRevision() && $protoSlot->getRevision() !== $revisionId ) {
176 throw new LogicException(
177 "Mismatching revision ID $revisionId: "
178 .
"The slot already belongs to revision {$protoSlot->getRevision()}. "
179 .
"Use SlotRecord::newInherited() to re-use content between revisions."
183 if ( $protoSlot->hasAddress() && $protoSlot->getAddress() !== $contentAddress ) {
184 throw new LogicException(
185 "Mismatching blob address $contentAddress: "
186 .
"The slot already has content at {$protoSlot->getAddress()}."
190 if ( $protoSlot->hasContentId() && $protoSlot->getContentId() !== $contentId ) {
191 throw new LogicException(
192 "Mismatching content ID $contentId: "
193 .
"The slot already has content row {$protoSlot->getContentId()} associated."
197 if ( $protoSlot->isInherited() ) {
198 if ( !$protoSlot->hasAddress() ) {
199 throw new InvalidArgumentException(
200 "An inherited blob should have a content address!"
203 if ( !$protoSlot->hasField(
'slot_origin' ) ) {
204 throw new InvalidArgumentException(
205 "A saved inherited slot should have an origin set!"
208 $origin = $protoSlot->getOrigin();
214 'slot_revision_id' => $revisionId,
215 'slot_content_id' => $contentId,
216 'slot_origin' => $origin,
217 'content_address' => $contentAddress,
235 Assert::parameterType(
'object',
$row,
'$row' );
236 Assert::parameterType(
'Content|callable',
$content,
'$content' );
240 '$row->slot_revision_id',
245 '$row->slot_content_id',
250 '$row->content_address',
265 '$row->slot_inherited',
270 '$row->slot_revision',
284 throw new LogicException( __CLASS__ .
' is not serializable.' );
303 if ( $this->content instanceof
Content ) {
309 Assert::postcondition(
311 'Slot content callback should return a Content object'
314 $this->content =
$obj;
330 if ( !
isset( $this->row->$name ) ) {
335 throw new OutOfBoundsException(
'No such field: ' . $name );
339 $value = $this->row->$name;
381 if (
isset( $this->row->$name ) ) {
383 if ( !
is_string( $this->row->$name ) && is_callable( $this->row->$name ) ) {
388 return isset( $this->row->$name );
436 return $this->
hasField(
'content_address' );
447 return $this->
hasField(
'slot_origin' );
470 return $this->
hasField(
'slot_content_id' );
481 return $this->
hasField(
'slot_revision_id' );
527 $this->
setField(
'content_size', $size );
542 $format = $this->
hasField(
'format_name' )
548 $this->
setField(
'content_sha1', $sha1 );
566 $this->
setField(
'model_name', $model );
584 if ( $this->
hasField(
'format_name' ) ) {
596 $this->row->$name =
$value;
631 if ( $other === $this ) {
641 && $this->getAddress() == $other->getAddress()
663class_alias( SlotRecord::class,
'MediaWiki\Storage\SlotRecord' );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
Base interface for content objects.
getModel()
Returns the ID of the content model used by this Content object.
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))