23use \MediaWiki\Logger\LoggerFactory;
24use \MediaWiki\MediaWikiServices;
121 $ns =
$title->getNamespace();
124 throw new MWException(
"NS_MEDIA is a virtual namespace; use NS_FILE." );
125 } elseif ( $ns < 0 ) {
126 throw new MWException(
"Invalid or virtual namespace $ns given." );
130 if ( !Hooks::run(
'WikiPageFactory', [
$title, &
$page ] ) ) {
158 public static function newFromID( $id, $from =
'fromdb' ) {
166 $row = $db->selectRow(
167 'page', self::selectFields(), [
'page_id' => $id ], __METHOD__ );
185 public static function newFromRow( $row, $from =
'fromdb' ) {
187 $page->loadFromRow( $row, $from );
200 return self::READ_NORMAL;
202 return self::READ_LATEST;
246 $this->mDataLoaded =
false;
258 $this->mRedirectTarget =
null;
259 $this->mLastRevision =
null;
260 $this->mTouched =
'19700101000000';
261 $this->mLinksUpdated =
'19700101000000';
262 $this->mTimestamp =
'';
263 $this->mIsRedirect =
false;
264 $this->mLatest =
false;
277 $this->mPreparedEdit =
false;
298 'page_links_updated',
304 $fields[] =
'page_content_model';
308 $fields[] =
'page_lang';
327 Hooks::run(
'ArticlePageDataBefore', [ &$wikiPage, &$fields ] );
329 $row =
$dbr->selectRow(
'page', $fields, $conditions, __METHOD__,
$options );
331 Hooks::run(
'ArticlePageDataAfter', [ &$wikiPage, &$row ] );
347 'page_namespace' =>
$title->getNamespace(),
377 if ( is_int( $from ) && $from <= $this->mDataLoadedFrom ) {
382 if ( is_int( $from ) ) {
388 &&
wfGetLB()->getServerCount() > 1
389 &&
wfGetLB()->hasOrMadeRecentMasterChanges()
391 $from = self::READ_LATEST;
398 $from = self::READ_NORMAL;
416 $lc = LinkCache::singleton();
417 $lc->clearLink( $this->mTitle );
420 $lc->addGoodLinkObjFromRow( $this->mTitle, $data );
422 $this->mTitle->loadFromRow( $data );
425 $this->mTitle->loadRestrictions( $data->page_restrictions );
427 $this->mId = intval( $data->page_id );
428 $this->mTouched =
wfTimestamp( TS_MW, $data->page_touched );
430 $this->mIsRedirect = intval( $data->page_is_redirect );
431 $this->mLatest = intval( $data->page_latest );
434 if ( $this->mLastRevision && $this->mLastRevision->getId() != $this->mLatest ) {
435 $this->mLastRevision =
null;
436 $this->mTimestamp =
'';
439 $lc->addBadLinkObj( $this->mTitle );
441 $this->mTitle->loadFromRow(
false );
448 $this->mDataLoaded =
true;
456 if ( !$this->mDataLoaded ) {
466 if ( !$this->mDataLoaded ) {
469 return $this->mId > 0;
481 return $this->mTitle->isKnown();
490 if ( !$this->mDataLoaded ) {
509 $cache = ObjectCache::getMainWANInstance();
511 return $cache->getWithSetCallback(
512 $cache->makeKey(
'page',
'content-model', $this->getLatest() ),
518 return $rev->getContentModel();
520 $title = $this->mTitle->getPrefixedDBkey();
521 wfWarn(
"Page $title exists but has no (visible) revisions!" );
522 return $this->mTitle->getContentModel();
529 return $this->mTitle->getContentModel();
537 if ( !$this->mDataLoaded ) {
540 return ( $this->mId && !$this->mIsRedirect );
548 if ( !$this->mDataLoaded ) {
559 if ( !$this->mDataLoaded ) {
570 if ( !$this->mDataLoaded ) {
582 $rev = $this->mTitle->getFirstRevision();
584 $rev = $this->mTitle->getFirstRevision( Title::GAID_FOR_UPDATE );
594 if ( $this->mLastRevision !==
null ) {
603 if ( $this->mDataLoadedFrom == self::READ_LOCKING ) {
613 } elseif ( $this->mDataLoadedFrom == self::READ_LATEST ) {
617 $flags = Revision::READ_LATEST;
634 $this->mLastRevision = $revision;
644 if ( $this->mLastRevision ) {
665 if ( $this->mLastRevision ) {
666 return $this->mLastRevision->getContent( $audience,
$user );
676 if ( !$this->mTimestamp ) {
703 if ( $this->mLastRevision ) {
704 return $this->mLastRevision->getUser( $audience,
$user );
723 $userName = $revision->getUserText( $audience,
$user );
724 return User::newFromName( $userName,
false );
741 if ( $this->mLastRevision ) {
742 return $this->mLastRevision->getUserText( $audience,
$user );
759 if ( $this->mLastRevision ) {
760 return $this->mLastRevision->getComment( $audience,
$user );
773 if ( $this->mLastRevision ) {
774 return $this->mLastRevision->isMinor();
791 if ( !$this->mTitle->isContentPage() ) {
815 $hasLinks = (bool)count( $editInfo->output->getLinks() );
818 [
'pl_from' => $this->
getId() ], __METHOD__ );
822 return $content->isCountable( $hasLinks );
833 if ( !$this->mTitle->isRedirect() ) {
837 if ( $this->mRedirectTarget !==
null ) {
843 $row =
$dbr->selectRow(
'redirect',
844 [
'rd_namespace',
'rd_title',
'rd_fragment',
'rd_interwiki' ],
845 [
'rd_from' => $this->
getId() ],
850 if ( $row && !is_null( $row->rd_fragment ) && !is_null( $row->rd_interwiki ) ) {
851 $this->mRedirectTarget = Title::makeTitle(
852 $row->rd_namespace, $row->rd_title,
853 $row->rd_fragment, $row->rd_interwiki
881 DeferredUpdates::addCallableUpdate(
883 $that->insertRedirectEntry(
$retval, $latest );
885 DeferredUpdates::POSTSEND,
899 $dbw->startAtomic( __METHOD__ );
905 'rd_from' => $this->
getId(),
922 $dbw->endAtomic( __METHOD__ );
946 if ( $rt->isExternal() ) {
947 if ( $rt->isLocal() ) {
951 $source = $this->mTitle->getFullURL(
'redirect=no' );
952 return $rt->getFullURL( [
'rdfrom' =>
$source ] );
960 if ( $rt->isSpecialPage() ) {
964 if ( $rt->isValidRedirectTarget() ) {
965 return $rt->getFullURL();
984 if (
$dbr->implicitGroupby() ) {
985 $realNameField =
'user_real_name';
987 $realNameField =
'MIN(user_real_name) AS user_real_name';
990 $tables = [
'revision',
'user' ];
993 'user_id' =>
'rev_user',
994 'user_name' =>
'rev_user_text',
996 'timestamp' =>
'MAX(rev_timestamp)',
999 $conds = [
'rev_page' => $this->
getId() ];
1005 $conds[] =
"rev_user != $user";
1007 $conds[] =
"rev_user_text != {$dbr->addQuotes( $this->getUserText() )}";
1011 $conds[] =
"{$dbr->bitAnd( 'rev_deleted', Revision::DELETED_USER )} = 0";
1014 'user' => [
'LEFT JOIN',
'rev_user = user_id' ],
1018 'GROUP BY' => [
'rev_user',
'rev_user_text' ],
1019 'ORDER BY' =>
'timestamp DESC',
1036 && ( $oldId ===
null || $oldId === 0 || $oldId === $this->
getLatest() )
1054 ParserOptions $parserOptions, $oldid =
null, $forceParse =
false
1059 ': using parser cache: ' . ( $useParserCache ?
'yes' :
'no' ) .
"\n" );
1064 if ( $useParserCache ) {
1071 if ( $oldid ===
null || $oldid === 0 ) {
1078 return $pool->getParserOutput();
1091 Hooks::run(
'PageViewUpdates', [ $this,
$user ] );
1094 $user->clearNotification( $this->mTitle, $oldid );
1097 MWExceptionHandler::logException(
$e );
1111 if ( !Hooks::run(
'ArticlePurge', [ &$wikiPage ] ) ) {
1115 $this->mTitle->invalidateCache();
1120 DeferredUpdates::addUpdate(
1122 DeferredUpdates::PRESEND
1127 $messageCache->updateMessageOverride( $this->mTitle, $this->
getContent() );
1160 $pageIdForInsert = $pageId ?: $dbw->nextSequenceValue(
'page_page_id_seq' );
1164 'page_id' => $pageIdForInsert,
1165 'page_namespace' => $this->mTitle->getNamespace(),
1166 'page_title' => $this->mTitle->getDBkey(),
1167 'page_restrictions' =>
'',
1168 'page_is_redirect' => 0,
1171 'page_touched' => $dbw->timestamp(),
1179 if ( $dbw->affectedRows() > 0 ) {
1180 $newid = $pageId ?: $dbw->insertId();
1181 $this->mId = $newid;
1182 $this->mTitle->resetArticleID( $newid );
1204 $lastRevIsRedirect =
null
1209 if ( (
int)$revision->getId() === 0 ) {
1210 throw new InvalidArgumentException(
1211 __METHOD__ .
': Revision has ID ' . var_export( $revision->getId(), 1 )
1215 $content = $revision->getContent();
1219 $conditions = [
'page_id' => $this->
getId() ];
1221 if ( !is_null( $lastRevision ) ) {
1223 $conditions[
'page_latest'] = $lastRevision;
1227 'page_latest' => $revision->getId(),
1228 'page_touched' => $dbw->timestamp( $revision->getTimestamp() ),
1229 'page_is_new' => ( $lastRevision === 0 ) ? 1 : 0,
1230 'page_is_redirect' => $rt !==
null ? 1 : 0,
1235 $row[
'page_content_model'] = $revision->getContentModel();
1238 $dbw->update(
'page',
1243 $result = $dbw->affectedRows() > 0;
1247 $this->mLatest = $revision->getId();
1248 $this->mIsRedirect = (bool)$rt;
1250 LinkCache::singleton()->addGoodLinkObj(
1256 $revision->getContentModel()
1278 $isRedirect = !is_null( $redirectTitle );
1280 if ( !$isRedirect && $lastRevIsRedirect ===
false ) {
1284 if ( $isRedirect ) {
1288 $where = [
'rd_from' => $this->
getId() ];
1289 $dbw->delete(
'redirect', $where, __METHOD__ );
1296 return ( $dbw->affectedRows() != 0 );
1311 $row = $dbw->selectRow(
1312 [
'revision',
'page' ],
1313 [
'rev_id',
'rev_timestamp',
'page_is_redirect' ],
1315 'page_id' => $this->
getId(),
1316 'page_latest=rev_id' ],
1320 if (
wfTimestamp( TS_MW, $row->rev_timestamp ) >= $revision->getTimestamp() ) {
1323 $prev = $row->rev_id;
1324 $lastRevIsRedirect = (bool)$row->page_is_redirect;
1328 $lastRevIsRedirect =
null;
1384 if ( $edittime && $sectionId !==
'new' ) {
1391 &&
wfGetLB()->getServerCount() > 1
1392 &&
wfGetLB()->hasOrMadeRecentMasterChanges()
1398 $baseRevId =
$rev->getId();
1419 $sectionTitle =
'', $baseRevId =
null
1422 if ( strval( $sectionId ) ===
'' ) {
1427 throw new MWException(
"sections not supported for content model " .
1432 if ( is_null( $baseRevId ) || $sectionId ===
'new' ) {
1437 wfDebug( __METHOD__ .
" asked for bogus section (page: " .
1438 $this->
getId() .
"; section: $sectionId)\n" );
1442 $oldContent =
$rev->getContent();
1445 if ( !$oldContent ) {
1446 wfDebug( __METHOD__ .
": no page text\n" );
1450 $newContent = $oldContent->replaceSection( $sectionId,
$sectionContent, $sectionTitle );
1533 User $user =
null, $serialFormat =
null, $tags = [], $undidRevId = 0
1538 if ( $tags ===
null ) {
1543 if ( $this->mTitle->getText() ===
'' ) {
1544 throw new MWException(
'Something is trying to edit an article with an empty title' );
1547 if ( !
$content->getContentHandler()->canBeUsedOn( $this->mTitle ) ) {
1548 return Status::newFatal(
'content-not-allowed-here',
1550 $this->mTitle->getPrefixedText()
1566 $hookStatus = Status::newGood( [] );
1570 if ( !Hooks::run(
'PageContentSave', $hook_args ) ) {
1571 if ( $hookStatus->isOK() ) {
1573 $hookStatus->fatal(
'edit-hook-aborted' );
1582 if ( $old_content && $old_content->getModel() !==
$content->getModel() ) {
1583 $tags[] =
'mw-contentmodelchange';
1601 $pstContent = $editInfo->pstContent;
1605 'serialized' => $editInfo->pst,
1606 'serialFormat' => $serialFormat,
1607 'baseRevId' => $baseRevId,
1608 'oldRevision' => $old_revision,
1609 'oldContent' => $old_content,
1613 'tags' => ( $tags !== null ) ? (
array)$tags : [],
1614 'undidRevId' => $undidRevId
1625 DeferredUpdates::addCallableUpdate(
function ()
use (
$user ) {
1626 $user->addAutopromoteOnceGroups(
'onEdit' );
1627 $user->addAutopromoteOnceGroups(
'onView' );
1651 $status = Status::newGood( [
'new' =>
false,
'revision' =>
null ] );
1655 $oldid = $meta[
'oldId'];
1657 $oldContent = $meta[
'oldContent'];
1662 $status->fatal(
'edit-gone-missing' );
1665 } elseif ( !$oldContent ) {
1667 throw new MWException(
"Could not find text for current revision {$oldid}." );
1672 'page' => $this->
getId(),
1673 'title' => $this->mTitle,
1674 'comment' => $summary,
1675 'minor_edit' => $meta[
'minor'],
1676 'text' => $meta[
'serialized'],
1678 'parent_id' => $oldid,
1679 'user' =>
$user->getId(),
1680 'user_text' =>
$user->getName(),
1681 'timestamp' => $now,
1682 'content_model' =>
$content->getModel(),
1683 'content_format' => $meta[
'serialFormat'],
1686 $changed = !
$content->equals( $oldContent );
1692 $status->merge( $prepStatus );
1697 $dbw->startAtomic( __METHOD__ );
1702 if ( $latestNow != $oldid ) {
1703 $dbw->endAtomic( __METHOD__ );
1705 $status->fatal(
'edit-conflict' );
1716 $revisionId = $revision->insertOn( $dbw );
1718 if ( !$this->
updateRevisionOn( $dbw, $revision,
null, $meta[
'oldIsRedirect'] ) ) {
1719 throw new MWException(
"Failed to update page row to use new revision." );
1722 Hooks::run(
'NewRevisionFromEditComplete',
1723 [ $this, $revision, $meta[
'baseRevId'],
$user ] );
1729 $this->mTitle->getUserPermissionsErrors(
'autopatrol',
$user ) );
1734 $revision->isMinor(),
1738 $this->getTimestamp(),
1741 $oldContent ? $oldContent->getSize() : 0,
1749 $user->incEditCount();
1751 $dbw->endAtomic( __METHOD__ );
1752 $this->mTimestamp = $now;
1757 $revision->setUserIdAndName(
1765 $status->value[
'revision'] = $revision;
1767 $status->warning(
'edit-no-change' );
1770 $this->mTitle->invalidateCache( $now );
1774 DeferredUpdates::addUpdate(
1787 'changed' => $changed,
1788 'oldcountable' => $meta[
'oldCountable'],
1789 'oldrevision' => $meta[
'oldRevision']
1796 null,
null, &
$flags, $revision, &
$status, $meta[
'baseRevId'],
1797 $meta[
'undidRevId'] ];
1798 Hooks::run(
'PageContentSaveComplete',
$params );
1801 DeferredUpdates::PRESEND
1824 $status = Status::newGood( [
'new' =>
true,
'revision' =>
null ] );
1829 $status->merge( $prepStatus );
1835 $dbw->startAtomic( __METHOD__ );
1839 if ( $newid ===
false ) {
1840 $dbw->endAtomic( __METHOD__ );
1841 $status->fatal(
'edit-already-exists' );
1854 'title' => $this->mTitle,
1855 'comment' => $summary,
1856 'minor_edit' => $meta[
'minor'],
1857 'text' => $meta[
'serialized'],
1859 'user' =>
$user->getId(),
1860 'user_text' =>
$user->getName(),
1861 'timestamp' => $now,
1862 'content_model' =>
$content->getModel(),
1863 'content_format' => $meta[
'serialFormat'],
1867 $revisionId = $revision->insertOn( $dbw );
1870 throw new MWException(
"Failed to update page row to use new revision." );
1873 Hooks::run(
'NewRevisionFromEditComplete', [ $this, $revision,
false,
$user ] );
1879 !count( $this->mTitle->getUserPermissionsErrors(
'autopatrol',
$user ) );
1884 $revision->isMinor(),
1896 $user->incEditCount();
1898 $dbw->endAtomic( __METHOD__ );
1899 $this->mTimestamp = $now;
1902 $status->value[
'revision'] = $revision;
1905 DeferredUpdates::addUpdate(
1919 Hooks::run(
'PageContentInsertComplete',
$params );
1922 Hooks::run(
'PageContentSaveComplete',
$params );
1925 DeferredUpdates::PRESEND
1948 if ( $this->
getTitle()->isConversionTable() ) {
1951 $options->disableContentConversion();
1974 $serialFormat =
null, $useCache =
true
1978 if ( is_object( $revision ) ) {
1979 $revid = $revision->getId();
1984 if ( $revid !==
null ) {
1995 if ( $serialFormat ===
null ) {
1996 $serialFormat =
$content->getContentHandler()->getDefaultFormat();
1999 if ( $this->mPreparedEdit
2000 && isset( $this->mPreparedEdit->newContent )
2001 && $this->mPreparedEdit->newContent->equals(
$content )
2002 && $this->mPreparedEdit->revid == $revid
2003 && $this->mPreparedEdit->format == $serialFormat
2016 Hooks::run(
'ArticlePrepareTextForEdit', [ $this, $popts ] );
2019 if ( $cachedEdit ) {
2020 $edit->timestamp = $cachedEdit->timestamp;
2025 $edit->revid = $revid;
2027 if ( $cachedEdit ) {
2028 $edit->pstContent = $cachedEdit->pstContent;
2031 ?
$content->preSaveTransform( $this->mTitle,
$user, $popts )
2035 $edit->format = $serialFormat;
2037 if ( $cachedEdit ) {
2038 $edit->output = $cachedEdit->output;
2045 $oldCallback = $edit->popts->getCurrentRevisionCallback();
2046 $edit->popts->setCurrentRevisionCallback(
2048 if (
$title->equals( $revision->getTitle() ) ) {
2051 return call_user_func( $oldCallback, $title, $parser );
2057 $dbIndex = ( $this->mDataLoadedFrom & self::READ_LATEST ) === self::READ_LATEST
2061 $edit->popts->setSpeculativeRevIdCallback(
function ()
use ( $dbIndex ) {
2062 return 1 + (int)
wfGetDB( $dbIndex )->selectField(
2070 $edit->output = $edit->pstContent
2071 ? $edit->pstContent->getParserOutput( $this->mTitle, $revid, $edit->popts )
2079 $edit->newText = $edit->newContent
2082 $edit->oldText = $edit->oldContent
2085 $edit->pst = $edit->pstContent ? $edit->pstContent->serialize( $serialFormat ) :
'';
2087 if ( $edit->output ) {
2092 $this->mPreparedEdit = $edit;
2125 'restored' =>
false,
2126 'oldrevision' =>
null,
2127 'oldcountable' => null
2131 $logger = LoggerFactory::getInstance(
'SaveParse' );
2135 if ( !$this->mPreparedEdit ) {
2136 $logger->debug( __METHOD__ .
": No prepared edit...\n" );
2137 } elseif ( $this->mPreparedEdit->output->getFlag(
'vary-revision' ) ) {
2138 $logger->info( __METHOD__ .
": Prepared edit has vary-revision...\n" );
2139 } elseif ( $this->mPreparedEdit->output->getFlag(
'vary-revision-id' )
2140 && $this->mPreparedEdit->output->getSpeculativeRevIdUsed() !== $revision->
getId()
2142 $logger->info( __METHOD__ .
": Prepared edit has vary-revision-id with wrong ID...\n" );
2143 } elseif ( $this->mPreparedEdit->output->getFlag(
'vary-user' ) && !
$options[
'changed'] ) {
2144 $logger->info( __METHOD__ .
": Prepared edit has vary-user and is null...\n" );
2146 wfDebug( __METHOD__ .
": Using prepared edit...\n" );
2160 $editInfo->output, $this, $editInfo->popts,
2167 $updates =
$content->getSecondaryDataUpdates(
2168 $this->
getTitle(),
null, $recursive, $editInfo->output
2170 foreach ( $updates
as $update ) {
2172 $update->setRevision( $revision );
2173 $update->setTriggeringUser(
$user );
2175 DeferredUpdates::addUpdate( $update );
2188 'pageId' => $this->
getId(),
2198 Hooks::run(
'ArticleEditUpdates', [ &$wikiPage, &$editInfo,
$options[
'changed'] ] );
2200 if ( Hooks::run(
'ArticleEditUpdatesDeleteFromRecentchanges', [ &$wikiPage ] ) ) {
2202 if ( mt_rand( 0, 9 ) == 0 ) {
2207 if ( !$this->
exists() ) {
2211 $id = $this->
getId();
2212 $title = $this->mTitle->getPrefixedDBkey();
2213 $shortTitle = $this->mTitle->getDBkey();
2215 if (
$options[
'oldcountable'] ===
'no-change' ||
2221 } elseif (
$options[
'oldcountable'] !==
null ) {
2226 $edits =
$options[
'changed'] ? 1 : 0;
2227 $total =
$options[
'created'] ? 1 : 0;
2229 DeferredUpdates::addUpdate(
new SiteStatsUpdate( 0, $edits, $good, $total ) );
2237 && $shortTitle !=
$user->getTitleKey()
2238 && !( $revision->
isMinor() &&
$user->isAllowed(
'nominornewtalk' ) )
2240 $recipient = User::newFromName( $shortTitle,
false );
2241 if ( !$recipient ) {
2242 wfDebug( __METHOD__ .
": invalid username\n" );
2249 if ( Hooks::run(
'ArticleEditUpdateNewTalk', [ &$wikiPage, $recipient ] ) ) {
2250 if ( User::isIP( $shortTitle ) ) {
2252 $recipient->setNewtalk(
true, $revision );
2253 } elseif ( $recipient->isLoggedIn() ) {
2254 $recipient->setNewtalk(
true, $revision );
2256 wfDebug( __METHOD__ .
": don't need to notify a nonexistent user\n" );
2292 &$cascade, $reason,
User $user, $tags =
null
2301 $restrictionTypes = $this->mTitle->getRestrictionTypes();
2302 $id = $this->
getId();
2309 Title::purgeExpiredRestrictions();
2313 $isProtected =
false;
2319 foreach ( $restrictionTypes
as $action ) {
2320 if ( !isset( $expiry[$action] ) || $expiry[$action] === $dbw->getInfinity() ) {
2321 $expiry[$action] =
'infinity';
2323 if ( !isset(
$limit[$action] ) ) {
2325 } elseif (
$limit[$action] !=
'' ) {
2330 $current = implode(
'', $this->mTitle->getRestrictions( $action ) );
2331 if ( $current !=
'' ) {
2332 $isProtected =
true;
2335 if (
$limit[$action] != $current ) {
2337 } elseif (
$limit[$action] !=
'' ) {
2341 if ( $this->mTitle->getRestrictionExpiry( $action ) != $expiry[$action] ) {
2347 if ( !$changed && $protect && $this->mTitle->areRestrictionsCascading() != $cascade ) {
2353 return Status::newGood();
2357 $revCommentMsg =
'unprotectedarticle-comment';
2358 $logAction =
'unprotect';
2359 } elseif ( $isProtected ) {
2360 $revCommentMsg =
'modifiedarticleprotection-comment';
2361 $logAction =
'modify';
2363 $revCommentMsg =
'protectedarticle-comment';
2364 $logAction =
'protect';
2370 $logRelationsValues = [];
2371 $logRelationsField =
null;
2372 $logParamsDetails = [];
2375 $nullRevision =
null;
2381 if ( !Hooks::run(
'ArticleProtect', [ &$wikiPage, &
$user,
$limit, $reason ] ) ) {
2382 return Status::newGood();
2386 $editrestriction = isset(
$limit[
'edit'] )
2388 : $this->mTitle->getRestrictions(
'edit' );
2389 foreach ( array_keys( $editrestriction,
'sysop' )
as $key ) {
2390 $editrestriction[$key] =
'editprotected';
2392 foreach ( array_keys( $editrestriction,
'autoconfirmed' )
as $key ) {
2393 $editrestriction[$key] =
'editsemiprotected';
2397 foreach ( array_keys( $cascadingRestrictionLevels,
'sysop' )
as $key ) {
2398 $cascadingRestrictionLevels[$key] =
'editprotected';
2400 foreach ( array_keys( $cascadingRestrictionLevels,
'autoconfirmed' )
as $key ) {
2401 $cascadingRestrictionLevels[$key] =
'editsemiprotected';
2405 if ( !array_intersect( $editrestriction, $cascadingRestrictionLevels ) ) {
2420 if ( $nullRevision ===
null ) {
2421 return Status::newFatal(
'no-null-revision', $this->mTitle->getPrefixedText() );
2424 $logRelationsField =
'pr_id';
2427 foreach (
$limit as $action => $restrictions ) {
2429 'page_restrictions',
2432 'pr_type' => $action
2436 if ( $restrictions !=
'' ) {
2437 $cascadeValue = ( $cascade && $action ==
'edit' ) ? 1 : 0;
2439 'page_restrictions',
2441 'pr_id' => $dbw->nextSequenceValue(
'page_restrictions_pr_id_seq' ),
2443 'pr_type' => $action,
2444 'pr_level' => $restrictions,
2445 'pr_cascade' => $cascadeValue,
2446 'pr_expiry' => $dbw->encodeExpiry( $expiry[$action] )
2450 $logRelationsValues[] = $dbw->insertId();
2451 $logParamsDetails[] = [
2453 'level' => $restrictions,
2454 'expiry' => $expiry[$action],
2455 'cascade' => (bool)$cascadeValue,
2463 [
'page_restrictions' =>
'' ],
2464 [
'page_id' => $id ],
2471 Hooks::run(
'NewRevisionFromEditComplete',
2472 [ $this, $nullRevision, $latest,
$user ] );
2473 Hooks::run(
'ArticleProtectComplete', [ &$wikiPage, &
$user,
$limit, $reason ] );
2478 if (
$limit[
'create'] !=
'' ) {
2479 $dbw->replace(
'protected_titles',
2480 [ [
'pt_namespace',
'pt_title' ] ],
2482 'pt_namespace' => $this->mTitle->getNamespace(),
2483 'pt_title' => $this->mTitle->getDBkey(),
2484 'pt_create_perm' =>
$limit[
'create'],
2485 'pt_timestamp' => $dbw->timestamp(),
2486 'pt_expiry' => $dbw->encodeExpiry( $expiry[
'create'] ),
2487 'pt_user' =>
$user->getId(),
2488 'pt_reason' => $reason,
2491 $logParamsDetails[] = [
2493 'level' =>
$limit[
'create'],
2494 'expiry' => $expiry[
'create'],
2497 $dbw->delete(
'protected_titles',
2499 'pt_namespace' => $this->mTitle->getNamespace(),
2500 'pt_title' => $this->mTitle->getDBkey()
2506 $this->mTitle->flushRestrictions();
2509 if ( $logAction ==
'unprotect' ) {
2514 '4::description' => $protectDescriptionLog,
2515 '5:bool:cascade' => $cascade,
2516 'details' => $logParamsDetails,
2522 $logEntry->setTarget( $this->mTitle );
2523 $logEntry->setComment( $reason );
2524 $logEntry->setPerformer(
$user );
2525 $logEntry->setParameters(
$params );
2526 if ( !is_null( $nullRevision ) ) {
2527 $logEntry->setAssociatedRevId( $nullRevision->getId() );
2529 $logEntry->setTags( $tags );
2530 if ( $logRelationsField !==
null && count( $logRelationsValues ) ) {
2531 $logEntry->setRelations( [ $logRelationsField => $logRelationsValues ] );
2533 $logId = $logEntry->insert();
2534 $logEntry->publish( $logId );
2536 return Status::newGood( $logId );
2551 array $expiry, $cascade, $reason, $user =
null
2558 $this->mTitle->getPrefixedText(),
2560 )->inContentLanguage()->text();
2562 $editComment .=
wfMessage(
'colon-separator' )->inContentLanguage()->text() . $reason;
2565 if ( $protectDescription ) {
2566 $editComment .=
wfMessage(
'word-separator' )->inContentLanguage()->text();
2567 $editComment .=
wfMessage(
'parentheses' )->params( $protectDescription )
2568 ->inContentLanguage()->text();
2571 $editComment .=
wfMessage(
'word-separator' )->inContentLanguage()->text();
2572 $editComment .=
wfMessage(
'brackets' )->params(
2573 wfMessage(
'protect-summary-cascade' )->inContentLanguage()->
text()
2574 )->inContentLanguage()->text();
2579 $nullRev->insertOn( $dbw );
2582 $oldLatest = $nullRev->getParentId();
2596 if ( $expiry !=
'infinity' ) {
2599 $wgContLang->timeanddate( $expiry,
false,
false ),
2602 )->inContentLanguage()->text();
2604 return wfMessage(
'protect-expiry-indefinite' )
2605 ->inContentLanguage()->text();
2617 $protectDescription =
'';
2619 foreach ( array_filter(
$limit )
as $action => $restrictions ) {
2620 # $action is one of $wgRestrictionTypes = [ 'create', 'edit', 'move', 'upload' ].
2621 # All possible message keys are listed here for easier grepping:
2622 # * restriction-create
2623 # * restriction-edit
2624 # * restriction-move
2625 # * restriction-upload
2626 $actionText =
wfMessage(
'restriction-' . $action )->inContentLanguage()->text();
2627 # $restrictions is one of $wgRestrictionLevels = [ '', 'autoconfirmed', 'sysop' ],
2628 # with '' filtered out. All possible message keys are listed below:
2629 # * protect-level-autoconfirmed
2630 # * protect-level-sysop
2631 $restrictionsText =
wfMessage(
'protect-level-' . $restrictions )
2632 ->inContentLanguage()->text();
2636 if ( $protectDescription !==
'' ) {
2637 $protectDescription .=
wfMessage(
'word-separator' )->inContentLanguage()->text();
2639 $protectDescription .=
wfMessage(
'protect-summary-desc' )
2640 ->params( $actionText, $restrictionsText, $expiryText )
2641 ->inContentLanguage()->text();
2644 return $protectDescription;
2661 $protectDescriptionLog =
'';
2663 foreach ( array_filter(
$limit )
as $action => $restrictions ) {
2665 $protectDescriptionLog .=
$wgContLang->getDirMark() .
2666 "[$action=$restrictions] ($expiryText)";
2669 return trim( $protectDescriptionLog );
2682 if ( !is_array(
$limit ) ) {
2683 throw new MWException( __METHOD__ .
' given non-array restriction set' );
2689 foreach ( array_filter(
$limit )
as $action => $restrictions ) {
2690 $bits[] =
"$action=$restrictions";
2693 return implode(
':', $bits );
2713 $reason, $suppress =
false, $u1 =
null, $u2 =
null, &$error =
'',
User $user =
null
2738 $reason, $suppress =
false, $u1 =
null, $u2 =
null, &$error =
'',
User $user =
null,
2739 $tags = [], $logsubtype =
'delete'
2747 if ( $this->mTitle->getDBkey() ===
'' ) {
2748 $status->error(
'cannotdelete',
2757 if ( !Hooks::run(
'ArticleDelete',
2758 [ &$wikiPage, &
$user, &$reason, &$error, &
$status, $suppress ]
2762 $status->fatal(
'delete-hook-aborted' );
2768 $dbw->startAtomic( __METHOD__ );
2771 $id = $this->
getId();
2777 if ( $id == 0 || $this->
getLatest() != $lockedLatest ) {
2778 $dbw->endAtomic( __METHOD__ );
2780 $status->error(
'cannotdelete',
2786 $namespace = $this->
getTitle()->getNamespace();
2787 $dbKey = $this->
getTitle()->getDBkey();
2798 }
catch ( Exception $ex ) {
2799 wfLogWarning( __METHOD__ .
': failed to load content during deletion! '
2800 . $ex->getMessage() );
2811 $fields = array_diff( $fields, [
'rev_deleted' ] );
2822 $res = $dbw->select(
2825 [
'rev_page' => $id ],
2831 foreach (
$res as $row ) {
2833 'ar_namespace' => $namespace,
2834 'ar_title' => $dbKey,
2835 'ar_comment' => $row->rev_comment,
2836 'ar_user' => $row->rev_user,
2837 'ar_user_text' => $row->rev_user_text,
2838 'ar_timestamp' => $row->rev_timestamp,
2839 'ar_minor_edit' => $row->rev_minor_edit,
2840 'ar_rev_id' => $row->rev_id,
2841 'ar_parent_id' => $row->rev_parent_id,
2842 'ar_text_id' => $row->rev_text_id,
2845 'ar_len' => $row->rev_len,
2846 'ar_page_id' => $id,
2847 'ar_deleted' => $suppress ? $bitfield : $row->rev_deleted,
2848 'ar_sha1' => $row->rev_sha1,
2851 $rowInsert[
'ar_content_model'] = $row->rev_content_model;
2852 $rowInsert[
'ar_content_format'] = $row->rev_content_format;
2854 $rowsInsert[] = $rowInsert;
2857 $dbw->insert(
'archive', $rowsInsert, __METHOD__ );
2859 $archivedRevisionCount = $dbw->affectedRows();
2864 $wikiPageBeforeDelete = clone $this;
2867 $dbw->delete(
'page', [
'page_id' => $id ], __METHOD__ );
2868 $dbw->delete(
'revision', [
'rev_page' => $id ], __METHOD__ );
2871 $logtype = $suppress ?
'suppress' :
'delete';
2874 $logEntry->setPerformer(
$user );
2875 $logEntry->setTarget( $logTitle );
2876 $logEntry->setComment( $reason );
2877 $logEntry->setTags( $tags );
2878 $logid = $logEntry->insert();
2880 $dbw->onTransactionPreCommitOrIdle(
2881 function ()
use ( $dbw, $logEntry, $logid ) {
2883 $logEntry->publish( $logid );
2888 $dbw->endAtomic( __METHOD__ );
2892 Hooks::run(
'ArticleDeleteComplete', [
2893 &$wikiPageBeforeDelete,
2899 $archivedRevisionCount
2904 $cache = ObjectCache::getMainStashInstance();
2905 $key =
wfMemcKey(
'page-recent-delete', md5( $logTitle->getPrefixedText() ) );
2906 $cache->set( $key, 1, $cache::TTL_DAY );
2922 'page_id' => $this->
getId(),
2925 'page_namespace' => $this->
getTitle()->getNamespace(),
2926 'page_title' => $this->
getTitle()->getDBkey()
2945 }
catch ( Exception $ex ) {
2952 DeferredUpdates::addUpdate(
new SiteStatsUpdate( 0, 1, - (
int)$countable, -1 ) );
2956 foreach ( $updates
as $update ) {
2957 DeferredUpdates::addUpdate( $update );
2964 if ( $this->mTitle->getNamespace() ==
NS_FILE ) {
2971 $this->mTitle, $revision,
null,
wfWikiID()
2978 DeferredUpdates::addUpdate(
new SearchUpdate( $id, $this->mTitle ) );
3011 $fromP, $summary, $token, $bot, &$resultDetails,
User $user, $tags =
null
3013 $resultDetails =
null;
3016 $editErrors = $this->mTitle->getUserPermissionsErrors(
'edit',
$user );
3017 $rollbackErrors = $this->mTitle->getUserPermissionsErrors(
'rollback',
$user );
3018 $errors = array_merge( $editErrors,
wfArrayDiff2( $rollbackErrors, $editErrors ) );
3020 if ( !
$user->matchEditToken( $token,
'rollback' ) ) {
3021 $errors[] = [
'sessionfailure' ];
3024 if (
$user->pingLimiter(
'rollback' ) ||
$user->pingLimiter() ) {
3025 $errors[] = [
'actionthrottledtext' ];
3029 if ( !empty( $errors ) ) {
3057 &$resultDetails,
User $guser, $tags =
null
3064 return [ [
'readonlytext' ] ];
3069 if ( is_null( $current ) ) {
3071 return [ [
'notanarticle' ] ];
3074 $from = str_replace(
'_',
' ', $fromP );
3077 if ( $from != $current->getUserText() ) {
3078 $resultDetails = [
'current' => $current ];
3079 return [ [
'alreadyrolled',
3080 htmlspecialchars( $this->mTitle->getPrefixedText() ),
3081 htmlspecialchars( $fromP ),
3082 htmlspecialchars( $current->getUserText() )
3089 $user_text = $dbw->addQuotes( $current->getUserText(
Revision::RAW ) );
3090 $s = $dbw->selectRow(
'revision',
3091 [
'rev_id',
'rev_timestamp',
'rev_deleted' ],
3092 [
'rev_page' => $current->getPage(),
3093 "rev_user != {$user} OR rev_user_text != {$user_text}"
3095 [
'USE INDEX' =>
'page_timestamp',
3096 'ORDER BY' =>
'rev_timestamp DESC' ]
3098 if (
$s ===
false ) {
3100 return [ [
'cantrollback' ] ];
3105 return [ [
'notvisiblerev' ] ];
3110 if ( empty( $summary ) ) {
3111 if ( $from ==
'' ) {
3112 $summary =
wfMessage(
'revertpage-nouser' );
3120 $target->getUserText(), $from,
$s->rev_id,
3122 $current->getId(),
$wgContLang->timeanddate( $current->getTimestamp() )
3124 if ( $summary instanceof
Message ) {
3125 $summary = $summary->params(
$args )->inContentLanguage()->text();
3131 $summary = trim( $summary );
3134 $summary =
$wgContLang->truncate( $summary, 255 );
3139 if ( $guser->
isAllowed(
'minoredit' ) ) {
3143 if ( $bot && ( $guser->
isAllowedAny(
'markbotedits',
'bot' ) ) ) {
3147 $targetContent = $target->getContent();
3148 $changingContentModel = $targetContent->getModel() !== $current->getContentModel();
3164 if ( $bot && $guser->
isAllowed(
'markbotedits' ) ) {
3171 $set[
'rc_patrolled'] = 1;
3174 if ( count( $set ) ) {
3175 $dbw->update(
'recentchanges', $set,
3177 'rc_cur_id' => $current->getPage(),
3178 'rc_user_text' => $current->getUserText(),
3179 'rc_timestamp > ' . $dbw->addQuotes(
$s->rev_timestamp ),
3186 return $status->getErrorsArray();
3190 $statusRev = isset(
$status->value[
'revision'] )
3193 if ( !( $statusRev instanceof
Revision ) ) {
3194 $resultDetails = [
'current' => $current ];
3195 return [ [
'alreadyrolled',
3196 htmlspecialchars( $this->mTitle->getPrefixedText() ),
3197 htmlspecialchars( $fromP ),
3198 htmlspecialchars( $current->getUserText() )
3202 if ( $changingContentModel ) {
3206 $log->setPerformer( $guser );
3207 $log->setTarget( $this->mTitle );
3208 $log->setComment( $summary );
3209 $log->setParameters( [
3210 '4::oldmodel' => $current->getContentModel(),
3211 '5::newmodel' => $targetContent->getModel(),
3214 $logId = $log->insert( $dbw );
3215 $log->publish( $logId );
3218 $revId = $statusRev->getId();
3220 Hooks::run(
'ArticleRollbackComplete', [ $this, $guser, $target, $current ] );
3223 'summary' => $summary,
3224 'current' => $current,
3225 'target' => $target,
3245 $other =
$title->getOtherPage();
3247 $other->purgeSquid();
3251 $title->deleteTitleProtection();
3253 MediaWikiServices::getInstance()->getLinkCache()->invalidateTitle(
$title );
3263 Category::newFromTitle(
$title )->getID();
3274 $other =
$title->getOtherPage();
3276 $other->purgeSquid();
3281 MediaWikiServices::getInstance()->getLinkCache()->invalidateTitle(
$title );
3299 $user = User::newFromName(
$title->getText(),
false );
3301 $user->setNewtalk(
false );
3322 MediaWikiServices::getInstance()->getLinkCache()->invalidateTitle(
$title );
3329 $revid = $revision ? $revision->getId() :
null;
3330 DeferredUpdates::addCallableUpdate(
function()
use (
$title, $revid ) {
3344 $id = $this->
getId();
3350 $res =
$dbr->select(
'categorylinks',
3351 [
'cl_to AS page_title, ' .
NS_CATEGORY .
' AS page_namespace' ],
3354 [
'cl_from' => $id ],
3368 $id = $this->
getId();
3375 $res =
$dbr->select( [
'categorylinks',
'page_props',
'page' ],
3377 [
'cl_from' => $id,
'pp_page=page_id',
'pp_propname' =>
'hiddencat',
3378 'page_namespace' =>
NS_CATEGORY,
'page_title=cl_to' ],
3381 if (
$res !==
false ) {
3382 foreach (
$res as $row ) {
3412 $id = $id ?: $this->
getId();
3413 $ns = $this->
getTitle()->getNamespace();
3415 $addFields = [
'cat_pages = cat_pages + 1' ];
3416 $removeFields = [
'cat_pages = cat_pages - 1' ];
3418 $addFields[] =
'cat_subcats = cat_subcats + 1';
3419 $removeFields[] =
'cat_subcats = cat_subcats - 1';
3421 $addFields[] =
'cat_files = cat_files + 1';
3422 $removeFields[] =
'cat_files = cat_files - 1';
3427 if ( count( $added ) ) {
3428 $existingAdded = $dbw->selectFieldValues(
3431 [
'cat_title' => $added ],
3438 if ( count( $existingAdded ) ) {
3442 [
'cat_title' => $existingAdded ],
3447 $missingAdded = array_diff( $added, $existingAdded );
3448 if ( count( $missingAdded ) ) {
3450 foreach ( $missingAdded
as $cat ) {
3452 'cat_title' => $cat,
3455 'cat_files' => ( $ns ==
NS_FILE ) ? 1 : 0,
3468 if ( count( $deleted ) ) {
3472 [
'cat_title' => $deleted ],
3477 foreach ( $added
as $catName ) {
3478 $cat = Category::newFromName( $catName );
3479 Hooks::run(
'CategoryAfterPageAdded', [ $cat, $this ] );
3482 foreach ( $deleted
as $catName ) {
3483 $cat = Category::newFromName( $catName );
3484 Hooks::run(
'CategoryAfterPageRemoved', [ $cat, $this, $id ] );
3490 if ( count( $deleted ) ) {
3491 $rows = $dbw->select(
3493 [
'cat_id',
'cat_title',
'cat_pages',
'cat_subcats',
'cat_files' ],
3494 [
'cat_title' => $deleted,
'cat_pages <= 0' ],
3497 foreach ( $rows
as $row ) {
3498 $cat = Category::newFromRow( $row );
3500 DeferredUpdates::addCallableUpdate(
function ()
use ( $cat ) {
3501 $cat->refreshCounts();
3518 if ( !Hooks::run(
'OpportunisticLinksUpdate',
3527 'isOpportunistic' =>
true,
3531 if ( $this->mTitle->areRestrictionsCascading() ) {
3536 } elseif ( !$config->get(
'MiserMode' ) &&
$parserOutput->hasDynamicContent() ) {
3546 $cache = ObjectCache::getLocalClusterInstance();
3547 $key =
$cache->makeKey(
'dynamic-linksupdate',
'last', $this->
getId() );
3549 if (
$cache->add( $key, time(), $ttl ) ) {
3573 }
catch ( Exception $ex ) {
3584 $updates =
$content->getDeletionUpdates( $this );
3587 Hooks::run(
'WikiPageDeletionUpdates', [ $this,
$content, &$updates ] );
3625 return $this->
getTitle()->getCanonicalURL();
3634 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
3636 return $linkCache->getMutableCacheKeys(
$cache, $this->
getTitle()->getTitleValue() );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
bool $wgPageLanguageUseDB
Enable page language feature Allows setting page language in database.
$wgCascadingRestrictionLevels
Restriction levels that can be used with cascading protection.
$wgUseAutomaticEditSummaries
If user doesn't specify any edit summary when making a an edit, MediaWiki will try to automatically c...
$wgSitename
Name of the site.
$wgUseRCPatrol
Use RC Patrolling to check for vandalism (from recent changes and watchlists) New pages and new files...
$wgUseNPPatrol
Use new page patrolling to check new pages on Special:Newpages.
$wgArticleCountMethod
Method used to determine if a page in a content namespace should be counted as a valid article.
$wgAjaxEditStash
Have clients send edits to be prepared when filling in edit summaries.
$wgRCWatchCategoryMembership
Treat category membership changes as a RecentChange.
$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.
wfRandom()
Get a random decimal value between 0 and 1, in a way not likely to give duplicate values for any real...
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
wfTimestampOrNull( $outputtype=TS_UNIX, $ts=null)
Return a formatted timestamp, or null if input is null.
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfIncrStats( $key, $count=1)
Increment a statistics counter.
wfGetLB( $wiki=false)
Get a load balancer object.
wfReadOnly()
Check whether the wiki is in read-only mode.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfMemcKey()
Make a cache key for the local wiki.
wfArrayDiff2( $a, $b)
Like array_diff( $a, $b ) except that it works with two-dimensional arrays.
wfReadOnlyReason()
Check if the site is in read-only mode and return the message if so.
wfLogWarning( $msg, $callerOffset=1, $level=E_USER_WARNING)
Send a warning as a PHP error and the debug log.
wfMsgReplaceArgs( $message, $args)
Replace message parameter keys on the given formatted output.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
static checkCache(Title $title, Content $content, User $user)
Check that a prepared edit is in cache and still up-to-date.
Deferrable Update for closure/callback updates via IDatabase::doAtomicSection()
Job to add recent change entries mentioning category membership changes.
Handles purging appropriate CDN URLs given a title (or titles)
static getForModelID( $modelId)
Returns the ContentHandler singleton for the given model ID.
static getLocalizedName( $name, Language $lang=null)
Returns the localized name for a given content model.
static getContentText(Content $content=null)
Convenience function for getting flat text from a Content object.
static getDBOptions( $bitfield)
Get an appropriate DB index, options, and fallback DB index for a query.
Class to invalidate the HTML cache of all the pages linking to a given title.
static clearFileCache(Title $title)
Clear the file caches for a page for all actions.
static invalidateCache(Title $title, $revid=null)
Clear the info cache for a given Title.
static singleton( $wiki=false)
Class the manages updates of *_link tables as well as similar extension-managed tables.
static queueRecursiveJobsForTable(Title $title, $table)
Queue a RefreshLinks job for any table.
Class for creating log entries manually, to inject them into the database.
static singleton()
Get the signleton instance of this class.
The Message class provides methods which fulfil two basic services:
static singleton()
Get an instance of this object.
Set options of the Parser.
static newFromUserAndLang(User $user, Language $lang)
Get a ParserOptions object from a given user and language.
static notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot, $ip='', $size=0, $newId=0, $patrol=0, $tags=[])
Makes an entry in the database corresponding to page creation Note: the title object must be loaded w...
static notifyEdit( $timestamp, &$title, $minor, &$user, $comment, $oldId, $lastTimestamp, $bot, $ip='', $oldSize=0, $newSize=0, $newId=0, $patrol=0, $tags=[])
Makes an entry in the database corresponding to an edit.
static newPrioritized(Title $title, array $params)
static newDynamic(Title $title, array $params)
static singleton()
Get a RepoGroup instance.
static getMain()
Static methods.
static invalidateModuleCache(Title $title, Revision $old=null, Revision $new=null, $wikiId)
Clear the preloadTitleInfo() cache for all wiki modules on this wiki on page change if it was a JS or...
static newKnownCurrent(IDatabase $db, $pageId, $revId)
Load a revision based on a known page ID and current revision ID from the DB.
getContentHandler()
Returns the content handler appropriate for this revision's content model.
static newFromPageId( $pageId, $revId=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given page ID.
static selectFields()
Return the list of revision fields that should be selected to create a new revision.
static loadFromTimestamp( $db, $title, $timestamp)
Load the revision for the given title with the given timestamp.
static newNullRevision( $dbw, $pageId, $summary, $minor, $user=null)
Create a new null-revision for insertion into a page's history.
getContent( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision content if it's available to the specified audience.
static newFromId( $id, $flags=0)
Load a page revision from a given revision ID number.
Database independant search index updater.
Class for handling updates to the site_stats table.
static newFromResult( $res)
Represents a title within MediaWiki.
getNamespace()
Get the namespace index, i.e.
getFragment()
Get the Title fragment (i.e.
getDBkey()
Get the main part with underscores.
getInterwiki()
Get the interwiki prefix.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
isAllowed( $action='')
Internal mechanics of testing a permission.
isAllowedAny()
Check if user is allowed to access a feature / make an action.
Multi-datacenter aware caching interface.
Special handling for category pages.
Special handling for file pages.
Class representing a MediaWiki article and history.
static newFromID( $id, $from='fromdb')
Constructor from a page id.
doUpdateRestrictions(array $limit, array $expiry, &$cascade, $reason, User $user, $tags=null)
Update the article's restriction field, and leave a log entry.
getContributors()
Get a list of users who have edited this article, not including the user who made the most recent rev...
doPurge()
Perform the actions of a page purging.
followRedirect()
Get the Title object or URL this page redirects to.
insertOn( $dbw, $pageId=null)
Insert a new empty page record for this article.
updateCategoryCounts(array $added, array $deleted, $id=0)
Update all the appropriate counts in the category table, given that we've added the categories $added...
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
doEditContent(Content $content, $summary, $flags=0, $baseRevId=false, User $user=null, $serialFormat=null, $tags=[], $undidRevId=0)
Change an existing article or create a new article.
pageDataFromTitle( $dbr, $title, $options=[])
Fetch a page record matching the Title object's namespace and title using a sanitized title string.
checkFlags( $flags)
Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed.
static onArticleEdit(Title $title, Revision $revision=null)
Purge caches on page update etc.
isLocal()
Whether this content displayed on this page comes from the local database.
getRevision()
Get the latest revision.
getLinksTimestamp()
Get the page_links_updated field.
getMinorEdit()
Returns true if last revision was marked as "minor edit".
getUndoContent(Revision $undo, Revision $undoafter=null)
Get the content that needs to be saved in order to undo all revisions between $undo and $undoafter.
clearCacheFields()
Clear the object cache fields.
clearPreparedEdit()
Clear the mPreparedEdit cache field, as may be needed by mutable content types.
getLatest()
Get the page_latest field.
doViewUpdates(User $user, $oldid=0)
Do standard deferred updates after page view (existing or missing page)
updateIfNewerOn( $dbw, $revision)
If the given revision is newer than the currently set page_latest, update the page record.
__clone()
Makes sure that the mTitle object is cloned to the newly cloned WikiPage.
loadFromRow( $data, $from)
Load the object from a database row.
supportsSections()
Returns true if this page's content model supports sections.
getRedirectTarget()
If this page is a redirect, get its target.
setTimestamp( $ts)
Set the page timestamp (use only to avoid DB queries)
protectDescriptionLog(array $limit, array $expiry)
Builds the description to serve as comment for the log entry.
getUser( $audience=Revision::FOR_PUBLIC, User $user=null)
makeParserOptions( $context)
Get parser options suitable for rendering the primary article wikitext.
pageData( $dbr, $conditions, $options=[])
Fetch a page record with the given conditions.
getSourceURL()
Get the source URL for the content on this page, typically the canonical URL, but may be a remote lin...
getOldestRevision()
Get the Revision object of the oldest revision.
replaceSectionAtRev( $sectionId, Content $sectionContent, $sectionTitle='', $baseRevId=null)
setLastEdit(Revision $revision)
Set the latest revision.
stdClass $mPreparedEdit
Map of cache fields (text, parser output, ect) for a proposed/new edit.
updateRevisionOn( $dbw, $revision, $lastRevision=null, $lastRevIsRedirect=null)
Update the page record to point to a newly saved revision.
shouldCheckParserCache(ParserOptions $parserOptions, $oldId)
Should the parser cache be used?
loadLastEdit()
Loads everything except the text This isn't necessary for all uses, so it's only done if needed.
getUserText( $audience=Revision::FOR_PUBLIC, User $user=null)
doModify(Content $content, $flags, User $user, $summary, array $meta)
getContentModel()
Returns the page's content model id (see the CONTENT_MODEL_XXX constants).
pageDataFromId( $dbr, $id, $options=[])
Fetch a page record matching the requested ID.
const PURGE_CLUSTER_PCACHE
doEditUpdates(Revision $revision, User $user, array $options=[])
Do standard deferred updates after page edit.
insertRedirectEntry(Title $rt, $oldLatest=null)
Insert or update the redirect table entry for this page to indicate it redirects to $rt.
doDeleteArticle( $reason, $suppress=false, $u1=null, $u2=null, &$error='', User $user=null)
Same as doDeleteArticleReal(), but returns a simple boolean.
string $mTimestamp
Timestamp of the current revision or empty string if not loaded.
getHiddenCategories()
Returns a list of hidden categories this page is a member of.
getComment( $audience=Revision::FOR_PUBLIC, User $user=null)
static newFromRow( $row, $from='fromdb')
Constructor from a database row.
getAutoDeleteReason(&$hasHistory)
Auto-generates a deletion reason.
lockAndGetLatest()
Lock the page row for this title+id and return page_latest (or 0)
const PURGE_GLOBAL_PCACHE
static flattenRestrictions( $limit)
Take an array of page restrictions and flatten it to a string suitable for insertion into the page_re...
getParserOutput(ParserOptions $parserOptions, $oldid=null, $forceParse=false)
Get a ParserOutput for the given ParserOptions and revision ID.
updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect=null)
Add row to the redirect table if this is a redirect, remove otherwise.
prepareContentForEdit(Content $content, $revision=null, User $user=null, $serialFormat=null, $useCache=true)
Prepare content which is about to be saved.
hasViewableContent()
Check if this page is something we're going to be showing some sort of sensible content for.
triggerOpportunisticLinksUpdate(ParserOutput $parserOutput)
Opportunistically enqueue link update jobs given fresh parser output if useful.
getDeletionUpdates(Content $content=null)
Returns a list of updates to be performed when this page is deleted.
insertRedirect()
Insert an entry for this page into the redirect table if the content is a redirect.
getContent( $audience=Revision::FOR_PUBLIC, User $user=null)
Get the content of the current revision.
int $mDataLoadedFrom
One of the READ_* constants.
static onArticleDelete(Title $title)
Clears caches when article is deleted.
replaceSectionContent( $sectionId, Content $sectionContent, $sectionTitle='', $edittime=null)
static selectFields()
Return the list of revision fields that should be selected to create a new page.
insertProtectNullRevision( $revCommentMsg, array $limit, array $expiry, $cascade, $reason, $user=null)
Insert a new null revision for this page.
doDeleteUpdates( $id, Content $content=null, Revision $revision=null)
Do some database updates after deletion.
getTitle()
Get the title object of the article.
isRedirect()
Tests if the article content represents a redirect.
static onArticleCreate(Title $title)
The onArticle*() functions are supposed to be a kind of hooks which should be called whenever any of ...
commitRollback( $fromP, $summary, $bot, &$resultDetails, User $guser, $tags=null)
Backend implementation of doRollback(), please refer there for parameter and return value documentati...
getRedirectURL( $rt)
Get the Title object or URL to use for a redirect.
loadPageData( $from='fromdb')
Load the object from a given source by title.
doCreate(Content $content, $flags, User $user, $summary, array $meta)
checkTouched()
Loads page_touched and returns a value indicating if it should be used.
getLastPurgeTimestamp()
Get the last time a user explicitly purged the page via action=purge.
isCountable( $editInfo=false)
Determine whether a page would be suitable for being counted as an article in the site_stats table ba...
doRollback( $fromP, $summary, $token, $bot, &$resultDetails, User $user, $tags=null)
Roll back the most recent consecutive set of edits to a page from the same user; fails if there are n...
getContentHandler()
Returns the ContentHandler instance to be used to deal with the content of this WikiPage.
getWikiDisplayName()
The display name for the site this content come from.
static convertSelectType( $type)
Convert 'fromdb', 'fromdbmaster' and 'forupdate' to READ_* constants.
getCreator( $audience=Revision::FOR_PUBLIC, User $user=null)
Get the User object of the user who created the page.
getMutableCacheKeys(WANObjectCache $cache)
protectDescription(array $limit, array $expiry)
Builds the description to serve as comment for the edit.
getTouched()
Get the page_touched field.
__construct(Title $title)
Constructor and clear the article.
doDeleteArticleReal( $reason, $suppress=false, $u1=null, $u2=null, &$error='', User $user=null, $tags=[], $logsubtype='delete')
Back-end article deletion Deletes the article with database consistency, writes logs,...
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
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
when a variable name is used in a function
when a variable name is used in a it is silently declared as a new local masking the global
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
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
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 For a description of the see design txt $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
the array() calling protocol came about after MediaWiki 1.4rc1.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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 $parserOutput
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
error also a ContextSource you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
do that in ParserLimitReportFormat instead $parser
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 $page
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. & $title:Title object for the current page & $request:WebRequest & $ignoreRedirect:boolean to skip redirect check & $target:Title/string of redirect target & $article:Article object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) & $article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED! Use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language & $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED! Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language & $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Array with elements of the form "language:title" in the order that they will be output. & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED! Use HtmlPageLinkRendererBegin instead. Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
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 incomplete not yet checked for validity & $retval
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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 as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers please use GetContentModels hook to make them known to core if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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 as context as context $options
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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
namespace and then decline to actually register it file or subcat img or subcat $title
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 "<div ...>$1</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
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 & $sectionContent
it s the revision text itself In either if gzip is the revision text is gzipped $flags
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 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
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 & $ret
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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 as context $revId
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup 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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
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
returning false will NOT prevent logging $e
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
Base interface for content objects.
Interface for database access objects.
const READ_LOCKING
Constants for object loading bitfield flags (higher => higher QoS)
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)