*/
use MediaWiki\Permissions\PermissionManager;
+use MediaWiki\Storage\RevisionRecord;
use Wikimedia\Assert\Assert;
use Wikimedia\Rdbms\Database;
use Wikimedia\Rdbms\IDatabase;
private $mPageLanguage = false;
/** @var string|bool|null The page language code from the database, null if not saved in
- * the database or false if not loaded, yet. */
+ * the database or false if not loaded, yet.
+ */
private $mDbPageLanguage = false;
/** @var TitleValue|null A corresponding TitleValue object */
if (
!MediaWikiServices::getInstance()->getNamespaceInfo()->
hasSubpages( $this->mNamespace )
+ || strtok( $this->getText(), '/' ) === false
) {
return $this->getText();
}
* @since 1.20
*/
public function getSubpage( $text ) {
- return self::makeTitleSafe( $this->mNamespace, $this->getText() . '/' . $text );
+ return self::makeTitleSafe(
+ $this->mNamespace,
+ $this->getText() . '/' . $text,
+ '',
+ $this->mInterwiki
+ );
}
/**
/**
* Purge all applicable CDN URLs
+ * @deprecated 1.34 Use HtmlCacheUpdater
*/
public function purgeSquid() {
- DeferredUpdates::addUpdate(
- new CdnCacheUpdate( $this->getCdnUrls() ),
- DeferredUpdates::PRESEND
- );
+ MediaWikiServices::getInstance()->getHtmlCacheUpdater()->purge( $this->getCdnUrls() );
}
/**
if ( $old->getId() === $new->getId() ) {
return ( $old_cmp === '>' && $new_cmp === '<' ) ?
[] :
- [ $old->getUserText( Revision::RAW ) ];
+ [ $old->getUserText( RevisionRecord::RAW ) ];
} elseif ( $old->getId() === $new->getParentId() ) {
if ( $old_cmp === '>=' && $new_cmp === '<=' ) {
- $authors[] = $old->getUserText( Revision::RAW );
- if ( $old->getUserText( Revision::RAW ) != $new->getUserText( Revision::RAW ) ) {
- $authors[] = $new->getUserText( Revision::RAW );
+ $authors[] = $oldUserText = $old->getUserText( RevisionRecord::RAW );
+ $newUserText = $new->getUserText( RevisionRecord::RAW );
+ if ( $oldUserText != $newUserText ) {
+ $authors[] = $newUserText;
}
} elseif ( $old_cmp === '>=' ) {
- $authors[] = $old->getUserText( Revision::RAW );
+ $authors[] = $old->getUserText( RevisionRecord::RAW );
} elseif ( $new_cmp === '<=' ) {
- $authors[] = $new->getUserText( Revision::RAW );
+ $authors[] = $new->getUserText( RevisionRecord::RAW );
}
return $authors;
}
* on the number of links. Typically called on create and delete.
*/
public function touchLinks() {
- DeferredUpdates::addUpdate( new HTMLCacheUpdate( $this, 'pagelinks', 'page-touch' ) );
+ $jobs = [];
+ $jobs[] = HTMLCacheUpdateJob::newForBacklinks(
+ $this,
+ 'pagelinks',
+ [ 'causeAction' => 'page-touch' ]
+ );
if ( $this->mNamespace == NS_CATEGORY ) {
- DeferredUpdates::addUpdate(
- new HTMLCacheUpdate( $this, 'categorylinks', 'category-touch' )
+ $jobs[] = HTMLCacheUpdateJob::newForBacklinks(
+ $this,
+ 'categorylinks',
+ [ 'causeAction' => 'category-touch' ]
);
}
+
+ JobQueueGroup::singleton()->lazyPush( $jobs );
}
/**
* Get the timestamp when this page was updated since the user last saw it.
*
* @param User|null $user
- * @return string|null
+ * @return string|bool|null String timestamp, false if not watched, null if nothing is unseen
*/
public function getNotificationTimestamp( $user = null ) {
global $wgUser;