MediaWiki REL1_28
MovePage.php
Go to the documentation of this file.
1<?php
2
23
30class MovePage {
31
35 protected $oldTitle;
36
40 protected $newTitle;
41
43 $this->oldTitle = $oldTitle;
44 $this->newTitle = $newTitle;
45 }
46
47 public function checkPermissions( User $user, $reason ) {
48 $status = new Status();
49
50 $errors = wfMergeErrorArrays(
51 $this->oldTitle->getUserPermissionsErrors( 'move', $user ),
52 $this->oldTitle->getUserPermissionsErrors( 'edit', $user ),
53 $this->newTitle->getUserPermissionsErrors( 'move-target', $user ),
54 $this->newTitle->getUserPermissionsErrors( 'edit', $user )
55 );
56
57 // Convert into a Status object
58 if ( $errors ) {
59 foreach ( $errors as $error ) {
60 call_user_func_array( [ $status, 'fatal' ], $error );
61 }
62 }
63
64 if ( EditPage::matchSummarySpamRegex( $reason ) !== false ) {
65 // This is kind of lame, won't display nice
66 $status->fatal( 'spamprotectiontext' );
67 }
68
69 $tp = $this->newTitle->getTitleProtection();
70 if ( $tp !== false && !$user->isAllowed( $tp['permission'] ) ) {
71 $status->fatal( 'cantmove-titleprotected' );
72 }
73
74 Hooks::run( 'MovePageCheckPermissions',
75 [ $this->oldTitle, $this->newTitle, $user, $reason, $status ]
76 );
77
78 return $status;
79 }
80
88 public function isValidMove() {
90 $status = new Status();
91
92 if ( $this->oldTitle->equals( $this->newTitle ) ) {
93 $status->fatal( 'selfmove' );
94 }
95 if ( !$this->oldTitle->isMovable() ) {
96 $status->fatal( 'immobile-source-namespace', $this->oldTitle->getNsText() );
97 }
98 if ( $this->newTitle->isExternal() ) {
99 $status->fatal( 'immobile-target-namespace-iw' );
100 }
101 if ( !$this->newTitle->isMovable() ) {
102 $status->fatal( 'immobile-target-namespace', $this->newTitle->getNsText() );
103 }
104
105 $oldid = $this->oldTitle->getArticleID();
106
107 if ( strlen( $this->newTitle->getDBkey() ) < 1 ) {
108 $status->fatal( 'articleexists' );
109 }
110 if (
111 ( $this->oldTitle->getDBkey() == '' ) ||
112 ( !$oldid ) ||
113 ( $this->newTitle->getDBkey() == '' )
114 ) {
115 $status->fatal( 'badarticleerror' );
116 }
117
118 # The move is allowed only if (1) the target doesn't exist, or
119 # (2) the target is a redirect to the source, and has no history
120 # (so we can undo bad moves right after they're done).
121 if ( $this->newTitle->getArticleID() && !$this->isValidMoveTarget() ) {
122 $status->fatal( 'articleexists' );
123 }
124
125 // Content model checks
127 $this->oldTitle->getContentModel() !== $this->newTitle->getContentModel() ) {
128 // can't move a page if that would change the page's content model
129 $status->fatal(
130 'bad-target-model',
131 ContentHandler::getLocalizedName( $this->oldTitle->getContentModel() ),
132 ContentHandler::getLocalizedName( $this->newTitle->getContentModel() )
133 );
134 } elseif (
135 !ContentHandler::getForTitle( $this->oldTitle )->canBeUsedOn( $this->newTitle )
136 ) {
137 $status->fatal(
138 'content-not-allowed-here',
139 ContentHandler::getLocalizedName( $this->oldTitle->getContentModel() ),
140 $this->newTitle->getPrefixedText()
141 );
142 }
143
144 // Image-specific checks
145 if ( $this->oldTitle->inNamespace( NS_FILE ) ) {
146 $status->merge( $this->isValidFileMove() );
147 }
148
149 if ( $this->newTitle->inNamespace( NS_FILE ) && !$this->oldTitle->inNamespace( NS_FILE ) ) {
150 $status->fatal( 'nonfile-cannot-move-to-file' );
151 }
152
153 // Hook for extensions to say a title can't be moved for technical reasons
154 Hooks::run( 'MovePageIsValidMove', [ $this->oldTitle, $this->newTitle, $status ] );
155
156 return $status;
157 }
158
164 protected function isValidFileMove() {
165 $status = new Status();
166 $file = wfLocalFile( $this->oldTitle );
167 $file->load( File::READ_LATEST );
168 if ( $file->exists() ) {
169 if ( $this->newTitle->getText() != wfStripIllegalFilenameChars( $this->newTitle->getText() ) ) {
170 $status->fatal( 'imageinvalidfilename' );
171 }
172 if ( !File::checkExtensionCompatibility( $file, $this->newTitle->getDBkey() ) ) {
173 $status->fatal( 'imagetypemismatch' );
174 }
175 }
176
177 if ( !$this->newTitle->inNamespace( NS_FILE ) ) {
178 $status->fatal( 'imagenocrossnamespace' );
179 }
180
181 return $status;
182 }
183
191 protected function isValidMoveTarget() {
192 # Is it an existing file?
193 if ( $this->newTitle->inNamespace( NS_FILE ) ) {
194 $file = wfLocalFile( $this->newTitle );
195 $file->load( File::READ_LATEST );
196 if ( $file->exists() ) {
197 wfDebug( __METHOD__ . ": file exists\n" );
198 return false;
199 }
200 }
201 # Is it a redirect with no history?
202 if ( !$this->newTitle->isSingleRevRedirect() ) {
203 wfDebug( __METHOD__ . ": not a one-rev redirect\n" );
204 return false;
205 }
206 # Get the article text
207 $rev = Revision::newFromTitle( $this->newTitle, false, Revision::READ_LATEST );
208 if ( !is_object( $rev ) ) {
209 return false;
210 }
211 $content = $rev->getContent();
212 # Does the redirect point to the source?
213 # Or is it a broken self-redirect, usually caused by namespace collisions?
214 $redirTitle = $content ? $content->getRedirectTarget() : null;
215
216 if ( $redirTitle ) {
217 if ( $redirTitle->getPrefixedDBkey() !== $this->oldTitle->getPrefixedDBkey() &&
218 $redirTitle->getPrefixedDBkey() !== $this->newTitle->getPrefixedDBkey() ) {
219 wfDebug( __METHOD__ . ": redirect points to other page\n" );
220 return false;
221 } else {
222 return true;
223 }
224 } else {
225 # Fail safe (not a redirect after all. strange.)
226 wfDebug( __METHOD__ . ": failsafe: database says " . $this->newTitle->getPrefixedDBkey() .
227 " is a redirect, but it doesn't contain a valid redirect.\n" );
228 return false;
229 }
230 }
231
238 public function move( User $user, $reason, $createRedirect ) {
240
241 Hooks::run( 'TitleMove', [ $this->oldTitle, $this->newTitle, $user ] );
242
243 // If it is a file, move it first.
244 // It is done before all other moving stuff is done because it's hard to revert.
245 $dbw = wfGetDB( DB_MASTER );
246 if ( $this->oldTitle->getNamespace() == NS_FILE ) {
247 $file = wfLocalFile( $this->oldTitle );
248 $file->load( File::READ_LATEST );
249 if ( $file->exists() ) {
250 $status = $file->move( $this->newTitle );
251 if ( !$status->isOK() ) {
252 return $status;
253 }
254 }
255 // Clear RepoGroup process cache
256 RepoGroup::singleton()->clearCache( $this->oldTitle );
257 RepoGroup::singleton()->clearCache( $this->newTitle ); # clear false negative cache
258 }
259
260 $dbw->startAtomic( __METHOD__ );
261
262 Hooks::run( 'TitleMoveStarting', [ $this->oldTitle, $this->newTitle, $user ] );
263
264 $pageid = $this->oldTitle->getArticleID( Title::GAID_FOR_UPDATE );
265 $protected = $this->oldTitle->isProtected();
266
267 // Do the actual move; if this fails, it will throw an MWException(!)
268 $nullRevision = $this->moveToInternal( $user, $this->newTitle, $reason, $createRedirect );
269
270 // Refresh the sortkey for this row. Be careful to avoid resetting
271 // cl_timestamp, which may disturb time-based lists on some sites.
272 // @todo This block should be killed, it's duplicating code
273 // from LinksUpdate::getCategoryInsertions() and friends.
274 $prefixes = $dbw->select(
275 'categorylinks',
276 [ 'cl_sortkey_prefix', 'cl_to' ],
277 [ 'cl_from' => $pageid ],
278 __METHOD__
279 );
280 if ( $this->newTitle->getNamespace() == NS_CATEGORY ) {
281 $type = 'subcat';
282 } elseif ( $this->newTitle->getNamespace() == NS_FILE ) {
283 $type = 'file';
284 } else {
285 $type = 'page';
286 }
287 foreach ( $prefixes as $prefixRow ) {
288 $prefix = $prefixRow->cl_sortkey_prefix;
289 $catTo = $prefixRow->cl_to;
290 $dbw->update( 'categorylinks',
291 [
292 'cl_sortkey' => Collation::singleton()->getSortKey(
293 $this->newTitle->getCategorySortkey( $prefix ) ),
294 'cl_collation' => $wgCategoryCollation,
295 'cl_type' => $type,
296 'cl_timestamp=cl_timestamp' ],
297 [
298 'cl_from' => $pageid,
299 'cl_to' => $catTo ],
300 __METHOD__
301 );
302 }
303
304 $redirid = $this->oldTitle->getArticleID();
305
306 if ( $protected ) {
307 # Protect the redirect title as the title used to be...
308 $res = $dbw->select(
309 'page_restrictions',
310 '*',
311 [ 'pr_page' => $pageid ],
312 __METHOD__,
313 'FOR UPDATE'
314 );
315 $rowsInsert = [];
316 foreach ( $res as $row ) {
317 $rowsInsert[] = [
318 'pr_page' => $redirid,
319 'pr_type' => $row->pr_type,
320 'pr_level' => $row->pr_level,
321 'pr_cascade' => $row->pr_cascade,
322 'pr_user' => $row->pr_user,
323 'pr_expiry' => $row->pr_expiry
324 ];
325 }
326 $dbw->insert( 'page_restrictions', $rowsInsert, __METHOD__, [ 'IGNORE' ] );
327
328 // Build comment for log
330 'prot_1movedto2',
331 $this->oldTitle->getPrefixedText(),
332 $this->newTitle->getPrefixedText()
333 )->inContentLanguage()->text();
334 if ( $reason ) {
335 $comment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $reason;
336 }
337
338 // reread inserted pr_ids for log relation
339 $insertedPrIds = $dbw->select(
340 'page_restrictions',
341 'pr_id',
342 [ 'pr_page' => $redirid ],
343 __METHOD__
344 );
345 $logRelationsValues = [];
346 foreach ( $insertedPrIds as $prid ) {
347 $logRelationsValues[] = $prid->pr_id;
348 }
349
350 // Update the protection log
351 $logEntry = new ManualLogEntry( 'protect', 'move_prot' );
352 $logEntry->setTarget( $this->newTitle );
353 $logEntry->setComment( $comment );
354 $logEntry->setPerformer( $user );
355 $logEntry->setParameters( [
356 '4::oldtitle' => $this->oldTitle->getPrefixedText(),
357 ] );
358 $logEntry->setRelations( [ 'pr_id' => $logRelationsValues ] );
359 $logId = $logEntry->insert();
360 $logEntry->publish( $logId );
361 }
362
363 // Update *_from_namespace fields as needed
364 if ( $this->oldTitle->getNamespace() != $this->newTitle->getNamespace() ) {
365 $dbw->update( 'pagelinks',
366 [ 'pl_from_namespace' => $this->newTitle->getNamespace() ],
367 [ 'pl_from' => $pageid ],
368 __METHOD__
369 );
370 $dbw->update( 'templatelinks',
371 [ 'tl_from_namespace' => $this->newTitle->getNamespace() ],
372 [ 'tl_from' => $pageid ],
373 __METHOD__
374 );
375 $dbw->update( 'imagelinks',
376 [ 'il_from_namespace' => $this->newTitle->getNamespace() ],
377 [ 'il_from' => $pageid ],
378 __METHOD__
379 );
380 }
381
382 # Update watchlists
383 $oldtitle = $this->oldTitle->getDBkey();
384 $newtitle = $this->newTitle->getDBkey();
385 $oldsnamespace = MWNamespace::getSubject( $this->oldTitle->getNamespace() );
386 $newsnamespace = MWNamespace::getSubject( $this->newTitle->getNamespace() );
387 if ( $oldsnamespace != $newsnamespace || $oldtitle != $newtitle ) {
388 $store = MediaWikiServices::getInstance()->getWatchedItemStore();
389 $store->duplicateAllAssociatedEntries( $this->oldTitle, $this->newTitle );
390 }
391
392 Hooks::run(
393 'TitleMoveCompleting',
394 [ $this->oldTitle, $this->newTitle,
395 $user, $pageid, $redirid, $reason, $nullRevision ]
396 );
397
398 $dbw->endAtomic( __METHOD__ );
399
400 $params = [
403 &$user,
404 $pageid,
405 $redirid,
406 $reason,
407 $nullRevision
408 ];
409 // Keep each single hook handler atomic
410 DeferredUpdates::addUpdate(
412 $dbw,
413 __METHOD__,
414 function () use ( $params ) {
415 Hooks::run( 'TitleMoveComplete', $params );
416 }
417 )
418 );
419
420 return Status::newGood();
421 }
422
436 private function moveToInternal( User $user, &$nt, $reason = '', $createRedirect = true ) {
438
439 if ( $nt->exists() ) {
440 $moveOverRedirect = true;
441 $logType = 'move_redir';
442 } else {
443 $moveOverRedirect = false;
444 $logType = 'move';
445 }
446
447 if ( $moveOverRedirect ) {
448 $overwriteMessage = wfMessage(
449 'delete_and_move_reason',
450 $this->oldTitle->getPrefixedText()
451 )->text();
452 $newpage = WikiPage::factory( $nt );
453 $errs = [];
454 $status = $newpage->doDeleteArticleReal(
455 $overwriteMessage,
456 /* $suppress */ false,
457 $nt->getArticleID(),
458 /* $commit */ false,
459 $errs,
460 $user,
461 [],
462 'delete_redir'
463 );
464
465 if ( !$status->isGood() ) {
466 throw new MWException( 'Failed to delete page-move revision: ' . $status );
467 }
468
469 $nt->resetArticleID( false );
470 }
471
472 if ( $createRedirect ) {
473 if ( $this->oldTitle->getNamespace() == NS_CATEGORY
474 && !wfMessage( 'category-move-redirect-override' )->inContentLanguage()->isDisabled()
475 ) {
476 $redirectContent = new WikitextContent(
477 wfMessage( 'category-move-redirect-override' )
478 ->params( $nt->getPrefixedText() )->inContentLanguage()->plain() );
479 } else {
480 $contentHandler = ContentHandler::getForTitle( $this->oldTitle );
481 $redirectContent = $contentHandler->makeRedirectContent( $nt,
482 wfMessage( 'move-redirect-text' )->inContentLanguage()->plain() );
483 }
484
485 // NOTE: If this page's content model does not support redirects, $redirectContent will be null.
486 } else {
487 $redirectContent = null;
488 }
489
490 // Figure out whether the content model is no longer the default
491 $oldDefault = ContentHandler::getDefaultModelFor( $this->oldTitle );
492 $contentModel = $this->oldTitle->getContentModel();
493 $newDefault = ContentHandler::getDefaultModelFor( $nt );
494 $defaultContentModelChanging = ( $oldDefault !== $newDefault
495 && $oldDefault === $contentModel );
496
497 // bug 57084: log_page should be the ID of the *moved* page
498 $oldid = $this->oldTitle->getArticleID();
499 $logTitle = clone $this->oldTitle;
500
501 $logEntry = new ManualLogEntry( 'move', $logType );
502 $logEntry->setPerformer( $user );
503 $logEntry->setTarget( $logTitle );
504 $logEntry->setComment( $reason );
505 $logEntry->setParameters( [
506 '4::target' => $nt->getPrefixedText(),
507 '5::noredir' => $redirectContent ? '0': '1',
508 ] );
509
510 $formatter = LogFormatter::newFromEntry( $logEntry );
511 $formatter->setContext( RequestContext::newExtraneousContext( $this->oldTitle ) );
512 $comment = $formatter->getPlainActionText();
513 if ( $reason ) {
514 $comment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $reason;
515 }
516 # Truncate for whole multibyte characters.
517 $comment = $wgContLang->truncate( $comment, 255 );
518
519 $dbw = wfGetDB( DB_MASTER );
520
521 $oldpage = WikiPage::factory( $this->oldTitle );
522 $oldcountable = $oldpage->isCountable();
523
524 $newpage = WikiPage::factory( $nt );
525
526 # Save a null revision in the page's history notifying of the move
527 $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true, $user );
528 if ( !is_object( $nullRevision ) ) {
529 throw new MWException( 'No valid null revision produced in ' . __METHOD__ );
530 }
531
532 $nullRevision->insertOn( $dbw );
533
534 # Change the name of the target page:
535 $dbw->update( 'page',
536 /* SET */ [
537 'page_namespace' => $nt->getNamespace(),
538 'page_title' => $nt->getDBkey(),
539 ],
540 /* WHERE */ [ 'page_id' => $oldid ],
541 __METHOD__
542 );
543
544 if ( !$redirectContent ) {
545 // Clean up the old title *before* reset article id - bug 45348
546 WikiPage::onArticleDelete( $this->oldTitle );
547 }
548
549 $this->oldTitle->resetArticleID( 0 ); // 0 == non existing
550 $nt->resetArticleID( $oldid );
551 $newpage->loadPageData( WikiPage::READ_LOCKING ); // bug 46397
552
553 $newpage->updateRevisionOn( $dbw, $nullRevision );
554
555 Hooks::run( 'NewRevisionFromEditComplete',
556 [ $newpage, $nullRevision, $nullRevision->getParentId(), $user ] );
557
558 $newpage->doEditUpdates( $nullRevision, $user,
559 [ 'changed' => false, 'moved' => true, 'oldcountable' => $oldcountable ] );
560
561 // If the default content model changes, we need to populate rev_content_model
562 if ( $defaultContentModelChanging ) {
563 $dbw->update(
564 'revision',
565 [ 'rev_content_model' => $contentModel ],
566 [ 'rev_page' => $nt->getArticleID(), 'rev_content_model IS NULL' ],
567 __METHOD__
568 );
569 }
570
572
573 # Recreate the redirect, this time in the other direction.
574 if ( $redirectContent ) {
575 $redirectArticle = WikiPage::factory( $this->oldTitle );
576 $redirectArticle->loadFromRow( false, WikiPage::READ_LOCKING ); // bug 46397
577 $newid = $redirectArticle->insertOn( $dbw );
578 if ( $newid ) { // sanity
579 $this->oldTitle->resetArticleID( $newid );
580 $redirectRevision = new Revision( [
581 'title' => $this->oldTitle, // for determining the default content model
582 'page' => $newid,
583 'user_text' => $user->getName(),
584 'user' => $user->getId(),
585 'comment' => $comment,
586 'content' => $redirectContent ] );
587 $redirectRevision->insertOn( $dbw );
588 $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
589
590 Hooks::run( 'NewRevisionFromEditComplete',
591 [ $redirectArticle, $redirectRevision, false, $user ] );
592
593 $redirectArticle->doEditUpdates( $redirectRevision, $user, [ 'created' => true ] );
594 }
595 }
596
597 # Log the move
598 $logid = $logEntry->insert();
599 $logEntry->publish( $logid );
600
601 return $nullRevision;
602 }
603}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
$wgCategoryCollation
Specify how category names should be sorted, when listed on a category page.
$wgContentHandlerUseDB
Set to false to disable use of the database fields introduced by the ContentHandler facility.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfMergeErrorArrays()
Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g.
wfLocalFile( $title)
Get an object referring to a locally registered file.
wfStripIllegalFilenameChars( $name)
Replace all invalid characters with '-'.
Deferrable Update for closure/callback updates via IDatabase::doAtomicSection()
static singleton()
Definition Collation.php:34
static getForTitle(Title $title)
Returns the appropriate ContentHandler singleton for the given title.
static getDefaultModelFor(Title $title)
Returns the name of the default content model to be used for the page with the given title.
static getLocalizedName( $name, Language $lang=null)
Returns the localized name for a given content model.
static matchSummarySpamRegex( $text)
Check given input text against $wgSummarySpamRegex, and return the text of the first match.
static checkExtensionCompatibility(File $old, $new)
Checks if file extensions are compatible.
Definition File.php:248
static newFromEntry(LogEntry $entry)
Constructs a new formatter suitable for given entry.
MediaWiki exception.
Class for creating log entries manually, to inject them into the database.
Definition LogEntry.php:394
MediaWikiServices is the service locator for the application scope of MediaWiki.
Handles the backend logic of moving a page from one title to another.
Definition MovePage.php:30
checkPermissions(User $user, $reason)
Definition MovePage.php:47
isValidFileMove()
Sanity checks for when a file is being moved.
Definition MovePage.php:164
Title $oldTitle
Definition MovePage.php:35
isValidMove()
Does various sanity checks that the move is valid.
Definition MovePage.php:88
isValidMoveTarget()
Checks if $this can be moved to a given Title.
Definition MovePage.php:191
move(User $user, $reason, $createRedirect)
Definition MovePage.php:238
Title $newTitle
Definition MovePage.php:40
moveToInternal(User $user, &$nt, $reason='', $createRedirect=true)
Move page to a title which is either a redirect to the source page or nonexistent.
Definition MovePage.php:436
__construct(Title $oldTitle, Title $newTitle)
Definition MovePage.php:42
static singleton()
Get a RepoGroup instance.
Definition RepoGroup.php:59
static newExtraneousContext(Title $title, $request=[])
Create a new extraneous context.
static newNullRevision( $dbw, $pageId, $summary, $minor, $user=null)
Create a new null-revision for insertion into a page's history.
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target.
Definition Revision.php:128
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition Status.php:40
Represents a title within MediaWiki.
Definition Title.php:36
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:48
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
Definition WikiPage.php:115
static onArticleDelete(Title $title)
Clears caches when article is deleted.
static onArticleCreate(Title $title)
The onArticle*() functions are supposed to be a kind of hooks which should be called whenever any of ...
Content object for wiki text pages.
$res
Definition database.txt:21
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
Definition design.txt:57
when a variable name is used in a it is silently declared as a new local masking the global
Definition design.txt:95
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
const NS_FILE
Definition Defines.php:62
const NS_CATEGORY
Definition Defines.php:70
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
Definition hooks.txt:1049
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
Definition hooks.txt:249
namespace are movable Hooks may change this value to override the return value of MWNamespace::isMovable(). 'NewDifferenceEngine' do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
Definition hooks.txt:2568
either a plain
Definition hooks.txt:1990
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
Definition hooks.txt:1094
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt;div ...>$1&lt;/div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
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
Definition hooks.txt:1734
$comment
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
Definition injection.txt:37
const READ_LOCKING
Constants for object loading bitfield flags (higher => higher QoS)
you have access to all of the normal MediaWiki so you can get a DB use the cache
const DB_MASTER
Definition defines.php:23
$params