4use InvalidArgumentException;
29 $row->rev_content_format = (
string)
$rev->getContentFormat();
30 $row->rev_content_model = (
string)
$rev->getContentModel();
40 [
'slot_revision_id' => $rev->
getId() ],
47 [
'content_address' => $rev->
getSlot(
'main' )->getAddress() ],
53 [
'revision',
'text' ],
55 [
'rev_id' => $rev->
getId(),
'rev_text_id > 0' ],
58 [
'text' => [
'INNER JOIN', [
'rev_text_id = old_id' ] ] ]
61 parent::assertRevisionExistsInDatabase(
$rev );
69 parent::assertSameSlotContent( $a, $b );
72 if ( $a->hasContentId() && $b->hasContentId() ) {
73 $this->assertSame( $a->getContentId(), $b->getContentId() );
78 foreach ( parent::provideInsertRevisionOn_failures() as $case ) {
82 yield
'slot that is not main slot' => [
89 'timestamp' =>
'20171117010101',
92 new InvalidArgumentException(
'Only the main slot is supported' )
97 foreach ( parent::provideNewMutableRevisionFromArray() as $case ) {
101 yield
'Basic array, with page & id' => [
106 'timestamp' =>
'20171017114835',
107 'user_text' =>
'111.0.1.2',
109 'minor_edit' =>
false,
113 'sha1' =>
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
114 'comment' =>
'Goat Comment!',
115 'content_format' =>
'text/x-wiki',
116 'content_model' =>
'wikitext',
135 [
'old_text' =>
'Just a test',
'old_flags' =>
'utf-8' ],
139 $textId = $this->db->insertId();
142 'ar_minor_edit' =>
'0',
144 'ar_user_text' =>
'127.0.0.1',
148 'ar_rev_id' => 112277,
149 'ar_timestamp' => $this->db->timestamp(
'20180101000000' ),
150 'ar_sha1' =>
'deadbeef',
151 'ar_page_id' => $title->getArticleID(),
152 'ar_comment_text' =>
'just a test',
153 'ar_comment_data' =>
null,
154 'ar_comment_cid' =>
null,
155 'ar_content_format' =>
null,
156 'ar_content_model' =>
null,
159 'ar_namespace' => $title->getNamespace(),
160 'ar_title' => $title->getDBkey(),
161 'ar_text_id' => $textId,
162 'ar_parent_id' => 112211,
166 $rev = $store->newRevisionFromArchiveRow( $row );
169 $return = $store->insertRevisionOn(
$rev, $this->db );
176 $loaded = $store->getRevisionById( $return->getId() );
177 $this->assertNotNull( $loaded );
Content object for wiki text pages.
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest object