* @file
*/
use MediaWiki\Linker\LinkTarget;
+use MediaWiki\MediaWikiServices;
/**
* @todo document
const DELETED_USER = 4;
const DELETED_RESTRICTED = 8;
const SUPPRESSED_USER = 12; // convenience
+ const SUPPRESSED_ALL = 15; // convenience
// Audience options for accessors
const FOR_PUBLIC = 1;
/**
* Fetch revision's user id without regard for the current user's permissions
*
- * @return string
+ * @return int
* @deprecated since 1.25, use getUser( Revision::RAW )
*/
public function getRawUser() {
*
* @return string The content model id associated with this revision,
* see the CONTENT_MODEL_XXX constants.
- **/
+ */
public function getContentModel() {
if ( !$this->mContentModel ) {
$title = $this->getTitle();
*
* @return string The content format id associated with this revision,
* see the CONTENT_FORMAT_XXX constants.
- **/
+ */
public function getContentFormat() {
if ( !$this->mContentFormat ) {
$handler = $this->getContentHandler();
* (same as the the wiki $row was loaded from) or false to indicate the local
* wiki (this is the default). Otherwise, it must be a symbolic wiki database
* identifier as understood by the LoadBalancer class.
- * @return string Text the text requested or false on failure
+ * @return string|false Text the text requested or false on failure
*/
public static function getRevisionText( $row, $prefix = 'old_', $wiki = false ) {
public function insertOn( $dbw ) {
global $wgDefaultExternalStore, $wgContentHandlerUseDB;
+ // We're inserting a new revision, so we have to use master anyway.
+ // If it's a null revision, it may have references to rows that
+ // are not in the replica yet (the text row).
+ $this->mQueryFlags |= self::READ_LATEST;
+
// Not allowed to have rev_page equal to 0, false, etc.
if ( !$this->mPage ) {
$title = $this->getTitle();
* @since 1.28
*/
public static function newKnownCurrent( IDatabase $db, $pageId, $revId ) {
- $cache = ObjectCache::getMainWANInstance();
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
return $cache->getWithSetCallback(
// Page/rev IDs passed in from DB to reflect history merges
$cache->makeGlobalKey( 'revision', $db->getWikiID(), $pageId, $revId ),