Go to the documentation of this file.
113 'page_namespace' =>
$title->getNamespace(),
114 'page_title' =>
$title->getDBkey()
118 $conds[
'rev_id'] = $id;
122 $conds[] =
'rev_id=page_latest';
143 $conds =
array(
'page_id' => $pageId );
145 $conds[
'rev_id'] = $revId;
148 $conds[] =
'rev_id = page_latest';
165 global $wgContentHandlerUseDB;
168 'page' => isset( $row->ar_page_id ) ? $row->ar_page_id :
null,
169 'id' => isset( $row->ar_rev_id ) ? $row->ar_rev_id :
null,
170 'comment' => $row->ar_comment,
171 'user' => $row->ar_user,
172 'user_text' => $row->ar_user_text,
173 'timestamp' => $row->ar_timestamp,
174 'minor_edit' => $row->ar_minor_edit,
175 'text_id' => isset( $row->ar_text_id ) ? $row->ar_text_id :
null,
176 'deleted' => $row->ar_deleted,
177 'len' => $row->ar_len,
178 'sha1' => isset( $row->ar_sha1 ) ? $row->ar_sha1 :
null,
179 'content_model' => isset( $row->ar_content_model ) ? $row->ar_content_model :
null,
180 'content_format' => isset( $row->ar_content_format ) ? $row->ar_content_format :
null,
183 if ( !$wgContentHandlerUseDB ) {
185 unset(
$attribs[
'content_format'] );
189 && isset( $row->ar_namespace )
190 && isset( $row->ar_title ) ) {
195 if ( isset( $row->ar_text ) && !$row->ar_text_id ) {
199 throw new MWException(
'Unable to load text from archive row (possibly bug 22624)' );
212 return new self( $row );
223 public static function loadFromId( $db, $id ) {
238 $conds =
array(
'rev_page' => intval( $pageid ),
'page_id' => intval( $pageid ) );
240 $conds[
'rev_id'] = intval( $id );
242 $conds[] =
'rev_id=page_latest';
259 $matchId = intval( $id );
261 $matchId =
'page_latest';
266 'page_namespace' =>
$title->getNamespace(),
267 'page_title' =>
$title->getDBkey()
285 'rev_timestamp' => $db->timestamp(
$timestamp ),
286 'page_namespace' =>
$title->getNamespace(),
287 'page_title' =>
$title->getDBkey()
302 if ( is_null(
$rev ) &&
wfGetLB()->getServerCount() > 1 ) {
303 if ( !(
$flags & self::READ_LATEST ) ) {
326 $row =
$res->fetchObject();
348 'rev_id=page_latest',
349 'page_namespace' =>
$title->getNamespace(),
350 'page_title' =>
$title->getDBkey()
366 $fields = array_merge(
367 self::selectFields(),
368 self::selectPageFields(),
369 self::selectUserFields()
372 if ( (
$flags & self::READ_LOCKING ) == self::READ_LOCKING ) {
376 array(
'revision',
'page',
'user' ),
381 array(
'page' => self::pageJoinCond(),
'user' => self::userJoinCond() )
392 return array(
'LEFT JOIN',
array(
'rev_user != 0',
'user_id = rev_user' ) );
402 return array(
'INNER JOIN',
array(
'page_id = rev_page' ) );
411 global $wgContentHandlerUseDB;
428 if ( $wgContentHandlerUseDB ) {
429 $fields[] =
'rev_content_format';
430 $fields[] =
'rev_content_model';
442 global $wgContentHandlerUseDB;
460 if ( $wgContentHandlerUseDB ) {
461 $fields[] =
'ar_content_format';
462 $fields[] =
'ar_content_model';
499 return array(
'user_name' );
514 $res = $db->select(
'revision',
515 array(
'rev_id',
'rev_len' ),
516 array(
'rev_id' => $revIds ),
518 foreach (
$res as $row ) {
519 $revLens[$row->rev_id] = $row->rev_len;
533 if ( is_object( $row ) ) {
534 $this->mId = intval( $row->rev_id );
535 $this->mPage = intval( $row->rev_page );
536 $this->mTextId = intval( $row->rev_text_id );
537 $this->mComment = $row->rev_comment;
538 $this->mUser = intval( $row->rev_user );
539 $this->mMinorEdit = intval( $row->rev_minor_edit );
540 $this->mTimestamp = $row->rev_timestamp;
541 $this->mDeleted = intval( $row->rev_deleted );
543 if ( !isset( $row->rev_parent_id ) ) {
544 $this->mParentId =
null;
546 $this->mParentId = intval( $row->rev_parent_id );
549 if ( !isset( $row->rev_len ) ) {
552 $this->mSize = intval( $row->rev_len );
555 if ( !isset( $row->rev_sha1 ) ) {
558 $this->mSha1 = $row->rev_sha1;
561 if ( isset( $row->page_latest ) ) {
562 $this->mCurrent = ( $row->rev_id == $row->page_latest );
565 $this->mCurrent =
false;
566 $this->mTitle =
null;
569 if ( !isset( $row->rev_content_model ) || is_null( $row->rev_content_model ) ) {
570 $this->mContentModel =
null; # determine
on demand
if needed
572 $this->mContentModel = strval( $row->rev_content_model );
575 if ( !isset( $row->rev_content_format ) || is_null( $row->rev_content_format ) ) {
576 $this->mContentFormat =
null; # determine
on demand
if needed
578 $this->mContentFormat = strval( $row->rev_content_format );
583 if ( isset( $row->old_text ) ) {
584 $this->mTextRow = $row;
587 $this->mTextRow =
null;
591 $this->mUserText =
null;
592 if ( $this->mUser == 0 ) {
593 $this->mUserText = $row->rev_user_text;
594 } elseif ( isset( $row->user_name ) ) {
595 $this->mUserText = $row->user_name;
597 $this->mOrigUserText = $row->rev_user_text;
598 } elseif ( is_array( $row ) ) {
602 # if we have a content object, use it to set the model and type
603 if ( !empty( $row[
'content'] ) ) {
605 if ( !empty( $row[
'text_id'] ) ) {
606 throw new MWException(
"Text already stored in external store (id {$row['text_id']}), " .
607 "can't serialize content object" );
610 $row[
'content_model'] = $row[
'content']->getModel();
611 # note: mContentFormat is initializes later accordingly
612 # note: content is serialized later in this method!
613 # also set text to null?
616 $this->mId = isset( $row[
'id'] ) ? intval( $row[
'id'] ) : null;
617 $this->mPage = isset( $row[
'page'] ) ? intval( $row[
'page'] ) : null;
618 $this->mTextId = isset( $row[
'text_id'] ) ? intval( $row[
'text_id'] ) : null;
619 $this->mUserText = isset( $row[
'user_text'] )
620 ? strval( $row[
'user_text'] ) :
$wgUser->getName();
621 $this->mUser = isset( $row[
'user'] ) ? intval( $row[
'user'] ) :
$wgUser->
getId();
622 $this->mMinorEdit = isset( $row[
'minor_edit'] ) ? intval( $row[
'minor_edit'] ) : 0;
623 $this->mTimestamp = isset( $row[
'timestamp'] )
625 $this->mDeleted = isset( $row[
'deleted'] ) ? intval( $row[
'deleted'] ) : 0;
626 $this->mSize = isset( $row[
'len'] ) ? intval( $row[
'len'] ) : null;
627 $this->mParentId = isset( $row[
'parent_id'] ) ? intval( $row[
'parent_id'] ) : null;
628 $this->mSha1 = isset( $row[
'sha1'] ) ? strval( $row[
'sha1'] ) : null;
630 $this->mContentModel = isset( $row[
'content_model'] )
631 ? strval( $row[
'content_model'] ) : null;
632 $this->mContentFormat = isset( $row[
'content_format'] )
633 ? strval( $row[
'content_format'] ) : null;
636 $this->mComment = isset( $row[
'comment'] ) ? trim( strval( $row[
'comment'] ) ) : null;
637 $this->mText = isset( $row[
'text'] ) ? rtrim( strval( $row[
'text'] ) ) : null;
638 $this->mTextRow =
null;
640 $this->mTitle = isset( $row[
'title'] ) ? $row[
'title'] :
null;
643 if ( !empty( $row[
'content'] ) ) {
644 if ( !( $row[
'content'] instanceof
Content ) ) {
645 throw new MWException(
'`content` field must contain a Content object.' );
649 $this->mContent = $row[
'content'];
651 $this->mContentModel = $this->mContent->getModel();
652 $this->mContentHandler =
null;
654 $this->mText = $handler->serializeContent( $row[
'content'], $this->
getContentFormat() );
655 } elseif ( !is_null( $this->mText ) ) {
657 $this->mContent = $handler->unserializeContent( $this->mText );
661 if ( $this->mTitle && $this->mTitle->exists() ) {
662 if ( $this->mPage ===
null ) {
664 $this->mPage = $this->mTitle->getArticleID();
665 } elseif ( $this->mTitle->getArticleID() !==
$this->mPage ) {
668 wfDebug(
"Page ID " . $this->mPage .
" mismatches the ID " .
669 $this->mTitle->getArticleID() .
" provided by the Title object." );
673 $this->mCurrent =
false;
676 if ( !$this->mSize ) {
677 if ( !is_null( $this->mContent ) ) {
678 $this->mSize = $this->mContent->getSize();
680 #NOTE: this should never happen if we have either text or content object!
686 if ( $this->mSha1 ===
null ) {
687 $this->mSha1 = is_null( $this->mText ) ? null :
self::base36Sha1( $this->mText );
694 throw new MWException(
'Revision constructor passed invalid row format.' );
696 $this->mUnpatrolled =
null;
704 public function getId() {
714 public function setId( $id ) {
724 return $this->mTextId;
762 if ( isset( $this->mTitle ) ) {
766 if ( !is_null( $this->mId ) ) {
768 $row =
$dbr->selectRow(
769 array(
'page',
'revision' ),
770 self::selectPageFields(),
771 array(
'page_id=rev_page',
772 'rev_id' => $this->mId ),
779 if ( !$this->mTitle && !is_null( $this->mPage ) && $this->mPage > 0 ) {
817 public function getUser( $audience = self::FOR_PUBLIC,
User $user =
null ) {
818 if ( $audience == self::FOR_PUBLIC && $this->
isDeleted( self::DELETED_USER ) ) {
820 } elseif ( $audience == self::FOR_THIS_USER && !$this->
userCan( self::DELETED_USER,
$user ) ) {
850 if ( $audience == self::FOR_PUBLIC && $this->
isDeleted( self::DELETED_USER ) ) {
852 } elseif ( $audience == self::FOR_THIS_USER && !$this->
userCan( self::DELETED_USER,
$user ) ) {
865 if ( $this->mUserText ===
null ) {
867 if ( $this->mUserText ===
false ) {
868 # This shouldn't happen, but it can if the wiki was recovered
869 # via importing revs and there is no user table entry yet.
890 if ( $audience == self::FOR_PUBLIC && $this->
isDeleted( self::DELETED_COMMENT ) ) {
892 } elseif ( $audience == self::FOR_THIS_USER && !$this->
userCan( self::DELETED_COMMENT,
$user ) ) {
919 if ( $this->mUnpatrolled !==
null ) {
920 return $this->mUnpatrolled;
923 if ( $rc && $rc->getAttribute(
'rc_patrolled' ) == 0 ) {
924 $this->mUnpatrolled = $rc->getAttribute(
'rc_id' );
926 $this->mUnpatrolled = 0;
928 return $this->mUnpatrolled;
942 'rc_timestamp' =>
$dbr->timestamp( $this->getTimestamp() ),
943 'rc_this_oldid' => $this->
getId()
955 return ( $this->mDeleted & $field ) == $field;
983 public function getText( $audience = self::FOR_PUBLIC,
User $user =
null ) {
1005 if ( $audience == self::FOR_PUBLIC && $this->
isDeleted( self::DELETED_TEXT ) ) {
1007 } elseif ( $audience == self::FOR_THIS_USER && !$this->
userCan( self::DELETED_TEXT,
$user ) ) {
1024 return $this->
getText( self::RAW );
1034 if ( is_null( $this->mText ) ) {
1051 if ( is_null( $this->mContent ) ) {
1053 if ( is_null( $this->mText ) ) {
1057 if ( $this->mText !==
null && $this->mText !==
false ) {
1062 $this->mContent = $handler->unserializeContent( $this->mText, $format );
1064 $this->mContent =
false;
1069 return $this->mContent ? $this->mContent->copy() :
null;
1083 if ( !$this->mContentModel ) {
1087 assert( !empty( $this->mContentModel ) );
1103 if ( !$this->mContentFormat ) {
1105 $this->mContentFormat = $handler->getDefaultFormat();
1107 assert( !empty( $this->mContentFormat ) );
1120 if ( !$this->mContentHandler ) {
1126 if ( !$this->mContentHandler->isSupportedFormat( $format ) ) {
1127 throw new MWException(
"Oops, the content format $format is not supported for "
1128 .
"this content model, $model" );
1156 $prev = $this->
getTitle()->getPreviousRevisionID( $this->
getId() );
1171 $next = $this->
getTitle()->getNextRevisionID( $this->
getId() );
1187 if ( is_null( $this->mPage ) ) {
1190 # Use page_latest if ID is not given
1191 if ( !$this->mId ) {
1192 $prevId = $db->selectField(
'page',
'page_latest',
1193 array(
'page_id' => $this->mPage ),
1196 $prevId = $db->selectField(
'revision',
'rev_id',
1197 array(
'rev_page' => $this->mPage,
'rev_id < ' . $this->mId ),
1199 array(
'ORDER BY' =>
'rev_id DESC' ) );
1201 return intval( $prevId );
1217 public static function getRevisionText( $row, $prefix =
'old_', $wiki =
false ) {
1221 $textField = $prefix .
'text';
1222 $flagsField = $prefix .
'flags';
1224 if ( isset( $row->$flagsField ) ) {
1225 $flags = explode(
',', $row->$flagsField );
1230 if ( isset( $row->$textField ) ) {
1231 $text = $row->$textField;
1237 # Use external methods for external objects, text in table is URL-only then
1238 if ( in_array(
'external',
$flags ) ) {
1240 $parts = explode(
'://', $url, 2 );
1241 if ( count( $parts ) == 1 || $parts[1] ==
'' ) {
1249 if ( $text !==
false ) {
1267 global $wgCompressRevisions;
1270 # Revisions not marked this way will be converted
1271 # on load if $wgLegacyCharset is set in the future.
1274 if ( $wgCompressRevisions ) {
1275 if ( function_exists(
'gzdeflate' ) ) {
1276 $text = gzdeflate( $text );
1279 wfDebug( __METHOD__ .
" -- no zlib support, not compressing\n" );
1282 return implode(
',',
$flags );
1293 if ( in_array(
'gzip',
$flags ) ) {
1294 # Deal with optional compression of archived pages.
1295 # This can be done periodically via maintenance/compressOld.php, and
1296 # as pages are saved if $wgCompressRevisions is set.
1297 $text = gzinflate( $text );
1300 if ( in_array(
'object',
$flags ) ) {
1301 # Generic compressed storage
1302 $obj = unserialize( $text );
1303 if ( !is_object( $obj ) ) {
1307 $text = $obj->getText();
1310 global $wgLegacyEncoding;
1311 if ( $text !==
false && $wgLegacyEncoding
1312 && !in_array(
'utf-8',
$flags ) && !in_array(
'utf8',
$flags )
1314 # Old revisions kept around in a legacy encoding?
1315 # Upconvert on demand.
1316 # ("utf8" checked for compatibility with some broken
1317 # conversion scripts 2008-12-30)
1319 $text =
$wgContLang->iconv( $wgLegacyEncoding,
'UTF-8', $text );
1334 global $wgDefaultExternalStore, $wgContentHandlerUseDB;
1343 # Write to external storage if required
1344 if ( $wgDefaultExternalStore ) {
1349 throw new MWException(
"Unable to store text to external storage" );
1357 # Record the text (or external storage URL) to the text table
1358 if ( !isset( $this->mTextId ) ) {
1359 $old_id = $dbw->nextSequenceValue(
'text_old_id_seq' );
1360 $dbw->insert(
'text',
1362 'old_id' => $old_id,
1363 'old_text' => $data,
1367 $this->mTextId = $dbw->insertId();
1370 if ( $this->mComment ===
null ) {
1371 $this->mComment =
"";
1374 # Record the edit in revisions
1375 $rev_id = isset( $this->mId )
1377 : $dbw->nextSequenceValue(
'revision_rev_id_seq' );
1379 'rev_id' => $rev_id,
1380 'rev_page' => $this->mPage,
1381 'rev_text_id' => $this->mTextId,
1382 'rev_comment' => $this->mComment,
1383 'rev_minor_edit' => $this->mMinorEdit ? 1 : 0,
1384 'rev_user' => $this->mUser,
1385 'rev_user_text' => $this->mUserText,
1386 'rev_timestamp' => $dbw->timestamp( $this->mTimestamp ),
1389 'rev_parent_id' => is_null( $this->mParentId )
1392 'rev_sha1' => is_null( $this->mSha1 )
1397 if ( $wgContentHandlerUseDB ) {
1409 throw new MWException(
"Insufficient information to determine the title of the "
1410 .
"revision's page!" );
1416 $row[
'rev_content_model'] = ( $model === $defaultModel ) ?
null : $model;
1417 $row[
'rev_content_format'] = ( $format === $defaultFormat ) ?
null : $format;
1420 $dbw->insert(
'revision', $row, __METHOD__ );
1422 $this->mId = !is_null( $rev_id ) ? $rev_id : $dbw->insertId();
1431 global $wgContentHandlerUseDB;
1439 if ( !$handler->isSupportedFormat( $format ) ) {
1442 throw new MWException(
"Can't use format $format with content model $model on $t" );
1445 if ( !$wgContentHandlerUseDB &&
$title ) {
1451 $defaultFormat = $defaultHandler->getDefaultFormat();
1456 throw new MWException(
"Can't save non-default content model with "
1457 .
"\$wgContentHandlerUseDB disabled: model is $model, "
1458 .
"default for $t is $defaultModel" );
1464 throw new MWException(
"Can't use non-default content format with "
1465 .
"\$wgContentHandlerUseDB disabled: format is $format, "
1466 .
"default for $t is $defaultFormat" );
1472 if ( !$content || !$content->isValid() ) {
1475 throw new MWException(
"Content of $t is not valid! Content model is $model" );
1500 $key =
wfMemcKey(
'revisiontext',
'textid', $textId );
1501 if ( $wgRevisionCacheExpiry ) {
1503 if ( is_string( $text ) ) {
1504 wfDebug( __METHOD__ .
": got id $textId from cache\n" );
1511 if ( isset( $this->mTextRow ) ) {
1513 $this->mTextRow =
null;
1521 $row =
$dbr->selectRow(
'text',
1522 array(
'old_text',
'old_flags' ),
1523 array(
'old_id' => $textId ),
1530 if ( !$row && ( $forUpdate ||
wfGetLB()->getServerCount() > 1 ) ) {
1532 $row = $dbw->selectRow(
'text',
1533 array(
'old_text',
'old_flags' ),
1534 array(
'old_id' => $textId ),
1536 $forUpdate ?
array(
'FOR UPDATE' ) :
array() );
1540 wfDebugLog(
'Revision',
"No text row with ID '$textId' (revision {$this->getId()})." );
1544 if ( $row && $text ===
false ) {
1545 wfDebugLog(
'Revision',
"No blob for text row '$textId' (revision {$this->getId()})." );
1548 # No negative caching -- negative hits on text rows may be due to corrupted slave servers
1549 if ( $wgRevisionCacheExpiry && $text !==
false ) {
1550 $wgMemc->set( $key, $text, $wgRevisionCacheExpiry );
1573 global $wgContentHandlerUseDB;
1577 $fields =
array(
'page_latest',
'page_namespace',
'page_title',
1578 'rev_text_id',
'rev_len',
'rev_sha1' );
1580 if ( $wgContentHandlerUseDB ) {
1581 $fields[] =
'rev_content_model';
1582 $fields[] =
'rev_content_format';
1585 $current = $dbw->selectRow(
1586 array(
'page',
'revision' ),
1589 'page_id' => $pageId,
1590 'page_latest=rev_id',
1598 'minor_edit' => $minor,
1599 'text_id' => $current->rev_text_id,
1600 'parent_id' => $current->page_latest,
1601 'len' => $current->rev_len,
1602 'sha1' => $current->rev_sha1
1605 if ( $wgContentHandlerUseDB ) {
1606 $row[
'content_model'] = $current->rev_content_model;
1607 $row[
'content_format'] = $current->rev_content_format;
1611 $revision->setTitle(
Title::makeTitle( $current->page_namespace, $current->page_title ) );
1647 if ( $bitfield & $field ) {
1648 if ( $bitfield & self::DELETED_RESTRICTED ) {
1649 $permission =
'suppressrevision';
1650 } elseif ( $field & self::DELETED_TEXT ) {
1651 $permission =
'deletedtext';
1653 $permission =
'deletedhistory';
1655 wfDebug(
"Checking for $permission due to $field match on $bitfield\n" );
1656 if (
$user ===
null ) {
1660 return $user->isAllowed( $permission );
1679 $conds =
array(
'rev_id' => $id );
1680 $conds[
'rev_page'] =
$title->getArticleID();
1681 $timestamp =
$dbr->selectField(
'revision',
'rev_timestamp', $conds, __METHOD__ );
1683 # Not in slave, try master
1685 $timestamp = $dbw->selectField(
'revision',
'rev_timestamp', $conds, __METHOD__ );
1698 $row = $db->selectRow(
'revision',
array(
'revCount' =>
'COUNT(*)' ),
1699 array(
'rev_page' => $id ), __METHOD__ );
1701 return $row->revCount;
1714 $id =
$title->getArticleID();
1741 if ( is_int( $db ) ) {
1745 $res = $db->select(
'revision',
1748 'rev_page' => $pageId,
1749 'rev_timestamp > ' . $db->addQuotes( $db->timestamp( $since ) )
1752 array(
'ORDER BY' =>
'rev_timestamp ASC',
'LIMIT' => 50 ) );
1753 foreach (
$res as $row ) {
1754 if ( $row->rev_user != $userId ) {
static deprecated( $func, $version, $component=false)
Logs a deprecation warning, visible if $wgDevelopmentWarnings, but only if self::$enableDeprecationWa...
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
A content handler knows how do deal with a specific type of content on a wiki page.
static getForModelID( $modelId)
Returns the ContentHandler singleton for the given model ID.
getRawText()
Fetch revision text without regard for view restrictions.
getUserText( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision's username if it's available to the specified audience.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static newFromId( $id, $flags=0)
Load a page revision from a given revision ID number.
per default it will return the text for text based content
getPreviousRevisionId( $db)
Get previous revision Id for this page_id This is used to populate rev_parent_id on save.
getRawUser()
Fetch revision's user id without regard for the current user's permissions.
static pageJoinCond()
Return the value of a select() page conds array for the page table.
getUser( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision's user id if it's available to the specified audience.
static newNullRevision( $dbw, $pageId, $summary, $minor)
Create a new null-revision for insertion into a page's history.
loadText()
Lazy-load the revision's text.
null ContentHandler $mContentHandler
getSize()
Returns the length of the text in this revision, or null if unknown.
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 to get request data $wgMemc
wfGetLB( $wiki=false)
Get a load balancer object.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
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
setId( $id)
Set the revision ID.
getContent( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision content if it's available to the specified audience.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfDebugLog( $logGroup, $text, $dest='all')
Send a line to a supplementary debug log file, if configured, or main debug log if not.
wfProfileIn( $functionname)
Begin profiling of a function.
getPage()
Get the page ID.
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
static newFromConds( $conds, $fname=__METHOD__, $options=array())
Find the first recent change matching some specific conditions.
static getRevisionText( $row, $prefix='old_', $wiki=false)
Get revision text associated with an old or archive row $row is usually an object from wfFetchRow(),...
getParentId()
Get parent revision ID (the original previous page revision)
setTitle( $title)
Set the title of the revision.
getContentHandler()
Returns the content handler appropriate for this revision's content model.
static fetchFromConds( $db, $conditions, $flags=0)
Given a set of conditions, return a ResultWrapper which will return matching database rows with the f...
getSerializedData()
Fetch original serialized data without regard for view restrictions.
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision,...
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 content language as $wgContLang
const CONTENT_MODEL_WIKITEXT
static newFromPageId( $pageId, $revId=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given page ID.
getSha1()
Returns the base36 sha1 of the text in this revision, or null if unknown.
static loadFromId( $db, $id)
Load a page revision from a given revision ID number.
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Interface for database access objects.
getContentModel()
Returns the content model for this revision.
insertOn( $dbw)
Insert a new revision into the database, returning the new revision ID number on success and dies hor...
static base36Sha1( $text)
Get the base 36 SHA-1 value for a string of text.
static getTimestampFromId( $title, $id)
Get rev_timestamp from rev_id, without loading the rest of the row.
getRecentChange()
Get the RC object belonging to the current revision, if there's one.
static selectTextFields()
Return the list of text fields that should be selected to read the revision text.
static getDefaultModelFor(Title $title)
Returns the name of the default content model to be used for the page with the given title.
getNext()
Get next revision for this title.
wfMemcKey()
Get a cache key.
static newFromRow( $row)
Make a Title object from a DB row.
static insertToDefault( $data, array $params=array())
Like insert() above, but does more of the work for us.
static loadFromPageId( $db, $pageid, $id=0)
Load either the current, or a specified, revision that's attached to a given page.
static compressRevisionText(&$text)
If $wgCompressRevisions is enabled, we will compress data.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
static fetchRevision( $title)
Return a wrapper for a series of database rows to fetch all of a given page's revisions in turn.
when a variable name is used in a it is silently declared as a new masking the global
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
static countByTitle( $db, $title)
Get count of revisions per page...not very efficient.
getPrevious()
Get previous revision for this title.
static countByPageId( $db, $id)
Get count of revisions per page...not very efficient.
static newFromConds( $conditions, $flags=0)
Given a set of conditions, fetch a revision.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
static selectPageFields()
Return the list of page fields that should be selected from page table.
getTitle()
Returns the title of the page associated with this entry or null.
static userWasLastToEdit( $db, $pageId, $userId, $since)
Check if no edits were made by other users since the time a user started editing the page.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
static newFromTitle( $title, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given title.
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
__construct( $row)
Constructor.
presenting them properly to the user as errors is done by the caller $title
static selectArchiveFields()
Return the list of revision fields that should be selected to create a new revision from an archive r...
static whoIs( $id)
Get the username corresponding to a given user ID.
static getParentLengths( $db, array $revIds)
Do a batched query to get the parent revision lengths.
getVisibility()
Get the deletion bitfield of the revision.
getTextId()
Get text row ID.
getText( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision text if it's available to the specified audience.
static newFromArchiveRow( $row, $overrides=array())
Make a fake revision object from an archive table row.
Content null bool $mContent
getRawUserText()
Fetch revision's username without regard for view restrictions.
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 account $user
getContentFormat()
Returns the content format for this revision.
Base interface for content objects.
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
Represents a title within MediaWiki.
static getContentText(Content $content=null)
Convenience function for getting flat text from a Content object.
static fetchFromURL( $url, array $params=array())
Fetch data from given URL.
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going on
wfBaseConvert( $input, $sourceBase, $destBase, $pad=1, $lowercase=true, $engine='auto')
Convert an arbitrarily-long digit string from one numeric base to another, optionally zero-padding to...
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 needed(most notably, OutputPage::addWikiText()). The StandardSkin object is a complete implementation
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
static userJoinCond()
Return the value of a select() JOIN conds array for the user table.
static loadFromTimestamp( $db, $title, $timestamp)
Load the revision for the given title with the given timestamp.
getContentInternal()
Gets the content object for the revision (or null on failure).
getRawComment()
Fetch revision comment without regard for the current user's permissions.
getComment( $audience=self::FOR_PUBLIC, User $user=null)
Fetch revision comment if it's available to the specified audience.
static loadFromConds( $db, $conditions, $flags=0)
Given a set of conditions, fetch a revision from the given database connection.
static selectUserFields()
Return the list of user fields that should be selected from user table.
static selectFields()
Return the list of revision fields that should be selected to create a new revision.
static decompressRevisionText( $text, $flags)
Re-converts revision text according to it's flags.
static loadFromTitle( $db, $title, $id=0)
Load either the current, or a specified, revision that's attached to a given page.
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 & $attribs
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromID( $id, $flags=0)
Create a new Title from an article ID.
userCan( $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision,...