MediaWiki  1.27.2
MovePage.php
Go to the documentation of this file.
1 <?php
2 
28 class MovePage {
29 
33  protected $oldTitle;
34 
38  protected $newTitle;
39 
40  public function __construct( Title $oldTitle, Title $newTitle ) {
41  $this->oldTitle = $oldTitle;
42  $this->newTitle = $newTitle;
43  }
44 
45  public function checkPermissions( User $user, $reason ) {
46  $status = new Status();
47 
48  $errors = wfMergeErrorArrays(
49  $this->oldTitle->getUserPermissionsErrors( 'move', $user ),
50  $this->oldTitle->getUserPermissionsErrors( 'edit', $user ),
51  $this->newTitle->getUserPermissionsErrors( 'move-target', $user ),
52  $this->newTitle->getUserPermissionsErrors( 'edit', $user )
53  );
54 
55  // Convert into a Status object
56  if ( $errors ) {
57  foreach ( $errors as $error ) {
58  call_user_func_array( [ $status, 'fatal' ], $error );
59  }
60  }
61 
62  if ( EditPage::matchSummarySpamRegex( $reason ) !== false ) {
63  // This is kind of lame, won't display nice
64  $status->fatal( 'spamprotectiontext' );
65  }
66 
67  $tp = $this->newTitle->getTitleProtection();
68  if ( $tp !== false && !$user->isAllowed( $tp['permission'] ) ) {
69  $status->fatal( 'cantmove-titleprotected' );
70  }
71 
72  Hooks::run( 'MovePageCheckPermissions',
73  [ $this->oldTitle, $this->newTitle, $user, $reason, $status ]
74  );
75 
76  return $status;
77  }
78 
86  public function isValidMove() {
87  global $wgContentHandlerUseDB;
88  $status = new Status();
89 
90  if ( $this->oldTitle->equals( $this->newTitle ) ) {
91  $status->fatal( 'selfmove' );
92  }
93  if ( !$this->oldTitle->isMovable() ) {
94  $status->fatal( 'immobile-source-namespace', $this->oldTitle->getNsText() );
95  }
96  if ( $this->newTitle->isExternal() ) {
97  $status->fatal( 'immobile-target-namespace-iw' );
98  }
99  if ( !$this->newTitle->isMovable() ) {
100  $status->fatal( 'immobile-target-namespace', $this->newTitle->getNsText() );
101  }
102 
103  $oldid = $this->oldTitle->getArticleID();
104 
105  if ( strlen( $this->newTitle->getDBkey() ) < 1 ) {
106  $status->fatal( 'articleexists' );
107  }
108  if (
109  ( $this->oldTitle->getDBkey() == '' ) ||
110  ( !$oldid ) ||
111  ( $this->newTitle->getDBkey() == '' )
112  ) {
113  $status->fatal( 'badarticleerror' );
114  }
115 
116  # The move is allowed only if (1) the target doesn't exist, or
117  # (2) the target is a redirect to the source, and has no history
118  # (so we can undo bad moves right after they're done).
119  if ( $this->newTitle->getArticleID() && !$this->isValidMoveTarget() ) {
120  $status->fatal( 'articleexists' );
121  }
122 
123  // Content model checks
124  if ( !$wgContentHandlerUseDB &&
125  $this->oldTitle->getContentModel() !== $this->newTitle->getContentModel() ) {
126  // can't move a page if that would change the page's content model
127  $status->fatal(
128  'bad-target-model',
129  ContentHandler::getLocalizedName( $this->oldTitle->getContentModel() ),
130  ContentHandler::getLocalizedName( $this->newTitle->getContentModel() )
131  );
132  }
133 
134  // Image-specific checks
135  if ( $this->oldTitle->inNamespace( NS_FILE ) ) {
136  $status->merge( $this->isValidFileMove() );
137  }
138 
139  if ( $this->newTitle->inNamespace( NS_FILE ) && !$this->oldTitle->inNamespace( NS_FILE ) ) {
140  $status->fatal( 'nonfile-cannot-move-to-file' );
141  }
142 
143  // Hook for extensions to say a title can't be moved for technical reasons
144  Hooks::run( 'MovePageIsValidMove', [ $this->oldTitle, $this->newTitle, $status ] );
145 
146  return $status;
147  }
148 
154  protected function isValidFileMove() {
155  $status = new Status();
156  $file = wfLocalFile( $this->oldTitle );
157  $file->load( File::READ_LATEST );
158  if ( $file->exists() ) {
159  if ( $this->newTitle->getText() != wfStripIllegalFilenameChars( $this->newTitle->getText() ) ) {
160  $status->fatal( 'imageinvalidfilename' );
161  }
162  if ( !File::checkExtensionCompatibility( $file, $this->newTitle->getDBkey() ) ) {
163  $status->fatal( 'imagetypemismatch' );
164  }
165  }
166 
167  if ( !$this->newTitle->inNamespace( NS_FILE ) ) {
168  $status->fatal( 'imagenocrossnamespace' );
169  }
170 
171  return $status;
172  }
173 
181  protected function isValidMoveTarget() {
182  # Is it an existing file?
183  if ( $this->newTitle->inNamespace( NS_FILE ) ) {
184  $file = wfLocalFile( $this->newTitle );
185  $file->load( File::READ_LATEST );
186  if ( $file->exists() ) {
187  wfDebug( __METHOD__ . ": file exists\n" );
188  return false;
189  }
190  }
191  # Is it a redirect with no history?
192  if ( !$this->newTitle->isSingleRevRedirect() ) {
193  wfDebug( __METHOD__ . ": not a one-rev redirect\n" );
194  return false;
195  }
196  # Get the article text
197  $rev = Revision::newFromTitle( $this->newTitle, false, Revision::READ_LATEST );
198  if ( !is_object( $rev ) ) {
199  return false;
200  }
201  $content = $rev->getContent();
202  # Does the redirect point to the source?
203  # Or is it a broken self-redirect, usually caused by namespace collisions?
204  $redirTitle = $content ? $content->getRedirectTarget() : null;
205 
206  if ( $redirTitle ) {
207  if ( $redirTitle->getPrefixedDBkey() !== $this->oldTitle->getPrefixedDBkey() &&
208  $redirTitle->getPrefixedDBkey() !== $this->newTitle->getPrefixedDBkey() ) {
209  wfDebug( __METHOD__ . ": redirect points to other page\n" );
210  return false;
211  } else {
212  return true;
213  }
214  } else {
215  # Fail safe (not a redirect after all. strange.)
216  wfDebug( __METHOD__ . ": failsafe: database says " . $this->newTitle->getPrefixedDBkey() .
217  " is a redirect, but it doesn't contain a valid redirect.\n" );
218  return false;
219  }
220  }
221 
228  public function move( User $user, $reason, $createRedirect ) {
229  global $wgCategoryCollation;
230 
231  Hooks::run( 'TitleMove', [ $this->oldTitle, $this->newTitle, $user ] );
232 
233  // If it is a file, move it first.
234  // It is done before all other moving stuff is done because it's hard to revert.
235  $dbw = wfGetDB( DB_MASTER );
236  if ( $this->oldTitle->getNamespace() == NS_FILE ) {
237  $file = wfLocalFile( $this->oldTitle );
238  $file->load( File::READ_LATEST );
239  if ( $file->exists() ) {
240  $status = $file->move( $this->newTitle );
241  if ( !$status->isOK() ) {
242  return $status;
243  }
244  }
245  // Clear RepoGroup process cache
246  RepoGroup::singleton()->clearCache( $this->oldTitle );
247  RepoGroup::singleton()->clearCache( $this->newTitle ); # clear false negative cache
248  }
249 
250  $dbw->startAtomic( __METHOD__ );
251 
252  Hooks::run( 'TitleMoveStarting', [ $this->oldTitle, $this->newTitle, $user ] );
253 
254  $pageid = $this->oldTitle->getArticleID( Title::GAID_FOR_UPDATE );
255  $protected = $this->oldTitle->isProtected();
256 
257  // Do the actual move
258  $nullRevision = $this->moveToInternal( $user, $this->newTitle, $reason, $createRedirect );
259 
260  // Refresh the sortkey for this row. Be careful to avoid resetting
261  // cl_timestamp, which may disturb time-based lists on some sites.
262  // @todo This block should be killed, it's duplicating code
263  // from LinksUpdate::getCategoryInsertions() and friends.
264  $prefixes = $dbw->select(
265  'categorylinks',
266  [ 'cl_sortkey_prefix', 'cl_to' ],
267  [ 'cl_from' => $pageid ],
268  __METHOD__
269  );
270  if ( $this->newTitle->getNamespace() == NS_CATEGORY ) {
271  $type = 'subcat';
272  } elseif ( $this->newTitle->getNamespace() == NS_FILE ) {
273  $type = 'file';
274  } else {
275  $type = 'page';
276  }
277  foreach ( $prefixes as $prefixRow ) {
278  $prefix = $prefixRow->cl_sortkey_prefix;
279  $catTo = $prefixRow->cl_to;
280  $dbw->update( 'categorylinks',
281  [
282  'cl_sortkey' => Collation::singleton()->getSortKey(
283  $this->newTitle->getCategorySortkey( $prefix ) ),
284  'cl_collation' => $wgCategoryCollation,
285  'cl_type' => $type,
286  'cl_timestamp=cl_timestamp' ],
287  [
288  'cl_from' => $pageid,
289  'cl_to' => $catTo ],
290  __METHOD__
291  );
292  }
293 
294  $redirid = $this->oldTitle->getArticleID();
295 
296  if ( $protected ) {
297  # Protect the redirect title as the title used to be...
298  $dbw->insertSelect( 'page_restrictions', 'page_restrictions',
299  [
300  'pr_page' => $redirid,
301  'pr_type' => 'pr_type',
302  'pr_level' => 'pr_level',
303  'pr_cascade' => 'pr_cascade',
304  'pr_user' => 'pr_user',
305  'pr_expiry' => 'pr_expiry'
306  ],
307  [ 'pr_page' => $pageid ],
308  __METHOD__,
309  [ 'IGNORE' ]
310  );
311 
312  // Build comment for log
314  'prot_1movedto2',
315  $this->oldTitle->getPrefixedText(),
316  $this->newTitle->getPrefixedText()
317  )->inContentLanguage()->text();
318  if ( $reason ) {
319  $comment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $reason;
320  }
321 
322  // reread inserted pr_ids for log relation
323  $insertedPrIds = $dbw->select(
324  'page_restrictions',
325  'pr_id',
326  [ 'pr_page' => $redirid ],
327  __METHOD__
328  );
329  $logRelationsValues = [];
330  foreach ( $insertedPrIds as $prid ) {
331  $logRelationsValues[] = $prid->pr_id;
332  }
333 
334  // Update the protection log
335  $logEntry = new ManualLogEntry( 'protect', 'move_prot' );
336  $logEntry->setTarget( $this->newTitle );
337  $logEntry->setComment( $comment );
338  $logEntry->setPerformer( $user );
339  $logEntry->setParameters( [
340  '4::oldtitle' => $this->oldTitle->getPrefixedText(),
341  ] );
342  $logEntry->setRelations( [ 'pr_id' => $logRelationsValues ] );
343  $logId = $logEntry->insert();
344  $logEntry->publish( $logId );
345  }
346 
347  // Update *_from_namespace fields as needed
348  if ( $this->oldTitle->getNamespace() != $this->newTitle->getNamespace() ) {
349  $dbw->update( 'pagelinks',
350  [ 'pl_from_namespace' => $this->newTitle->getNamespace() ],
351  [ 'pl_from' => $pageid ],
352  __METHOD__
353  );
354  $dbw->update( 'templatelinks',
355  [ 'tl_from_namespace' => $this->newTitle->getNamespace() ],
356  [ 'tl_from' => $pageid ],
357  __METHOD__
358  );
359  $dbw->update( 'imagelinks',
360  [ 'il_from_namespace' => $this->newTitle->getNamespace() ],
361  [ 'il_from' => $pageid ],
362  __METHOD__
363  );
364  }
365 
366  # Update watchlists
367  $oldtitle = $this->oldTitle->getDBkey();
368  $newtitle = $this->newTitle->getDBkey();
369  $oldsnamespace = MWNamespace::getSubject( $this->oldTitle->getNamespace() );
370  $newsnamespace = MWNamespace::getSubject( $this->newTitle->getNamespace() );
371  if ( $oldsnamespace != $newsnamespace || $oldtitle != $newtitle ) {
373  $store->duplicateAllAssociatedEntries( $this->oldTitle, $this->newTitle );
374  }
375 
376  Hooks::run(
377  'TitleMoveCompleting',
378  [ $this->oldTitle, $this->newTitle,
379  $user, $pageid, $redirid, $reason, $nullRevision ]
380  );
381 
382  $dbw->endAtomic( __METHOD__ );
383 
384  $params = [
387  &$user,
388  $pageid,
389  $redirid,
390  $reason,
391  $nullRevision
392  ];
393  $dbw->onTransactionIdle( function () use ( $params, $dbw ) {
394  // Keep each single hook handler atomic
395  $dbw->setFlag( DBO_TRX ); // flag is automatically reset by DB layer
396  Hooks::run( 'TitleMoveComplete', $params );
397  } );
398 
399  return Status::newGood();
400  }
401 
415  private function moveToInternal( User $user, &$nt, $reason = '', $createRedirect = true ) {
417 
418  if ( $nt->exists() ) {
419  $moveOverRedirect = true;
420  $logType = 'move_redir';
421  } else {
422  $moveOverRedirect = false;
423  $logType = 'move';
424  }
425 
426  if ( $createRedirect ) {
427  if ( $this->oldTitle->getNamespace() == NS_CATEGORY
428  && !wfMessage( 'category-move-redirect-override' )->inContentLanguage()->isDisabled()
429  ) {
430  $redirectContent = new WikitextContent(
431  wfMessage( 'category-move-redirect-override' )
432  ->params( $nt->getPrefixedText() )->inContentLanguage()->plain() );
433  } else {
434  $contentHandler = ContentHandler::getForTitle( $this->oldTitle );
435  $redirectContent = $contentHandler->makeRedirectContent( $nt,
436  wfMessage( 'move-redirect-text' )->inContentLanguage()->plain() );
437  }
438 
439  // NOTE: If this page's content model does not support redirects, $redirectContent will be null.
440  } else {
441  $redirectContent = null;
442  }
443 
444  // Figure out whether the content model is no longer the default
445  $oldDefault = ContentHandler::getDefaultModelFor( $this->oldTitle );
446  $contentModel = $this->oldTitle->getContentModel();
447  $newDefault = ContentHandler::getDefaultModelFor( $nt );
448  $defaultContentModelChanging = ( $oldDefault !== $newDefault
449  && $oldDefault === $contentModel );
450 
451  // bug 57084: log_page should be the ID of the *moved* page
452  $oldid = $this->oldTitle->getArticleID();
453  $logTitle = clone $this->oldTitle;
454 
455  $logEntry = new ManualLogEntry( 'move', $logType );
456  $logEntry->setPerformer( $user );
457  $logEntry->setTarget( $logTitle );
458  $logEntry->setComment( $reason );
459  $logEntry->setParameters( [
460  '4::target' => $nt->getPrefixedText(),
461  '5::noredir' => $redirectContent ? '0': '1',
462  ] );
463 
464  $formatter = LogFormatter::newFromEntry( $logEntry );
465  $formatter->setContext( RequestContext::newExtraneousContext( $this->oldTitle ) );
466  $comment = $formatter->getPlainActionText();
467  if ( $reason ) {
468  $comment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $reason;
469  }
470  # Truncate for whole multibyte characters.
471  $comment = $wgContLang->truncate( $comment, 255 );
472 
473  $dbw = wfGetDB( DB_MASTER );
474 
475  $oldpage = WikiPage::factory( $this->oldTitle );
476  $oldcountable = $oldpage->isCountable();
477 
478  $newpage = WikiPage::factory( $nt );
479 
480  if ( $moveOverRedirect ) {
481  $newid = $nt->getArticleID();
482  $newcontent = $newpage->getContent();
483 
484  # Delete the old redirect. We don't save it to history since
485  # by definition if we've got here it's rather uninteresting.
486  # We have to remove it so that the next step doesn't trigger
487  # a conflict on the unique namespace+title index...
488  $dbw->delete( 'page', [ 'page_id' => $newid ], __METHOD__ );
489 
490  $newpage->doDeleteUpdates( $newid, $newcontent );
491  }
492 
493  # Save a null revision in the page's history notifying of the move
494  $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true, $user );
495  if ( !is_object( $nullRevision ) ) {
496  throw new MWException( 'No valid null revision produced in ' . __METHOD__ );
497  }
498 
499  $nullRevision->insertOn( $dbw );
500 
501  # Change the name of the target page:
502  $dbw->update( 'page',
503  /* SET */ [
504  'page_namespace' => $nt->getNamespace(),
505  'page_title' => $nt->getDBkey(),
506  ],
507  /* WHERE */ [ 'page_id' => $oldid ],
508  __METHOD__
509  );
510 
511  // clean up the old title before reset article id - bug 45348
512  if ( !$redirectContent ) {
513  WikiPage::onArticleDelete( $this->oldTitle );
514  }
515 
516  $this->oldTitle->resetArticleID( 0 ); // 0 == non existing
517  $nt->resetArticleID( $oldid );
518  $newpage->loadPageData( WikiPage::READ_LOCKING ); // bug 46397
519 
520  $newpage->updateRevisionOn( $dbw, $nullRevision );
521 
522  Hooks::run( 'NewRevisionFromEditComplete',
523  [ $newpage, $nullRevision, $nullRevision->getParentId(), $user ] );
524 
525  $newpage->doEditUpdates( $nullRevision, $user,
526  [ 'changed' => false, 'moved' => true, 'oldcountable' => $oldcountable ] );
527 
528  // If the default content model changes, we need to populate rev_content_model
529  if ( $defaultContentModelChanging ) {
530  $dbw->update(
531  'revision',
532  [ 'rev_content_model' => $contentModel ],
533  [ 'rev_page' => $nt->getArticleID(), 'rev_content_model IS NULL' ],
534  __METHOD__
535  );
536  }
537 
538  if ( !$moveOverRedirect ) {
540  }
541 
542  # Recreate the redirect, this time in the other direction.
543  if ( $redirectContent ) {
544  $redirectArticle = WikiPage::factory( $this->oldTitle );
545  $redirectArticle->loadFromRow( false, WikiPage::READ_LOCKING ); // bug 46397
546  $newid = $redirectArticle->insertOn( $dbw );
547  if ( $newid ) { // sanity
548  $this->oldTitle->resetArticleID( $newid );
549  $redirectRevision = new Revision( [
550  'title' => $this->oldTitle, // for determining the default content model
551  'page' => $newid,
552  'user_text' => $user->getName(),
553  'user' => $user->getId(),
554  'comment' => $comment,
555  'content' => $redirectContent ] );
556  $redirectRevision->insertOn( $dbw );
557  $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
558 
559  Hooks::run( 'NewRevisionFromEditComplete',
560  [ $redirectArticle, $redirectRevision, false, $user ] );
561 
562  $redirectArticle->doEditUpdates( $redirectRevision, $user, [ 'created' => true ] );
563  }
564  }
565 
566  # Log the move
567  $logid = $logEntry->insert();
568  $logEntry->publish( $logid );
569 
570  return $nullRevision;
571  }
572 }
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
Definition: WikiPage.php:99
static onArticleCreate(Title $title)
The onArticle*() functions are supposed to be a kind of hooks which should be called whenever any of ...
Definition: WikiPage.php:3236
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
Handles the backend logic of moving a page from one title to another.
Definition: MovePage.php:28
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static singleton()
Definition: Collation.php:34
static newFromEntry(LogEntry $entry)
Constructs a new formatter suitable for given entry.
$comment
static getDefaultModelFor(Title $title)
Returns the name of the default content model to be used for the page with the given title...
const DBO_TRX
Definition: Defines.php:33
Represents a title within MediaWiki.
Definition: Title.php:34
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
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:117
wfLocalFile($title)
Get an object referring to a locally registered file.
wfStripIllegalFilenameChars($name)
Replace all invalid characters with - Additional characters can be defined in $wgIllegalFileChars (se...
getName()
Get the user name, or the IP of an anonymous user.
Definition: User.php:2086
wfDebug($text, $dest= 'all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
static matchSummarySpamRegex($text)
Check given input text against $wgSummarySpamRegex, and return the text of the first match...
Definition: EditPage.php:2205
you have access to all of the normal MediaWiki so you can get a DB use the cache
Definition: maintenance.txt:52
static getLocalizedName($name, Language $lang=null)
Returns the localized name for a given content model.
move(User $user, $reason, $createRedirect)
Definition: MovePage.php:228
wfMergeErrorArrays()
Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g.
checkPermissions(User $user, $reason)
Definition: MovePage.php:45
isAllowed($action= '')
Internal mechanics of testing a permission.
Definition: User.php:3408
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:415
static singleton()
Get a RepoGroup instance.
Definition: RepoGroup.php:59
static newNullRevision($dbw, $pageId, $summary, $minor, $user=null)
Create a new null-revision for insertion into a page's history.
Definition: Revision.php:1624
const GAID_FOR_UPDATE
Used to be GAID_FOR_UPDATE define.
Definition: Title.php:49
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 noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing 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 unsetoffset-wrap String Wrap the message in html(usually something like"&lt
$params
const NS_CATEGORY
Definition: Defines.php:83
static newExtraneousContext(Title $title, $request=[])
Create a new extraneous context.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
const NS_FILE
Definition: Defines.php:75
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:1584
Content object for wiki text pages.
static getForTitle(Title $title)
Returns the appropriate ContentHandler singleton for the given title.
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
Definition: distributors.txt:9
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:242
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:35
isValidFileMove()
Sanity checks for when a file is being moved.
Definition: MovePage.php:154
static checkExtensionCompatibility(File $old, $new)
Checks if file extensions are compatible.
Definition: File.php:248
Class for creating log entries manually, to inject them into the database.
Definition: LogEntry.php:394
__construct(Title $oldTitle, Title $newTitle)
Definition: MovePage.php:40
isValidMoveTarget()
Checks if $this can be moved to a given Title.
Definition: MovePage.php:181
getId()
Get the user's ID.
Definition: User.php:2061
insertOn($dbw)
Insert a new revision into the database, returning the new revision ID number on success and dies hor...
Definition: Revision.php:1354
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:1004
static onArticleDelete(Title $title)
Clears caches when article is deleted.
Definition: WikiPage.php:3252
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:56
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:1004
const DB_MASTER
Definition: Defines.php:47
Title $oldTitle
Definition: MovePage.php:33
isValidMove()
Does various sanity checks that the move is valid.
Definition: MovePage.php:86
static getSubject($index)
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA, NS_SPECIAL) are always the subject.
Title $newTitle
Definition: MovePage.php:38
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:2338
static newGood($value=null)
Factory function for good results.
Definition: Status.php:101