Go to the documentation of this file.
26 use InvalidArgumentException;
28 use OutOfBoundsException;
29 use Wikimedia\Assert\Assert;
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' );
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."
184 throw new LogicException(
185 "Mismatching blob address $contentAddress: "
186 .
"The slot already has content at {$protoSlot->getAddress()}."
191 throw new LogicException(
192 "Mismatching content ID $contentId: "
193 .
"The slot already has content row {$protoSlot->getContentId()} associated."
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!"
210 $origin = $revisionId;
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' );
239 property_exists(
$row,
'slot_revision_id' ),
240 '$row->slot_revision_id',
244 property_exists(
$row,
'slot_content_id' ),
245 '$row->slot_content_id',
249 property_exists(
$row,
'content_address' ),
250 '$row->content_address',
254 property_exists(
$row,
'model_name' ),
259 property_exists(
$row,
'slot_origin' ),
264 !property_exists(
$row,
'slot_inherited' ),
265 '$row->slot_inherited',
269 !property_exists(
$row,
'slot_revision' ),
270 '$row->slot_revision',
284 throw new LogicException( __CLASS__ .
' is not serializable.' );
307 $obj = call_user_func( $this->
content, $this );
309 Assert::postcondition(
311 'Slot content callback should return a Content object'
330 if ( !isset( $this->row->$name ) ) {
332 if ( property_exists( $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;
608 return \Wikimedia\base_convert( sha1(
$blob ), 16, 36, 31 );
631 if ( $other === $this ) {
per default it will return the text for text based content
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
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))
Allows to change the fields on the form that will be generated $name
Base interface for content objects.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getModel()
Returns the ID of the content model used by this Content object.
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class