* ApiQueryBase::getDirectionDescription() was removed (deprecated since 1.25).
* ApiQuery::getModules() was removed (deprecated since 1.21).
* ApiMain::getModules() was removed (deprecated since 1.21).
+* ApiBase::getVersion() was removed (deprecated since 1.21).
=== Languages updated in 1.27 ===
together but instead pick the final one, similar to image syntax.
* XML-like parser tags (such as <gallery>), when unclosed, will be left unparsed
rather than consume everything until the end of the page.
+* New maintenance script resetUserEmail.php allows sysadmins to reset user emails in case
+ a user forgot password/account was stolen.
== Compatibility ==
/// @deprecated since 1.24
const PROP_NULLABLE = 1;
- /**
- * Formerly returned a string that identifies the version of the extending
- * class. Typically included the class name, the svn revision, timestamp,
- * and last author. Usually done with SVN's Id keyword
- *
- * @deprecated since 1.21, version string is no longer supported
- * @return string
- */
- public function getVersion() {
- wfDeprecated( __METHOD__, '1.21' );
- return '';
- }
-
/**
* Formerly used to fetch a list of possible properites in the result,
* somehow organized with respect to the prop parameter that causes them to
$data['git-hash'] = $git;
$data['git-branch'] =
SpecialVersion::getGitCurrentBranch( $GLOBALS['IP'] );
- } else {
- $svn = SpecialVersion::getSvnRevision( $IP );
- if ( $svn ) {
- $data['rev'] = $svn;
- }
}
// 'case-insensitive' option is reserved for future
}
if ( isset( $ext['version'] ) ) {
$ret['version'] = $ext['version'];
- } elseif ( isset( $ext['svn-revision'] ) &&
- preg_match( '/\$(?:Rev|LastChangedRevision|Revision): *(\d+)/',
- $ext['svn-revision'], $m )
- ) {
- $ret['version'] = 'r' . $m[1];
}
if ( isset( $ext['path'] ) ) {
$extensionPath = dirname( $ext['path'] );
if ( $vcsDate !== false ) {
$ret['vcs-date'] = wfTimestamp( TS_ISO_8601, $vcsDate );
}
- } else {
- $svnInfo = SpecialVersion::getSvnInfo( $extensionPath );
- if ( $svnInfo !== false ) {
- $ret['vcs-system'] = 'svn';
- $ret['vcs-version'] = $svnInfo['checkout-rev'];
- $ret['vcs-url'] = isset( $svnInfo['viewvc-url'] ) ? $svnInfo['viewvc-url'] : '';
- }
}
if ( SpecialVersion::getExtLicenseFileName( $extensionPath ) ) {
$that = $this;
$unlocker = new ScopedCallback( function () use ( $that, $lockKey, $fname ) {
+ $that->commit( __METHOD__, 'flush' );
$that->unlock( $lockKey, $fname );
} );
* This is suitiable for transactions that need to be serialized using cooperative locks,
* where each transaction can see each others' changes. Any transaction is flushed to clear
* out stale REPEATABLE-READ snapshot data. Once the returned object falls out of PHP scope,
- * the lock will be released.
+ * any transaction will be committed and the lock will be released.
*
* If the lock acquisition failed, then no transaction flush happens, and null is returned.
*
* case on many installations.
*
* @param IDatabase $conn
- * @return int
+ * @return int|bool Returns false on error
*/
public function safeGetLag( IDatabase $conn ) {
if ( $this->getServerCount() == 1 ) {
}
$pos = $pos ?: $this->getConnection( DB_MASTER )->getMasterPos();
+ if ( !$pos ) {
+ return false; // something is misconfigured
+ }
$result = $conn->masterPosWait( $pos, $timeout );
if ( $result == -1 || is_null( $result ) ) {
/**
* Handy shortcut for constructing a formatter directly from
* database row.
- * @param object $row
+ * @param stdClass|array $row
* @see DatabaseLogEntry::getSelectQueryData
* @return LogFormatter
*/
// @codingStandardsIgnoreStart Long line
//case 'revision': // Revision deletion
//case 'event': // Log deletion
- // see https://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/LogPage.php?&pathrev=97044&r1=97043&r2=97044
+ // see https://github.com/wikimedia/mediawiki/commit/a9c243b7b5289dad204278dbe7ed571fd914e395
//default:
// @codingStandardsIgnoreEnd
}
case 'patrol':
// @codingStandardsIgnoreStart Long line
- // https://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/PatrolLog.php?&pathrev=97495&r1=97494&r2=97495
+ // https://github.com/wikimedia/mediawiki/commit/1a05f8faf78675dc85984f27f355b8825b43efff
// @codingStandardsIgnoreEnd
// Create a diff link to the patrolled revision
if ( $entry->getSubtype() === 'patrol' ) {
}
}
- if ( !$sendEmail ) {
- return;
+ if ( $sendEmail ) {
+ JobQueueGroup::singleton()->lazyPush( new EnotifNotifyJob(
+ $title,
+ array(
+ 'editor' => $editor->getName(),
+ 'editorID' => $editor->getID(),
+ 'timestamp' => $timestamp,
+ 'summary' => $summary,
+ 'minorEdit' => $minorEdit,
+ 'oldid' => $oldid,
+ 'watchers' => $watchers,
+ 'pageStatus' => $pageStatus
+ )
+ ) );
}
-
- $params = array(
- 'editor' => $editor->getName(),
- 'editorID' => $editor->getID(),
- 'timestamp' => $timestamp,
- 'summary' => $summary,
- 'minorEdit' => $minorEdit,
- 'oldid' => $oldid,
- 'watchers' => $watchers,
- 'pageStatus' => $pageStatus
- );
- $job = new EnotifNotifyJob( $title, $params );
- JobQueueGroup::singleton()->lazyPush( $job );
}
/**
}
/**
- * Use PHP's magic __call handler to transform instance calls to
- * WikiPage functions for backwards compatibility.
- *
- * @param string $fname Name of called method
- * @param array $args Arguments to the method
- * @return mixed
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::checkFlags
*/
- public function __call( $fname, $args ) {
- if ( is_callable( array( $this->mPage, $fname ) ) ) {
- # wfWarn( "Call to " . __CLASS__ . "::$fname; please use WikiPage instead" );
- return call_user_func_array( array( $this->mPage, $fname ), $args );
- }
- trigger_error( 'Inaccessible function via __call(): ' . $fname, E_USER_ERROR );
+ public function checkFlags( $flags ) {
+ return $this->mPage->checkFlags( $flags );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::checkTouched
+ */
+ public function checkTouched() {
+ return $this->mPage->checkTouched();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::clearPreparedEdit
+ */
+ public function clearPreparedEdit() {
+ return $this->mPage->clearPreparedEdit();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::doDeleteArticleReal
+ */
+ public function doDeleteArticleReal(
+ $reason, $suppress = false, $u1 = null, $u2 = null, &$error = '', User $user = null
+ ) {
+ return $this->mPage->doDeleteArticleReal(
+ $reason, $suppress, $u1, $u2, $error, $user
+ );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::doDeleteUpdates
+ */
+ public function doDeleteUpdates( $id, Content $content = null ) {
+ return $this->mPage->doDeleteUpdates( $id, $content );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::doEdit
+ */
+ public function doEdit( $text, $summary, $flags = 0, $baseRevId = false, $user = null ) {
+ ContentHandler::deprecated( __METHOD__, '1.21' );
+ return $this->mPage->doEdit( $text, $summary, $flags, $baseRevId, $user );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::doEditContent
+ */
+ public function doEditContent( Content $content, $summary, $flags = 0, $baseRevId = false,
+ User $user = null, $serialFormat = null
+ ) {
+ return $this->mPage->doEditContent( $content, $summary, $flags, $baseRevId,
+ $user, $serialFormat
+ );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::doEditUpdates
+ */
+ public function doEditUpdates( Revision $revision, User $user, array $options = array() ) {
+ return $this->mPage->doEditUpdates( $revision, $user, $options );
}
- // ****** B/C functions to work-around PHP silliness with __call and references ****** //
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::doPurge
+ */
+ public function doPurge() {
+ return $this->mPage->doPurge();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::doQuickEditContent
+ */
+ public function doQuickEditContent(
+ Content $content, User $user, $comment = '', $minor = false, $serialFormat = null
+ ) {
+ return $this->mPage->doQuickEditContent(
+ $content, $user, $comment, $minor, $serialFormat
+ );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::doViewUpdates
+ */
+ public function doViewUpdates( User $user, $oldid = 0 ) {
+ return $this->mPage->doViewUpdates( $user, $oldid );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::exists
+ */
+ public function exists() {
+ return $this->mPage->exists();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::followRedirect
+ */
+ public function followRedirect() {
+ return $this->mPage->followRedirect();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getActionOverrides
+ */
+ public function getActionOverrides() {
+ return $this->mPage->getActionOverrides();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getAutoDeleteReason
+ */
+ public function getAutoDeleteReason( &$hasHistory ) {
+ return $this->mPage->getAutoDeleteReason( $hasHistory );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getCategories
+ */
+ public function getCategories() {
+ return $this->mPage->getCategories();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getComment
+ */
+ public function getComment( $audience = Revision::FOR_PUBLIC, User $user = null ) {
+ return $this->mPage->getComment( $audience, $user );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getContentHandler
+ */
+ public function getContentHandler() {
+ return $this->mPage->getContentHandler();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getContentModel
+ */
+ public function getContentModel() {
+ return $this->mPage->getContentModel();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getContributors
+ */
+ public function getContributors() {
+ return $this->mPage->getContributors();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getCreator
+ */
+ public function getCreator( $audience = Revision::FOR_PUBLIC, User $user = null ) {
+ return $this->mPage->getCreator( $audience, $user );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getDeletionUpdates
+ */
+ public function getDeletionUpdates( Content $content = null ) {
+ return $this->mPage->getDeletionUpdates( $content );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getHiddenCategories
+ */
+ public function getHiddenCategories() {
+ return $this->mPage->getHiddenCategories();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getId
+ */
+ public function getId() {
+ return $this->mPage->getId();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getLatest
+ */
+ public function getLatest() {
+ return $this->mPage->getLatest();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getLinksTimestamp
+ */
+ public function getLinksTimestamp() {
+ return $this->mPage->getLinksTimestamp();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getMinorEdit
+ */
+ public function getMinorEdit() {
+ return $this->mPage->getMinorEdit();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getOldestRevision
+ */
+ public function getOldestRevision() {
+ return $this->mPage->getOldestRevision();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getRedirectTarget
+ */
+ public function getRedirectTarget() {
+ return $this->mPage->getRedirectTarget();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getRedirectURL
+ */
+ public function getRedirectURL( $rt ) {
+ return $this->mPage->getRedirectURL( $rt );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getRevision
+ */
+ public function getRevision() {
+ return $this->mPage->getRevision();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getText
+ */
+ public function getText( $audience = Revision::FOR_PUBLIC, User $user = null ) {
+ ContentHandler::deprecated( __METHOD__, '1.21' );
+ return $this->mPage->getText( $audience, $user );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getTimestamp
+ */
+ public function getTimestamp() {
+ return $this->mPage->getTimestamp();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getTouched
+ */
+ public function getTouched() {
+ return $this->mPage->getTouched();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getUndoContent
+ */
+ public function getUndoContent( Revision $undo, Revision $undoafter = null ) {
+ return $this->mPage->getUndoContent( $undo, $undoafter );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getUndoText
+ */
+ public function getUndoText( Revision $undo, Revision $undoafter = null ) {
+ ContentHandler::deprecated( __METHOD__, '1.21' );
+ return $this->mPage->getUndoText( $undo, $undoafter );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getUser
+ */
+ public function getUser( $audience = Revision::FOR_PUBLIC, User $user = null ) {
+ return $this->mPage->getUser( $audience, $user );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::getUserText
+ */
+ public function getUserText( $audience = Revision::FOR_PUBLIC, User $user = null ) {
+ return $this->mPage->getUserText( $audience, $user );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::hasViewableContent
+ */
+ public function hasViewableContent() {
+ return $this->mPage->hasViewableContent();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::insertOn
+ */
+ public function insertOn( $dbw, $pageId = null ) {
+ return $this->mPage->insertOn( $dbw, $pageId );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::insertProtectNullRevision
+ */
+ public function insertProtectNullRevision( $revCommentMsg, array $limit,
+ array $expiry, $cascade, $reason, $user = null
+ ) {
+ return $this->mPage->insertProtectNullRevision( $revCommentMsg, $limit,
+ $expiry, $cascade, $reason, $user
+ );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::insertRedirect
+ */
+ public function insertRedirect() {
+ return $this->mPage->insertRedirect();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::insertRedirectEntry
+ */
+ public function insertRedirectEntry( Title $rt, $oldLatest = null ) {
+ return $this->mPage->insertRedirectEntry( $rt, $oldLatest );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::isCountable
+ */
+ public function isCountable( $editInfo = false ) {
+ return $this->mPage->isCountable( $editInfo );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::isRedirect
+ */
+ public function isRedirect() {
+ return $this->mPage->isRedirect();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::loadFromRow
+ */
+ public function loadFromRow( $data, $from ) {
+ return $this->mPage->loadFromRow( $data, $from );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::loadPageData
+ */
+ public function loadPageData( $from = 'fromdb' ) {
+ return $this->mPage->loadPageData( $from );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::lockAndGetLatest
+ */
+ public function lockAndGetLatest() {
+ return $this->mPage->lockAndGetLatest();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::makeParserOptions
+ */
+ public function makeParserOptions( $context ) {
+ return $this->mPage->makeParserOptions( $context );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::pageDataFromId
+ */
+ public function pageDataFromId( $dbr, $id, $options = array() ) {
+ return $this->mPage->pageDataFromId( $dbr, $id, $options );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::pageDataFromTitle
+ */
+ public function pageDataFromTitle( $dbr, $title, $options = array() ) {
+ return $this->mPage->pageDataFromTitle( $dbr, $title, $options );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::prepareContentForEdit
+ */
+ public function prepareContentForEdit(
+ Content $content, $revision = null, User $user = null,
+ $serialFormat = null, $useCache = true
+ ) {
+ return $this->mPage->prepareContentForEdit(
+ $content, $revision, $user,
+ $serialFormat, $useCache
+ );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::prepareTextForEdit
+ */
+ public function prepareTextForEdit( $text, $revid = null, User $user = null ) {
+ return $this->mPage->prepareTextForEdit( $text, $revid, $user );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::protectDescription
+ */
+ public function protectDescription( array $limit, array $expiry ) {
+ return $this->mPage->protectDescription( $limit, $expiry );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::protectDescriptionLog
+ */
+ public function protectDescriptionLog( array $limit, array $expiry ) {
+ return $this->mPage->protectDescriptionLog( $limit, $expiry );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::replaceSection
+ */
+ public function replaceSection( $sectionId, $text, $sectionTitle = '',
+ $edittime = null
+ ) {
+ ContentHandler::deprecated( __METHOD__, '1.21' );
+ return $this->mPage->replaceSection( $sectionId, $text, $sectionTitle,
+ $edittime
+ );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::replaceSectionAtRev
+ */
+ public function replaceSectionAtRev( $sectionId, Content $sectionContent,
+ $sectionTitle = '', $baseRevId = null
+ ) {
+ return $this->mPage->replaceSectionAtRev( $sectionId, $sectionContent,
+ $sectionTitle, $baseRevId
+ );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::replaceSectionContent
+ */
+ public function replaceSectionContent(
+ $sectionId, Content $sectionContent, $sectionTitle = '', $edittime = null
+ ) {
+ return $this->mPage->replaceSectionContent(
+ $sectionId, $sectionContent, $sectionTitle, $edittime
+ );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::setTimestamp
+ */
+ public function setTimestamp( $ts ) {
+ return $this->mPage->setTimestamp( $ts );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::shouldCheckParserCache
+ */
+ public function shouldCheckParserCache( ParserOptions $parserOptions, $oldId ) {
+ return $this->mPage->shouldCheckParserCache( $parserOptions, $oldId );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::supportsSections
+ */
+ public function supportsSections() {
+ return $this->mPage->supportsSections();
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::triggerOpportunisticLinksUpdate
+ */
+ public function triggerOpportunisticLinksUpdate( ParserOutput $parserOutput ) {
+ return $this->mPage->triggerOpportunisticLinksUpdate( $parserOutput );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::updateCategoryCounts
+ */
+ public function updateCategoryCounts( array $added, array $deleted ) {
+ return $this->mPage->updateCategoryCounts( $added, $deleted );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::updateIfNewerOn
+ */
+ public function updateIfNewerOn( $dbw, $revision ) {
+ return $this->mPage->updateIfNewerOn( $dbw, $revision );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::updateRedirectOn
+ */
+ public function updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect = null ) {
+ return $this->mPage->updateRedirectOn( $dbw, $redirectTitle, $lastRevIsRedirect = null );
+ }
+
+ /**
+ * Call to WikiPage function for backwards compatibility.
+ * @see WikiPage::updateRevisionOn
+ */
+ public function updateRevisionOn( $dbw, $revision, $lastRevision = null,
+ $lastRevIsRedirect = null
+ ) {
+ return $this->mPage->updateRevisionOn( $dbw, $revision, $lastRevision,
+ $lastRevIsRedirect
+ );
+ }
/**
* @param array $limit
return $handler->getAutoDeleteReason( $title, $hasHistory );
}
- // ****** B/C functions for static methods ( __callStatic is PHP>=5.3 ) ****** //
-
/**
* @return array
*
private $dataHash = null;
/** @var BagOStuff */
- private $store;
+ private $tempStore;
+ /** @var BagOStuff */
+ private $permStore;
/** @var LoggerInterface */
private $logger;
/**
* @param SessionId $id Session ID object
* @param SessionInfo $info Session info to populate from
- * @param BagOStuff $store Backend data store
+ * @param BagOStuff $tempStore In-process data store
+ * @param BagOStuff $permstore Backend data store for persisted sessions
* @param LoggerInterface $logger
* @param int $lifetime Session data lifetime in seconds
*/
public function __construct(
- SessionId $id, SessionInfo $info, BagOStuff $store, LoggerInterface $logger, $lifetime
+ SessionId $id, SessionInfo $info, BagOStuff $tempStore, BagOStuff $permStore,
+ LoggerInterface $logger, $lifetime
) {
$phpSessionHandling = \RequestContext::getMain()->getConfig()->get( 'PHPSessionHandling' );
$this->usePhpSessionHandling = $phpSessionHandling !== 'disable';
$this->id = $id;
$this->user = $info->getUserInfo() ? $info->getUserInfo()->getUser() : new User;
- $this->store = $store;
+ $this->tempStore = $tempStore;
+ $this->permStore = $permStore;
$this->logger = $logger;
$this->lifetime = $lifetime;
$this->provider = $info->getProvider();
$this->forceHTTPS = $info->forceHTTPS();
$this->providerMetadata = $info->getProviderMetadata();
- $blob = $store->get( wfMemcKey( 'MWSession', (string)$this->id ) );
+ $key = wfMemcKey( 'MWSession', (string)$this->id );
+ $blob = $tempStore->get( $key );
+ if ( $blob === false ) {
+ $blob = $permStore->get( $key );
+ if ( $blob !== false ) {
+ $tempStore->set( $key, $blob );
+ }
+ }
if ( !is_array( $blob ) ||
!isset( $blob['metadata'] ) || !is_array( $blob['metadata'] ) ||
!isset( $blob['data'] ) || !is_array( $blob['data'] )
$this->autosave();
// Delete the data for the old session ID now
- $this->store->delete( wfMemcKey( 'MWSession', $oldId ) );
+ $this->tempStore->delete( wfMemcKey( 'MWSession', $oldId ) );
+ $this->permStore->delete( wfMemcKey( 'MWSession', $oldId ) );
}
}
}
}
- $this->store->set(
+ $this->tempStore->set(
wfMemcKey( 'MWSession', (string)$this->id ),
array(
'data' => $this->data,
),
$metadata['expires']
);
+ if ( $this->persist ) {
+ $this->permStore->set(
+ wfMemcKey( 'MWSession', (string)$this->id ),
+ array(
+ 'data' => $this->data,
+ 'metadata' => $metadata,
+ ),
+ $metadata['expires']
+ );
+ }
$this->metaDirty = false;
$this->dataDirty = false;
private $config;
/** @var BagOStuff|null */
- private $store;
+ private $tempStore;
+
+ /** @var BagOStuff|null */
+ private $permStore;
/** @var SessionProvider[] */
private $sessionProviders = null;
$this->setLogger( \MediaWiki\Logger\LoggerFactory::getInstance( 'session' ) );
}
+ $this->tempStore = new \HashBagOStuff;
if ( isset( $options['store'] ) ) {
if ( !$options['store'] instanceof BagOStuff ) {
throw new \InvalidArgumentException(
'$options[\'store\'] must be an instance of BagOStuff'
);
}
- $this->store = $options['store'];
+ $this->permStore = $options['store'];
} else {
- $this->store = \ObjectCache::getInstance( $this->config->get( 'SessionCacheType' ) );
- $this->store->setLogger( $this->logger );
+ $this->permStore = \ObjectCache::getInstance( $this->config->get( 'SessionCacheType' ) );
+ $this->permStore->setLogger( $this->logger );
}
register_shutdown_function( array( $this, 'shutdown' ) );
// Test this here to provide a better log message for the common case
// of "no such ID"
$key = wfMemcKey( 'MWSession', $id );
- if ( is_array( $this->store->get( $key ) ) ) {
+ $existing = $this->tempStore->get( $key );
+ if ( $existing === false ) {
+ $existing = $this->permStore->get( $key );
+ if ( $existing !== false ) {
+ $this->tempStore->set( $key, $existing );
+ }
+ }
+ if ( is_array( $existing ) ) {
$info = new SessionInfo( SessionInfo::MIN_PRIORITY, array( 'id' => $id, 'idIsSafe' => true ) );
if ( $this->loadSessionInfoFromStore( $info, $request ) ) {
$session = $this->getSessionFromInfo( $info, $request );
}
$key = wfMemcKey( 'MWSession', $id );
- if ( is_array( $this->store->get( $key ) ) ) {
+ $existing = $this->tempStore->get( $key );
+ if ( $existing === false ) {
+ $existing = $this->permStore->get( $key );
+ if ( $existing !== false ) {
+ $this->tempStore->set( $key, $existing );
+ }
+ }
+ if ( is_array( $existing ) ) {
throw new \InvalidArgumentException( 'Session ID already exists' );
}
}
// Reset the user's token to kill existing sessions
$user = User::newFromName( $username );
if ( $user && $user->getToken( false ) ) {
- $user->setToken( true );
+ $user->setToken();
$user->saveSettings();
}
*/
private function loadSessionInfoFromStore( SessionInfo &$info, WebRequest $request ) {
$key = wfMemcKey( 'MWSession', $info->getId() );
- $blob = $this->store->get( $key );
+ $blob = $this->tempStore->get( $key );
+ if ( $blob === false ) {
+ $blob = $this->permStore->get( $key );
+ if ( $blob !== false ) {
+ $this->tempStore->set( $key, $blob );
+ }
+ }
$newParams = array();
// Sanity check: blob must be an array, if it's saved at all
if ( !is_array( $blob ) ) {
$this->logger->warning( "Session $info: Bad data" );
- $this->store->delete( $key );
+ $this->tempStore->delete( $key );
+ $this->permStore->delete( $key );
return false;
}
!isset( $blob['metadata'] ) || !is_array( $blob['metadata'] )
) {
$this->logger->warning( "Session $info: Bad data structure" );
- $this->store->delete( $key );
+ $this->tempStore->delete( $key );
+ $this->permStore->delete( $key );
return false;
}
!array_key_exists( 'provider', $metadata )
) {
$this->logger->warning( "Session $info: Bad metadata" );
- $this->store->delete( $key );
+ $this->tempStore->delete( $key );
+ $this->permStore->delete( $key );
return false;
}
$newParams['provider'] = $provider = $this->getProvider( $metadata['provider'] );
if ( !$provider ) {
$this->logger->warning( "Session $info: Unknown provider, " . $metadata['provider'] );
- $this->store->delete( $key );
+ $this->tempStore->delete( $key );
+ $this->permStore->delete( $key );
return false;
}
} elseif ( $metadata['provider'] !== (string)$provider ) {
$backend = new SessionBackend(
$this->allSessionIds[$id],
$info,
- $this->store,
+ $this->tempStore,
+ $this->permStore,
$this->logger,
$this->config->get( 'ObjectCacheSessionExpiry' )
);
do {
$id = wfBaseConvert( \MWCryptRand::generateHex( 40 ), 16, 32, 32 );
$key = wfMemcKey( 'MWSession', $id );
- } while ( isset( $this->allSessionIds[$id] ) || is_array( $this->store->get( $key ) ) );
+ } while ( isset( $this->allSessionIds[$id] ) ||
+ is_array( $this->tempStore->get( $key ) ) || is_array( $this->permStore->get( $key ) )
+ );
return $id;
}
* @param PHPSessionHandler $handler
*/
public function setupPHPSessionHandler( PHPSessionHandler $handler ) {
- $handler->setManager( $this, $this->store, $this->logger );
+ $handler->setManager( $this, $this->permStore, $this->logger );
}
/**
protected static $extensionTypes = false;
- protected static $viewvcUrls = array(
- 'svn+ssh://svn.wikimedia.org/svnroot/mediawiki' => 'http://svn.wikimedia.org/viewvc/mediawiki',
- 'http://svn.wikimedia.org/svnroot/mediawiki' => 'http://svn.wikimedia.org/viewvc/mediawiki',
- 'https://svn.wikimedia.org/svnroot/mediawiki' => 'https://svn.wikimedia.org/viewvc/mediawiki',
- );
-
public function __construct() {
parent::__construct( 'Version' );
}
}
/**
- * Return a string of the MediaWiki version with SVN revision if available.
+ * Return a string of the MediaWiki version with Git revision if available.
*
* @param string $flags
* @return mixed
global $wgVersion, $IP;
$gitInfo = self::getGitHeadSha1( $IP );
- $svnInfo = self::getSvnInfo( $IP );
- if ( !$svnInfo && !$gitInfo ) {
+ if ( !$gitInfo ) {
$version = $wgVersion;
- } elseif ( $gitInfo && $flags === 'nodb' ) {
+ } elseif ( $flags === 'nodb' ) {
$shortSha1 = substr( $gitInfo, 0, 7 );
$version = "$wgVersion ($shortSha1)";
- } elseif ( $gitInfo ) {
+ } else {
$shortSha1 = substr( $gitInfo, 0, 7 );
$shortSha1 = wfMessage( 'parentheses' )->params( $shortSha1 )->escaped();
$version = "$wgVersion $shortSha1";
- } elseif ( $flags === 'nodb' ) {
- $version = "$wgVersion (r{$svnInfo['checkout-rev']})";
- } else {
- $version = $wgVersion . ' ' .
- wfMessage(
- 'version-svn-revision',
- isset( $svnInfo['directory-rev'] ) ? $svnInfo['directory-rev'] : '',
- isset( $svnInfo['checkout-rev'] ) ? $svnInfo['checkout-rev'] : ''
- )->text();
}
return $version;
/**
* Return a wikitext-formatted string of the MediaWiki version with a link to
- * the SVN revision or the git SHA1 of head if available.
- * Git is prefered over Svn
+ * the Git SHA1 of head if available.
* The fallback is just $wgVersion
*
* @return mixed
if ( $gitVersion ) {
$v = $gitVersion;
} else {
- $svnVersion = self::getVersionLinkedSvn();
- if ( $svnVersion ) {
- $v = $svnVersion;
- } else {
- $v = $wgVersion; // fallback
- }
+ $v = $wgVersion; // fallback
}
return $v;
}
- /**
- * @return string Global wgVersion + a link to subversion revision of svn BASE
- */
- private static function getVersionLinkedSvn() {
- global $IP;
-
- $info = self::getSvnInfo( $IP );
- if ( !isset( $info['checkout-rev'] ) ) {
- return false;
- }
-
- $linkText = wfMessage(
- 'version-svn-revision',
- isset( $info['directory-rev'] ) ? $info['directory-rev'] : '',
- $info['checkout-rev']
- )->text();
-
- if ( isset( $info['viewvc-url'] ) ) {
- $version = "[{$info['viewvc-url']} $linkText]";
- } else {
- $version = $linkText;
- }
-
- return self::getwgVersionLinked() . " $version";
- }
-
/**
* @return string
*/
}
// ... and the version information
- // If the extension path is set we will check that directory for GIT and SVN
+ // If the extension path is set we will check that directory for GIT
// metadata in an attempt to extract date and vcs commit metadata.
$canonicalVersion = '–';
$extensionPath = null;
$coreHeadSHA1 = self::getGitHeadSha1( $IP );
if ( $coreHeadSHA1 ) {
$this->coreId = $coreHeadSHA1;
- } else {
- $svnInfo = self::getSvnInfo( $IP );
- if ( $svnInfo !== false ) {
- $this->coreId = $svnInfo['checkout-rev'];
- }
}
}
$cache = wfGetCache( CACHE_ANYTHING );
$vcsVersion = substr( $vcsVersion, 0, 7 );
$vcsLink = $gitInfo->getHeadViewUrl();
$vcsDate = $gitInfo->getHeadCommitDate();
- } else {
- $svnInfo = self::getSvnInfo( $extensionPath );
- if ( $svnInfo !== false ) {
- $vcsVersion = $this->msg( 'version-svn-revision', $svnInfo['checkout-rev'] )->text();
- $vcsLink = isset( $svnInfo['viewvc-url'] ) ? $svnInfo['viewvc-url'] : '';
- }
}
$cache->set( $memcKey, array( $vcsVersion, $vcsLink, $vcsDate ), 60 * 60 * 24 );
} else {
}
}
- /**
- * Get an associative array of information about a given path, from its .svn
- * subdirectory. Returns false on error, such as if the directory was not
- * checked out with subversion.
- *
- * Returned keys are:
- * Required:
- * checkout-rev The revision which was checked out
- * Optional:
- * directory-rev The revision when the directory was last modified
- * url The subversion URL of the directory
- * repo-url The base URL of the repository
- * viewvc-url A ViewVC URL pointing to the checked-out revision
- * @param string $dir
- * @return array|bool
- */
- public static function getSvnInfo( $dir ) {
- // http://svnbook.red-bean.com/nightly/en/svn.developer.insidewc.html
- $entries = $dir . '/.svn/entries';
-
- if ( !file_exists( $entries ) ) {
- return false;
- }
-
- $lines = file( $entries );
- if ( !count( $lines ) ) {
- return false;
- }
-
- // check if file is xml (subversion release <= 1.3) or not (subversion release = 1.4)
- if ( preg_match( '/^<\?xml/', $lines[0] ) ) {
- // subversion is release <= 1.3
- if ( !function_exists( 'simplexml_load_file' ) ) {
- // We could fall back to expat... YUCK
- return false;
- }
-
- // SimpleXml whines about the xmlns...
- MediaWiki\suppressWarnings();
- $xml = simplexml_load_file( $entries );
- MediaWiki\restoreWarnings();
-
- if ( $xml ) {
- foreach ( $xml->entry as $entry ) {
- if ( $xml->entry[0]['name'] == '' ) {
- // The directory entry should always have a revision marker.
- if ( $entry['revision'] ) {
- return array( 'checkout-rev' => intval( $entry['revision'] ) );
- }
- }
- }
- }
-
- return false;
- }
-
- // Subversion is release 1.4 or above.
- if ( count( $lines ) < 11 ) {
- return false;
- }
-
- $info = array(
- 'checkout-rev' => intval( trim( $lines[3] ) ),
- 'url' => trim( $lines[4] ),
- 'repo-url' => trim( $lines[5] ),
- 'directory-rev' => intval( trim( $lines[10] ) )
- );
-
- if ( isset( self::$viewvcUrls[$info['repo-url']] ) ) {
- $viewvc = str_replace(
- $info['repo-url'],
- self::$viewvcUrls[$info['repo-url']],
- $info['url']
- );
-
- $viewvc .= '/?pathrev=';
- $viewvc .= urlencode( $info['checkout-rev'] );
- $info['viewvc-url'] = $viewvc;
- }
-
- return $info;
- }
-
- /**
- * Retrieve the revision number of a Subversion working directory.
- *
- * @param string $dir Directory of the svn checkout
- *
- * @return int Revision number
- */
- public static function getSvnRevision( $dir ) {
- $info = self::getSvnInfo( $dir );
-
- if ( $info === false ) {
- return false;
- } elseif ( isset( $info['checkout-rev'] ) ) {
- return $info['checkout-rev'];
- } else {
- return false;
- }
- }
-
/**
* @param string $dir Directory of the git checkout
* @return bool|string Sha1 of commit HEAD points to
"version-hook-subscribedby": "Subscribed by",
"version-version": "($1)",
"version-no-ext-name": "[no name]",
- "version-svn-revision": "r$1",
"version-license": "MediaWiki License",
"version-ext-license": "License",
"version-ext-colheader-name": "Extension",
"version-hook-subscribedby": "Shown in [[Special:Version]]",
"version-version": "{{Optional}}\nUsed in [[Special:Version]]. Preceded by the MediaWiki extension name.\n\nParameters:\n* $1 - version number of the extension",
"version-no-ext-name": "Used in [[Special:Version]], in the rows of the main table when a name for an extension is not provided.",
- "version-svn-revision": "{{Identical|Revision}}{{optional}}\nUsed in [[Special:Version]], preceeding the Subversion revision numbers of the extensions loaded inside brackets, like this: \"({{int:version-revision}} r012345\"). Parameters:\n* $1 - (Unused) directory revision number or empty string\n* $2 - checkout revision number",
"version-license": "Used specifically for the MediaWiki software.\n\nUsed as heading in [[Special:Version]].",
"version-ext-license": "Used in [[Special:Version]].\n\nUsed as label for the link pointing to the extension's license page. e.g. [[Special:Version/License/Maps]]\n{{Identical|License}}",
"version-ext-colheader-name": "Column header for the name of an extension.\n{{Identical|Extension}}",
protected $mQuiet = false;
protected $mDbUser, $mDbPass;
- // A description of the script, children should change this
+ // A description of the script, children should change this via addDescription()
protected $mDescription = '';
// Have we already loaded our user input?
$this->addOption( "fix", "Actually fix the entries, will dry run otherwise" );
$this->addOption( "regenerate-all",
"Regenerate the page_latest field for all records in table page" );
- $this->mDescription = "Fix page_latest entries in the page table";
+ $this->addDescription( 'Fix page_latest entries in the page table' );
}
public function execute() {
class BenchHttpHttps extends Benchmarker {
public function __construct() {
parent::__construct();
- $this->mDescription = "Benchmark HTTP request vs HTTPS request.";
+ $this->addDescription( 'Benchmark HTTP request vs HTTPS request.' );
}
public function execute() {
class BenchWikimediaBaseConvert extends Benchmarker {
public function __construct() {
parent::__construct();
- $this->mDescription = "Benchmark for Wikimedia\\base_convert.";
+ $this->addDescription( 'Benchmark for Wikimedia\base_convert.' );
$this->addOption( "inbase", "Input base", false, true );
$this->addOption( "outbase", "Output base", false, true );
$this->addOption( "length", "Size in digits to generate for input", false, true );
class BenchmarkDeleteTruncate extends Benchmarker {
public function __construct() {
parent::__construct();
- $this->mDescription = "Benchmarks SQL DELETE vs SQL TRUNCATE.";
+ $this->addDescription( 'Benchmarks SQL DELETE vs SQL TRUNCATE.' );
}
public function execute() {
class BenchIfSwitch extends Benchmarker {
public function __construct() {
parent::__construct();
- $this->mDescription = "Benchmark if elseif... versus switch case.";
+ $this->addDescription( 'Benchmark if elseif... versus switch case.' );
}
public function execute() {
class BenchStrtrStrReplace extends Benchmarker {
public function __construct() {
parent::__construct();
- $this->mDescription = "Benchmark for strtr() vs str_replace().";
+ $this->addDescription( 'Benchmark for strtr() vs str_replace().' );
}
public function execute() {
$this->canRun = function_exists( 'mb_check_encoding' );
if ( $this->canRun ) {
- $this->mDescription = "Benchmark for using a regexp vs. mb_check_encoding " .
- "to check for UTF-8 encoding.";
- mb_internal_encoding( 'UTF-8' );
+ $this->addDescription( "Benchmark for using a regexp vs. mb_check_encoding " .
+ "to check for UTF-8 encoding." );
} else {
- $this->mDescription = "CANNOT RUN benchmark using mb_check_encoding: function not available.";
+ $this->addDescription( 'CANNOT RUN benchmark using mb_check_encoding: function not available.' );
}
}
class BenchWfIsWindows extends Benchmarker {
public function __construct() {
parent::__construct();
- $this->mDescription = "Benchmark for wfIsWindows.";
+ $this->addDescription( 'Benchmark for wfIsWindows.' );
}
public function execute() {
class BenchmarkHooks extends Benchmarker {
public function __construct() {
parent::__construct();
- $this->mDescription = 'Benchmark MediaWiki Hooks.';
+ $this->addDescription( 'Benchmark MediaWiki Hooks.' );
}
public function execute() {
class BenchmarkPurge extends Benchmarker {
public function __construct() {
parent::__construct();
- $this->mDescription = "Benchmark the Squid purge functions.";
+ $this->addDescription( 'Benchmark the Squid purge functions.' );
}
public function execute() {
$this->addOption( "user", "The username to operate on", false, true );
$this->addOption( "userid", "The user id to operate on", false, true );
$this->addOption( "password", "The password to use", true, true );
- $this->mDescription = "Change a user's password";
+ $this->addDescription( "Change a user's password" );
}
public function execute() {
class CheckBadRedirects extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Check for bad redirects";
+ $this->addDescription( 'Check for bad redirects' );
}
public function execute() {
class CheckComposerLockUpToDate extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription =
- 'Checks whether your composer.lock file is up to date with the current composer.json';
+ $this->addDescription(
+ 'Checks whether your composer.lock file is up to date with the current composer.json' );
}
public function execute() {
public function __construct() {
parent::__construct();
- $this->mDescription = "Check images to see if they exist, are readable, etc";
+ $this->addDescription( 'Check images to see if they exist, are readable, etc' );
$this->setBatchSize( 1000 );
}
public function __construct() {
parent::__construct();
- $this->mDescription =
- 'Checks LESS files for errors by running the LessTestSuite PHPUnit test suite';
+ $this->addDescription(
+ 'Checks LESS files for errors by running the LessTestSuite PHPUnit test suite' );
}
public function execute() {
public function __construct() {
parent::__construct();
- $this->mDescription = "Check syntax for all PHP files in MediaWiki";
+ $this->addDescription( 'Check syntax for all PHP files in MediaWiki' );
$this->addOption( 'with-extensions', 'Also recurse the extensions folder' );
$this->addOption(
'path',
public function __construct() {
parent::__construct();
- $this->mDescription = "Verify that database usernames are actually valid";
+ $this->addDescription( 'Verify that database usernames are actually valid' );
$this->setBatchSize( 1000 );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Cleanup ancient tables and indexes";
+ $this->addDescription( 'Cleanup ancient tables and indexes' );
$this->addOption( 'force', 'Actually run this script' );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Cleanup user blocks with user names not matching the 'user' table";
+ $this->addDescription( "Cleanup user blocks with user names not matching the 'user' table" );
$this->setBatchSize( 1000 );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Script to cleanup capitalization";
+ $this->addDescription( 'Script to cleanup capitalization' );
$this->addOption( 'namespace', 'Namespace number to run caps cleanup on', false, true );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Script to clean up broken, unparseable upload filenames";
+ $this->addDescription( 'Script to clean up broken, unparseable upload filenames' );
}
protected function processRow( $row ) {
public function __construct() {
parent::__construct();
- $this->mDescription = 'Remove cache entries for removed ResourceLoader modules from the database';
+ $this->addDescription(
+ 'Remove cache entries for removed ResourceLoader modules from the database' );
$this->addOption( 'batchsize', 'Delete rows in batches of this size. Default: 500', false, true );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Cleanup all spam from a given hostname";
+ $this->addDescription( 'Cleanup all spam from a given hostname' );
$this->addOption( 'all', 'Check all wikis in $wgLocalDatabases' );
$this->addOption( 'delete', 'Delete pages containing only spam instead of blanking them' );
$this->addArg(
class TitleCleanup extends TableCleanup {
public function __construct() {
parent::__construct();
- $this->mDescription = "Script to clean up broken, unparseable titles";
+ $this->addDescription( 'Script to clean up broken, unparseable titles' );
}
/**
public function __construct() {
parent::__construct();
- $this->mDescription = "Clean up abandoned files in temporary uploaded file stash";
+ $this->addDescription( 'Clean up abandoned files in temporary uploaded file stash' );
$this->setBatchSize( 50 );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Script to remove broken, unparseable titles in the Watchlist";
+ $this->addDescription( 'Script to remove broken, unparseable titles in the Watchlist' );
$this->addOption( 'fix', 'Actually remove entries; without will only report.' );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Clear all interwiki links for all languages from the cache";
+ $this->addDescription( 'Clear all interwiki links for all languages from the cache' );
}
public function execute() {
class CompareParserCache extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Parse random pages and compare output to cache.";
+ $this->addDescription( 'Parse random pages and compare output to cache.' );
$this->addOption( 'namespace', 'Page namespace number', true, true );
$this->addOption( 'maxpages', 'Number of pages to try', true, true );
}
public function __construct() {
parent::__construct();
$this->saveFailed = false;
- $this->mDescription = "Run a file or dump with several parsers";
+ $this->addDescription( 'Run a file or dump with several parsers' );
$this->addOption( 'parser1', 'The first parser to compare.', true, true );
$this->addOption( 'parser2', 'The second parser to compare.', true, true );
$this->addOption( 'tidy', 'Run tidy on the articles.', false, false );
public function __construct() {
parent::__construct();
- $this->mDescription = 'Converts extension entry points to the new JSON registration format';
+ $this->addDescription( 'Converts extension entry points to the new JSON registration format' );
$this->addArg( 'path', 'Location to the PHP entry point you wish to convert',
/* $required = */ true );
$this->addOption( 'skin', 'Whether to write to skin.json', false, false );
public function __construct() {
parent::__construct();
- $this->mDescription =
- "Convert from the old links schema (string->ID) to the new schema (ID->ID)."
- . "The wiki should be put into read-only mode while this script executes";
+ $this->addDescription(
+ 'Convert from the old links schema (string->ID) to the new schema (ID->ID). '
+ . 'The wiki should be put into read-only mode while this script executes' );
$this->addArg( 'logperformance', "Log performance to perfLogFilename.", false );
$this->addArg(
public function __construct() {
parent::__construct();
- $this->mDescription = "Convert user options from old to new system";
+ $this->addDescription( 'Convert user options from old to new system' );
$this->setBatchSize( 50 );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Copy files in one backend to another.";
+ $this->addDescription( 'Copy files in one backend to another.' );
$this->addOption( 'src', 'Backend containing the source files', true, true );
$this->addOption( 'dst', 'Backend where files should be copied to', true, true );
$this->addOption( 'containers', 'Pipe separated list of containers', true, true );
class CopyJobQueue extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Copy jobs from one queue system to another.";
+ $this->addDescription( 'Copy jobs from one queue system to another.' );
$this->addOption( 'src', 'Key to $wgJobQueueMigrationConfig for source', true, true );
$this->addOption( 'dst', 'Key to $wgJobQueueMigrationConfig for destination', true, true );
$this->addOption( 'type', 'Types of jobs to copy (use "all" for all)', true, true );
public function __construct() {
parent::__construct();
- $this->mDescription = "Create a new user account and/or grant it additional rights";
+ $this->addDescription( 'Create a new user account and/or grant it additional rights' );
$this->addOption(
'force',
'If acccount exists already, just grant it rights or change password.'
public function __construct() {
global $IP;
parent::__construct();
- $this->mDescription = "Generate CDB file of common passwords";
+ $this->addDescription( 'Generate CDB file of common passwords' );
$this->addOption( 'limit', "Max number of passwords to write", false, true, 'l' );
$this->addArg( 'inputfile', 'List of passwords (one per line) to use or - for stdin', true );
$this->addArg(
class DeleteArchivedFiles extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Deletes all archived images.";
+ $this->addDescription( 'Deletes all archived images.' );
$this->addOption( 'delete', 'Perform the deletion' );
$this->addOption( 'force', 'Force deletion of rows from filearchive' );
}
class DeleteArchivedRevisions extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription =
- "Deletes all archived revisions\nThese revisions will no longer be restorable";
+ $this->addDescription(
+ "Deletes all archived revisions\nThese revisions will no longer be restorable" );
$this->addOption( 'delete', 'Performs the deletion' );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Deletes a batch of pages";
+ $this->addDescription( 'Deletes a batch of pages' );
$this->addOption( 'u', "User to perform deletion", false, true );
$this->addOption( 'r', "Reason to delete page", false, true );
$this->addOption( 'i', "Interval to sleep between deletions" );
class DeleteDefaultMessages extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Deletes all pages in the MediaWiki namespace" .
- " which were last edited by \"MediaWiki default\"";
+ $this->addDescription( 'Deletes all pages in the MediaWiki namespace' .
+ ' which were last edited by "MediaWiki default"' );
}
public function execute() {
class DeleteEqualMessages extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = 'Deletes all pages in the MediaWiki namespace that are equal to '
- . 'the default message';
+ $this->addDescription( 'Deletes all pages in the MediaWiki namespace that are equal to '
+ . 'the default message' );
$this->addOption( 'delete', 'Actually delete the pages (default: dry run)' );
$this->addOption( 'delete-talk', 'Don\'t leave orphaned talk pages behind during deletion' );
$this->addOption( 'lang-code', 'Check for subpages of this language code (default: root '
class DeleteOldRevisions extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Delete old (non-current) revisions from the database";
+ $this->addDescription( 'Delete old (non-current) revisions from the database' );
$this->addOption( 'delete', 'Actually perform the deletion' );
$this->addOption( 'page_id', 'List of page ids to work on', false );
}
class DeleteOrphanedRevisions extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Maintenance script to delete revisions which refer to a nonexisting page";
+ $this->addDescription(
+ 'Maintenance script to delete revisions which refer to a nonexisting page' );
$this->addOption( 'report', 'Prints out a count of affected revisions but doesn\'t delete them' );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Delete one or more revisions by moving them to the archive table";
+ $this->addDescription( 'Delete one or more revisions by moving them to the archive table' );
}
public function execute() {
class DeleteSelfExternals extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = 'Delete self-references to $wgServer from externallinks';
+ $this->addDescription( 'Delete self-references to $wgServer from externallinks' );
$this->mBatchSize = 1000;
}
function __construct( $args = null ) {
parent::__construct();
- $this->mDescription = <<<TEXT
+ $this->addDescription( <<<TEXT
This script dumps the wiki page or logging database into an
XML interchange wrapper format for export or backup.
WARNING: this is not a full database dump! It is merely for public export
of your wiki. For full backup, see our online help at:
https://www.mediawiki.org/wiki/Backup
-TEXT;
+TEXT
+ );
$this->stderr = fopen( "php://stderr", "wt" );
// Actions
$this->addOption( 'full', 'Dump all revisions of every page' );
public function __construct() {
parent::__construct();
- $this->mDescription = "Does something with a dump";
+ $this->addDescription( 'Does something with a dump' );
$this->addOption( 'file', 'File with text to run.', false, true );
$this->addOption( 'dump', 'XML dump to execute all revisions.', false, true );
$this->addOption( 'from', 'Article from XML dump to start from.', false, true );
public function __construct() {
parent::__construct();
- $this->mDescription = "Runs a regex in the revisions from a dump";
+ $this->addDescription( 'Runs a regex in the revisions from a dump' );
$this->addOption( 'regex', 'Searching regex', true, true );
}
class DumpLinks extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Quick demo hack to generate a plaintext link dump";
+ $this->addDescription( 'Quick demo hack to generate a plaintext link dump' );
}
public function execute() {
function __construct( $args = null ) {
parent::__construct();
- $this->mDescription = <<<TEXT
+ $this->addDescription( <<<TEXT
This script postprocesses XML dumps from dumpBackup.php to add
page text which was stubbed out (using --stub).
XML input is accepted on stdin.
XML output is sent to stdout; progress reports are sent to stderr.
-TEXT;
+TEXT
+ );
$this->stderr = fopen( "php://stderr", "wt" );
$this->addOption( 'stub', 'To load a compressed stub dump instead of stdin. ' .
class UploadDumper extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Generates list of uploaded files which can be fed to tar or similar.
-By default, outputs relative paths against the parent directory of \$wgUploadDirectory.";
+ $this->addDescription( 'Generates list of uploaded files which can be fed to tar or similar.
+By default, outputs relative paths against the parent directory of $wgUploadDirectory.' );
$this->addOption( 'base', 'Set base relative path instead of wiki include root', false, true );
$this->addOption( 'local', 'List all local files, used or not. No shared files included' );
$this->addOption( 'used', 'Skip local images that are not used' );
class EditCLI extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Edit an article from the command line, text is from stdin";
+ $this->addDescription( 'Edit an article from the command line, text is from stdin' );
$this->addOption( 'user', 'Username', false, true, 'u' );
$this->addOption( 'summary', 'Edit summary', false, true, 's' );
$this->addOption( 'minor', 'Minor edit', false, false, 'm' );
class EraseArchivedFile extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Erases traces of deleted files.";
+ $this->addDescription( 'Erases traces of deleted files.' );
$this->addOption( 'delete', 'Perform the deletion' );
$this->addOption( 'filename', 'File name', false, true );
$this->addOption( 'filekey', 'File storage key (with extension) or "*"', true, true );
class ExportSites extends Maintenance {
public function __construct() {
- $this->mDescription = 'Exports site definitions the sites table to XML file';
+ $this->addDescription( 'Exports site definitions the sites table to XML file' );
$this->addArg( 'file', 'A file to write the XML to (see docs/sitelist.txt). ' .
'Use "php://stdout" to write to stdout.', true
class FetchText extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Fetch the raw revision blob from an old_id.\n" .
+ $this->addDescription( "Fetch the raw revision blob from an old_id.\n" .
"NOTE: Export transformations are NOT applied. " .
- "This is left to backupTextPass.php";
+ "This is left to backupTextPass.php"
+ );
}
/**
class TestFileOpPerformance extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Test fileop performance";
+ $this->addDescription( 'Test fileop performance' );
$this->addOption( 'b1', 'Backend 1', true, true );
$this->addOption( 'b2', 'Backend 2', false, true );
$this->addOption( 'srcdir', 'File source directory', true, true );
class FindDeprecated extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = 'Find deprecated interfaces';
+ $this->addDescription( 'Find deprecated interfaces' );
}
public function getFiles() {
public function __construct() {
parent::__construct();
- $this->mDescription = 'Find hooks that are undocumented, missing, or just plain wrong';
+ $this->addDescription( 'Find hooks that are undocumented, missing, or just plain wrong' );
$this->addOption( 'online', 'Check against MediaWiki.org hook documentation' );
}
function __construct() {
parent::__construct();
- $this->mDescription = 'Find registered files with no corresponding file.';
+ $this->addDescription( 'Find registered files with no corresponding file.' );
$this->addOption( 'start', 'Start after this file name', false, true );
$this->addOption( 'mtimeafter', 'Only include files changed since this time', false, true );
$this->addOption( 'mtimebefore', 'Only includes files changed before this time', false, true );
function __construct() {
parent::__construct();
- $this->mDescription = "Find unregistered files in the 'public' repo zone.";
+ $this->addDescription( "Find unregistered files in the 'public' repo zone." );
$this->addOption( 'subdir',
'Only scan files in this subdirectory (e.g. "a/a0")', false, true );
$this->addOption( 'verbose', "Mention file paths checked" );
class FixDefaultJsonContentPages extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
- $this->mDescription =
- 'Fix instances of JSON pages prior to them being the ContentHandler default';
+ $this->addDescription(
+ 'Fix instances of JSON pages prior to them being the ContentHandler default' );
$this->setBatchSize( 100 );
}
class FixDoubleRedirects extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Script to fix double redirects";
+ $this->addDescription( 'Script to fix double redirects' );
$this->addOption( 'async', 'Don\'t fix anything directly, just queue the jobs' );
$this->addOption( 'title', 'Fix only redirects pointing to this page', false, true );
$this->addOption( 'dry-run', 'Perform a dry run, fix nothing' );
class FixExtLinksProtocolRelative extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
- $this->mDescription =
- "Fixes any entries in the externallinks table containing protocol-relative URLs";
+ $this->addDescription(
+ 'Fixes any entries in the externallinks table containing protocol-relative URLs' );
}
protected function getUpdateKey() {
class FixTimestamps extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "";
+ $this->addDescription( '' );
$this->addArg( 'offset', '' );
$this->addArg( 'start', 'Starting timestamp' );
$this->addArg( 'end', 'Ending timestamp' );
class FixUserRegistration extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Fix the user_registration field";
+ $this->addDescription( 'Fix the user_registration field' );
$this->setBatchSize( 1000 );
}
class GenerateJsonI18n extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Build JSON messages files from a PHP messages file";
+ $this->addDescription( 'Build JSON messages files from a PHP messages file' );
$this->addArg( 'phpfile', 'PHP file defining a $messages array', false );
$this->addArg( 'jsondir', 'Directory to write JSON files to', false );
*/
public function __construct() {
parent::__construct();
- $this->mDescription = "Creates a sitemap for the site";
+ $this->addDescription( 'Creates a sitemap for the site' );
$this->addOption(
'fspath',
'The file system path to save to, e.g. /tmp/sitemap; defaults to current directory',
public function __construct() {
parent::__construct();
- $this->mDescription = "Get serialized MediaWiki site configuration";
+ $this->addDescription( 'Get serialized MediaWiki site configuration' );
$this->addOption( 'regex', 'regex to filter variables with', false, true );
$this->addOption( 'iregex', 'same as --regex but case insensitive', false, true );
$this->addOption( 'settings', 'Space-separated list of wg* variables', false, true );
class GetLagTimes extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Dump replication lag times";
+ $this->addDescription( 'Dump replication lag times' );
}
public function execute() {
public function __construct() {
parent::__construct();
$this->addOption( "group", "Query group to check specifically" );
- $this->mDescription = "Report the hostname of a slave server";
+ $this->addDescription( 'Report the hostname of a slave server' );
}
public function execute() {
class GetTextMaint extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = 'Outputs page text to stdout';
+ $this->addDescription( 'Outputs page text to stdout' );
$this->addOption( 'show-private', 'Show the text even if it\'s not available to the public' );
$this->addArg( 'title', 'Page title' );
}
? 'ok'
: '(disabled; requires PHP bzip2 module)';
- $this->mDescription = <<<TEXT
+ $this->addDescription(
+ <<<TEXT
This script reads pages from an XML file as produced from Special:Export or
dumpBackup.php, and saves them into the current wiki.
Note that for very large data sets, importDump.php may be slow; there are
alternate methods which can be much faster for full site restoration:
<https://www.mediawiki.org/wiki/Manual:Importing_XML_dumps>
-TEXT;
+TEXT
+ );
$this->stderr = fopen( "php://stderr", "wt" );
$this->addOption( 'report',
'Report position and speed after every n pages processed', false, true );
class ImportSiteScripts extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = 'Import site scripts from a site';
+ $this->addDescription( 'Import site scripts from a site' );
$this->addArg( 'api', 'API base url' );
$this->addArg( 'index', 'index.php base url' );
$this->addOption( 'username', 'User name of the script importer' );
class ImportSites extends Maintenance {
public function __construct() {
- $this->mDescription = 'Imports site definitions from XML into the sites table.';
+ $this->addDescription( 'Imports site definitions from XML into the sites table.' );
$this->addArg( 'file', 'An XML file containing site definitions (see docs/sitelist.txt). ' .
'Use "php://stdin" to read from stdin.', true
class ImportTextFiles extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Reads in text files and imports their content to pages of the wiki";
+ $this->addDescription( 'Reads in text files and imports their content to pages of the wiki' );
$this->addOption( 'user', 'Username to which edits should be attributed. ' .
'Default: "Maintenance script"', false, true, 'u' );
$this->addOption( 'summary', 'Specify edit summary for the edits', false, true, 's' );
Background mode will be automatically used if the server is MySQL 4.0
(which does not support subqueries) or if multiple servers are listed
in the load balancer, usually indicating a replication environment.' );
- $this->mDescription = "Batch-recalculate user_editcount fields from the revision table";
+ $this->addDescription( 'Batch-recalculate user_editcount fields from the revision table' );
}
public function execute() {
class InitSiteStats extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Re-initialise the site statistics tables";
+ $this->addDescription( 'Re-initialise the site statistics tables' );
$this->addOption( 'update', 'Update the existing statistics' );
$this->addOption( 'active', 'Also update active users count' );
$this->addOption( 'use-master', 'Count using the master database' );
public function __construct() {
parent::__construct();
- $this->mDescription = "Runs parsing/syntax checks on JavaScript files";
+ $this->addDescription( 'Runs parsing/syntax checks on JavaScript files' );
$this->addArg( 'file(s)', 'JavaScript file to test', false );
}
class DatabaseLag extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Shows database lag";
+ $this->addDescription( 'Shows database lag' );
$this->addOption( 'r', "Don't exit immediately, but show the lag every 5 seconds" );
}
class AllTrans extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Get all messages as defined by the English language file";
+ $this->addDescription( 'Get all messages as defined by the English language file' );
}
public function execute() {
public function __construct() {
parent::__construct();
- $this->mDescription = "Test various language time and date functions";
+ $this->addDescription( 'Test various language time and date functions' );
}
public function execute() {
public function __construct() {
parent::__construct();
- $this->mDescription = "Check digit transformation";
+ $this->addDescription( 'Check digit transformation' );
}
public function execute() {
class DumpMessages extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Dump an entire language, using the keys from English";
+ $this->addDescription( 'Dump an entire language, using the keys from English' );
}
public function execute() {
class GenerateNormalizerDataAr extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = 'Generate the normalizer data file for Arabic';
+ $this->addDescription( 'Generate the normalizer data file for Arabic' );
$this->addOption( 'unicode-data-file', 'The local location of the data file ' .
'from http://unicode.org/Public/UNIDATA/UnicodeData.txt', false, true );
}
class GenerateNormalizerDataMl extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = 'Generate the normalizer data file for Malayalam';
+ $this->addDescription( 'Generate the normalizer data file for Malayalam' );
}
public function getDbType() {
public function __construct() {
parent::__construct();
- $this->mDescription = 'Generate Utf8Case.ser from the Unicode Character Database ' .
- 'and supplementary files';
+ $this->addDescription( 'Generate Utf8Case.ser from the Unicode Character Database ' .
+ 'and supplementary files' );
$this->addOption( 'unicode-data-file', 'The local location of the data file ' .
'from http://unicode.org/Public/UNIDATA/UnicodeData.txt', false, true );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Dumb program that tries to get the memory usage\n" .
- "for each language file";
+ $this->addDescription( "Dumb program that tries to get the memory usage\n" .
+ "for each language file" );
}
public function execute() {
public function __construct() {
parent::__construct();
- $this->mDescription = 'Outputs a list of language variants';
+ $this->addDescription( 'Outputs a list of language variants' );
$this->addOption( 'flat', 'Output variants in a flat list' );
$this->addOption( 'json', 'Output variants as JSON' );
}
class MakeTestEdits extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Make test edits for a user";
+ $this->addDescription( 'Make test edits for a user' );
$this->addOption( 'user', 'User name', true, true );
$this->addOption( 'count', 'Number of edits', true, true );
$this->addOption( 'namespace', 'Namespace number', false, true );
class McTest extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Makes several 'set', 'incr' and 'get' requests on every"
- . " memcached server and shows a report";
+ $this->addDescription( "Makes several 'set', 'incr' and 'get' requests on every"
+ . " memcached server and shows a report" );
$this->addOption( 'i', 'Number of iterations', false, true );
$this->addOption( 'cache', 'Use servers from this $wgObjectCaches store', false, true );
$this->addArg( 'server[:port]', 'Memcached server to test, with optional port', false );
);
$this->addOption( 'extensions-dir', 'Path where extensions can be found.', false, true );
$this->addOption( 'output', 'Send output to this file (omit for stdout)', false, true );
- $this->mDescription = 'Merge $wgExtensionMessagesFiles and $wgMessagesDirs from ' .
- ' various extensions to produce a single file listing all message files and dirs.';
+ $this->addDescription( 'Merge $wgExtensionMessagesFiles and $wgMessagesDirs from ' .
+ ' various extensions to produce a single file listing all message files and dirs.'
+ );
}
public function execute() {
class MigrateFileRepoLayout extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Copy files in repo to a different layout.";
+ $this->addDescription( 'Copy files in repo to a different layout.' );
$this->addOption( 'oldlayout', "Old layout; one of 'name' or 'sha1'", true, true );
$this->addOption( 'newlayout', "New layout; one of 'name' or 'sha1'", true, true );
$this->addOption( 'since', "Copy only files from after this timestamp", false, true );
class MigrateUserGroup extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Re-assign users from an old group to a new one";
+ $this->addDescription( 'Re-assign users from an old group to a new one' );
$this->addArg( 'oldgroup', 'Old user group key', true );
$this->addArg( 'newgroup', 'New user group key', true );
$this->setBatchSize( 200 );
"Directory for output. If this is not specified, and neither is --outfile, then the\n" .
"output files will be sent to the same directories as the input files.",
false, true );
- $this->mDescription = "Minify a file or set of files.\n\n" .
+ $this->addDescription( "Minify a file or set of files.\n\n" .
"If --outfile is not specified, then the output file names will have a .min extension\n" .
- "added, e.g. jquery.js -> jquery.min.js.";
+ "added, e.g. jquery.js -> jquery.min.js."
+ );
}
public function execute() {
class MoveBatch extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Moves a batch of pages";
+ $this->addDescription( 'Moves a batch of pages' );
$this->addOption( 'u', "User to perform move", false, true );
$this->addOption( 'r', "Reason to move page", false, true );
$this->addOption( 'i', "Interval to sleep between moves" );
*/
public function __construct() {
parent::__construct();
- $this->mDescription = 'Build doxygen documentation';
+ $this->addDescription( 'Build doxygen documentation' );
$this->addOption( 'doxygen',
'Path to doxygen',
public function __construct() {
parent::__construct();
- $this->mDescription = "";
+ $this->addDescription( 'Find and fix pages affected by namespace addition/removal' );
$this->addOption( 'fix', 'Attempt to automatically fix errors' );
$this->addOption( 'merge', "Instead of renaming conflicts, do a history merge with " .
"the correct title" );
class NukeNS extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Remove pages with only 1 revision from any namespace";
+ $this->addDescription( 'Remove pages with only 1 revision from any namespace' );
$this->addOption( 'delete', "Actually delete the page" );
$this->addOption( 'ns', 'Namespace to delete from, default NS_MEDIAWIKI', false, true );
$this->addOption( 'all', 'Delete everything regardless of revision count' );
class NukePage extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Remove a page record from the database";
+ $this->addDescription( 'Remove a page record from the database' );
$this->addOption( 'delete', "Actually delete the page" );
$this->addArg( 'title', 'Title to delete' );
}
class AlterSharedConstraints extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Alter foreign key to reference master tables in shared database setup.";
+ $this->addDescription( 'Alter foreign key to reference master tables in shared database setup.' );
}
public function getDbType() {
class Orphans extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Look for 'orphan' revisions hooked to pages which don't exist\n" .
+ $this->addDescription( "Look for 'orphan' revisions hooked to pages which don't exist\n" .
"and 'childless' pages with no revisions\n" .
"Then, kill the poor widows and orphans\n" .
- "Man this is depressing";
+ "Man this is depressing"
+ );
$this->addOption( 'fix', 'Actually fix broken entries' );
}
class PageExists extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Report whether a specific page exists";
+ $this->addDescription( 'Report whether a specific page exists' );
$this->addArg( 'title', 'Page title to check whether it exists' );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Parse a given wikitext";
+ $this->addDescription( 'Parse a given wikitext' );
$this->addOption(
'title',
'Title name for the given wikitext (Default: \'CLIParser\')',
class PatchSql extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Run an SQL file into the DB, replacing prefix and charset vars";
+ $this->addDescription( 'Run an SQL file into the DB, replacing prefix and charset vars' );
$this->addArg(
'patch-name',
'Name of the patch file, either full path or in maintenance/archives'
class PopulateBacklinkNamespace extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Populate the *_from_namespace fields";
+ $this->addDescription( 'Populate the *_from_namespace fields' );
$this->addOption( 'lastUpdatedId', "Highest page_id with updated links", false, true );
}
public function __construct() {
parent::__construct();
- $this->mDescription = <<<TEXT
+ $this->addDescription(
+ <<<TEXT
This script will populate the category table, added in MediaWiki 1.13. It will
print out progress indicators every 1000 categories it adds to the table. The
script is perfectly safe to run on large, live wikis, and running it multiple
When the script has finished, it will make a note of this in the database, and
will not run again without the --force option.
-TEXT;
-# '
+TEXT
+ );
+
$this->addOption(
'begin',
'Only do categories whose names are alphabetically after the provided name',
class PopulateContentModel extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = 'Populate the various content_* fields';
+ $this->addDescription( 'Populate the various content_* fields' );
$this->addOption( 'ns', 'Namespace to run in, or "all" for all namespaces', true, true );
$this->addOption( 'table', 'Table to run in', true, true );
$this->setBatchSize( 100 );
class PopulateFilearchiveSha1 extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Populate the fa_sha1 field from fa_storage_key";
+ $this->addDescription( 'Populate the fa_sha1 field from fa_storage_key' );
}
protected function getUpdateKey() {
class PopulateImageSha1 extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Populate the img_sha1 field";
+ $this->addDescription( 'Populate the img_sha1 field' );
$this->addOption( 'force', "Recalculate sha1 for rows that already have a value" );
$this->addOption( 'multiversiononly', "Calculate only for files with several versions" );
$this->addOption( 'method', "Use 'pipe' to pipe to mysql command line,\n" .
public function __construct() {
parent::__construct();
- $this->mDescription = "Migrate log params to new table and index for searching";
+ $this->addDescription( 'Migrate log params to new table and index for searching' );
$this->setBatchSize( 100 );
}
class PopulateLogUsertext extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Populates the log_user_text field";
+ $this->addDescription( 'Populates the log_user_text field' );
$this->setBatchSize( 100 );
}
class PopulateParentId extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Populates rev_parent_id";
+ $this->addDescription( 'Populates rev_parent_id' );
}
protected function getUpdateKey() {
class PopulateRecentChangesSource extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
- $this->mDescription =
- "Populates rc_source field of the recentchanges table with the data in rc_type.";
+ $this->addDescription(
+ 'Populates rc_source field of the recentchanges table with the data in rc_type.' );
$this->setBatchSize( 100 );
}
class PopulateRevisionLength extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Populates the rev_len and ar_len fields";
+ $this->addDescription( 'Populates the rev_len and ar_len fields' );
$this->setBatchSize( 200 );
}
class PopulateRevisionSha1 extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Populates the rev_sha1 and ar_sha1 fields";
+ $this->addDescription( 'Populates the rev_sha1 and ar_sha1 fields' );
$this->setBatchSize( 200 );
}
class Protect extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Protect or unprotect a page from the command line.";
+ $this->addDescription( 'Protect or unprotect a page from the command line.' );
$this->addOption( 'unprotect', 'Removes protection' );
$this->addOption( 'semiprotect', 'Adds semi-protection' );
$this->addOption( 'cascade', 'Add cascading protection' );
public function __construct() {
parent::__construct();
- $this->mDescription = "Build file cache for content pages";
+ $this->addDescription( 'Build file cache for content pages' );
$this->addOption( 'agedays', 'How many days old files must be in order to delete', true, true );
$this->addOption( 'subdir', 'Prune one $wgFileCacheDirectory subdirectory name', false, true );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Scan the logging table and purge files and thumbnails.";
+ $this->addDescription( 'Scan the logging table and purge files and thumbnails.' );
$this->addOption( 'starttime', 'Starting timestamp', true, true );
$this->addOption( 'endtime', 'Ending timestamp', true, true );
$this->addOption( 'type', 'Comma-separated list of types of changes to send purges for (' .
public function __construct() {
parent::__construct();
- $this->mDescription = 'Send purge requests for edits in date range to squid/varnish';
+ $this->addDescription( 'Send purge requests for edits in date range to squid/varnish' );
$this->addOption( 'starttime', 'Starting timestamp', true, true );
$this->addOption( 'endtime', 'Ending timestamp', true, true );
$this->addOption( 'htcp-dest', 'HTCP announcement destination (IP:port)', false, true );
class PurgeList extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Send purge requests for listed pages to squid";
+ $this->addDescription( 'Send purge requests for listed pages to squid' );
$this->addOption( 'purge', 'Whether to update page_touched.', false, false );
$this->addOption( 'namespace', 'Namespace number', false, true );
$this->addOption( 'all', 'Purge all pages', false, false );
class PurgeOldText extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Purge old text records from the database";
+ $this->addDescription( 'Purge old text records from the database' );
$this->addOption( 'purge', 'Performs the deletion' );
}
class ReassignEdits extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Reassign edits from one user to another";
+ $this->addDescription( 'Reassign edits from one user to another' );
$this->addOption( "force", "Reassign even if the target user doesn't exist" );
$this->addOption( "norc", "Don't update the recent changes table" );
$this->addOption( "report", "Print out details of what would be changed, but don't update it" );
class RebuildFileCache extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Build file cache for content pages";
+ $this->addDescription( 'Build file cache for content pages' );
$this->addOption( 'start', 'Page_id to start from', false, true );
$this->addOption( 'end', 'Page_id to end on', false, true );
$this->addOption( 'overwrite', 'Refresh page cache' );
// make sure to update old, but compatible img_metadata fields.
$wgUpdateCompatibleMetadata = true;
- $this->mDescription = 'Script to update image metadata records';
+ $this->addDescription( 'Script to update image metadata records' );
$this->addOption( 'missing', 'Check for files without associated database record' );
$this->addOption( 'dry-run', 'Only report, don\'t update the database' );
class RebuildLocalisationCache extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Rebuild the localisation cache";
+ $this->addDescription( 'Rebuild the localisation cache' );
$this->addOption( 'force', 'Rebuild all files, even ones not out of date' );
$this->addOption( 'threads', 'Fork more than one thread', false, true );
$this->addOption( 'outdir', 'Override the output directory (normally $wgCacheDirectory)',
public function __construct() {
parent::__construct();
- $this->mDescription = "Cache sites as json for file-based lookup.";
+ $this->addDescription( 'Cache sites as json for file-based lookup.' );
$this->addOption( 'file', 'File to output the json to', false, true );
}
class RebuildAll extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Rebuild links, text index and recent changes";
+ $this->addDescription( 'Rebuild links, text index and recent changes' );
}
public function getDbType() {
class RebuildMessages extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Purge all language messages from the cache";
+ $this->addDescription( 'Purge all language messages from the cache' );
}
public function execute() {
class RebuildRecentchanges extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Rebuild recent changes";
+ $this->addDescription( 'Rebuild recent changes' );
}
public function execute() {
public function __construct() {
parent::__construct();
- $this->mDescription = "Rebuild search index table from scratch";
+ $this->addDescription( 'Rebuild search index table from scratch' );
}
public function getDbType() {
class RefreshFileHeaders extends Maintenance {
function __construct() {
parent::__construct();
- $this->mDescription = 'Script to update file HTTP headers';
+ $this->addDescription( 'Script to update file HTTP headers' );
$this->addOption( 'verbose', 'Output information about each file.', false, false, 'v' );
$this->addOption( 'start', 'Name of file to start with', false, true );
$this->addOption( 'end', 'Name of file to end with', false, true );
function __construct() {
parent::__construct();
- $this->mDescription = 'Script to update image metadata records';
+ $this->addDescription( 'Script to update image metadata records' );
$this->setBatchSize( 200 );
$this->addOption(
class RefreshLinks extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Refresh link tables";
+ $this->addDescription( 'Refresh link tables' );
$this->addOption( 'dfn-only', 'Delete links from nonexistent articles only' );
$this->addOption( 'new-only', 'Only affect articles with just a single edit' );
$this->addOption( 'redirects-only', 'Only fix redirects, not all links' );
public function __construct() {
parent::__construct();
- $this->mDescription = "Take page text out of an XML dump file and render basic HTML out to files";
+ $this->addDescription(
+ 'Take page text out of an XML dump file and render basic HTML out to files' );
$this->addOption( 'output-dir', 'The directory to output the HTML files to', true, true );
$this->addOption( 'prefix', 'Prefix for the rendered files (defaults to wiki)', false, true );
$this->addOption( 'parser', 'Use an alternative parser class', false, true );
--- /dev/null
+<?php
+/**
+ * Reset user email.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Maintenance
+ */
+
+require_once __DIR__ . '/Maintenance.php';
+
+/**
+ * Maintenance script that resets user email.
+ *
+ * @since 1.27
+ * @ingroup Maintenance
+ */
+class ResetUserEmail extends Maintenance {
+ public function __construct() {
+ $this->addDescription( "Resets a user's email" );
+ $this->addArg( 'user', 'Username or user ID, if starts with #', true );
+ $this->addArg( 'email', 'Email to assign' );
+ parent::__construct();
+ }
+
+ public function execute() {
+ $userName = $this->getArg( 0 );
+ if ( preg_match( '/^#\d+$/', $userName ) ) {
+ $user = User::newFromId( substr( $userName, 1 ) );
+ } else {
+ $user = User::newFromName( $userName );
+ }
+ if ( !$user || !$user->getId() || !$user->loadFromId() ) {
+ $this->error( "Error: user '$userName' does not exist\n", 1 );
+ }
+
+ $email = $this->getArg( 1 );
+ if ( !Sanitizer::validateEmail( $email ) ) {
+ $this->error( "Error: email '$email' is not valid\n", 1 );
+ }
+
+ // Code from https://wikitech.wikimedia.org/wiki/Password_reset
+ $user->setEmail( $email );
+ $user->setEmailAuthenticationTimestamp( wfTimestampNow() );
+ $user->saveSettings();
+ // Kick whomever is currently controlling the account off
+ $user->setPassword( PasswordFactory::generateRandomPasswordString( 128 ) );
+ }
+}
+
+$maintClass = 'ResetUserEmail';
+require_once RUN_MAINTENANCE_IF_MAIN;
class ResetUserTokens extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription =
- "Reset the user_token of all users on the wiki. Note that this may log some of them out.";
+ $this->addDescription(
+ 'Reset the user_token of all users on the wiki. Note that this may log some of them out.'
+ );
$this->addOption( 'nowarn', "Hides the 5 seconds warning", false, false );
$this->addOption(
'nulls',
class RollbackEdits extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription =
- "Rollback all edits by a given user or IP provided they're the most recent edit";
+ $this->addDescription(
+ "Rollback all edits by a given user or IP provided they're the most recent edit" );
$this->addOption(
'titles',
'A list of titles, none means all titles where the given user is the most recent',
class BatchedQueryRunner extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription =
+ $this->addDescription(
"Run a query repeatedly until it affects 0 rows, and wait for slaves in between.\n" .
- "NOTE: You need to set a LIMIT clause yourself.";
+ "NOTE: You need to set a LIMIT clause yourself." );
}
public function execute() {
class RunJobs extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Run pending jobs";
+ $this->addDescription( 'Run pending jobs' );
$this->addOption( 'maxjobs', 'Maximum number of jobs to run', false, true );
$this->addOption( 'maxtime', 'Maximum amount of wall-clock time', false, true );
$this->addOption( 'type', 'Type of job to run', false, true );
public function __construct() {
parent::__construct();
- $this->mDescription = "Show number of jobs waiting in master database";
+ $this->addDescription( 'Show number of jobs waiting in master database' );
$this->addOption( 'group', 'Show number of jobs per job type' );
$this->addOption( 'list', 'Show a list of all jobs instead of counts' );
$this->addOption( 'type', 'Only show/count jobs of a given type', false, true );
class ShowSiteStats extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Show the cached statistics";
+ $this->addDescription( 'Show the cached statistics' );
}
public function execute() {
class MwSql extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Send SQL queries to a MediaWiki database. " .
- "Takes a file name containing SQL as argument or runs interactively.";
+ $this->addDescription( 'Send SQL queries to a MediaWiki database. ' .
+ 'Takes a file name containing SQL as argument or runs interactively.' );
$this->addOption( 'query', 'Run a single query instead of running interactively', false, true );
$this->addOption( 'cluster', 'Use an external cluster by name', false, true );
$this->addOption( 'wikidb', 'The database wiki ID to use if not the current one', false, true );
class SqliteMaintenance extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Performs some operations specific to SQLite database backend";
+ $this->addDescription( 'Performs some operations specific to SQLite database backend' );
$this->addOption(
'vacuum',
'Clean up database by removing deleted pages. Decreases database file size'
public function __construct() {
parent::__construct();
- $this->mDescription = 'Compress the text of a wiki';
+ $this->addDescription( 'Compress the text of a wiki' );
$this->addOption( 'type', 'Set compression type to either: gzip|concat', false, true, 't' );
$this->addOption(
'chunksize',
function __construct() {
parent::__construct();
- $this->mDescription = 'Script to fix bug 20757 assuming that blob_tracking is intact';
+ $this->addDescription( 'Script to fix bug 20757 assuming that blob_tracking is intact' );
$this->addOption( 'dry-run', 'Report only' );
$this->addOption( 'start', 'old_id to start at', false, true );
}
class OrphanStats extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription =
- "Show some statistics on the blob_orphans table, created with trackBlobs.php";
+ $this->addDescription(
+ "Show some statistics on the blob_orphans table, created with trackBlobs.php" );
}
protected function &getDB( $cluster, $groups = array(), $wiki = false ) {
class SyncFileBackend extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Sync one file backend with another using the journal";
+ $this->addDescription( 'Sync one file backend with another using the journal' );
$this->addOption( 'src', 'Name of backend to sync from', true, true );
$this->addOption( 'dst', 'Name of destination backend to sync', false, true );
$this->addOption( 'start', 'Starting journal ID', false, true );
class Undelete extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Undelete a page";
+ $this->addDescription( 'Undelete a page' );
$this->addOption( 'user', 'The user to perform the undeletion', false, true, 'u' );
$this->addOption( 'reason', 'The reason to undelete', false, true, 'r' );
$this->addArg( 'pagename', 'Page to undelete' );
class UpdateMediaWiki extends Maintenance {
function __construct() {
parent::__construct();
- $this->mDescription = "MediaWiki database updater";
+ $this->addDescription( 'MediaWiki database updater' );
$this->addOption( 'skip-compat-checks', 'Skips compatibility checks, mostly for developers' );
$this->addOption( 'quick', 'Skip 5 second countdown before starting' );
$this->addOption( 'doshared', 'Also update shared tables' );
public function __construct() {
parent::__construct();
- $this->mDescription = "Count of the number of articles and update the site statistics table";
+ $this->addDescription( 'Count of the number of articles and update the site statistics table' );
$this->addOption( 'update', 'Update the site_stats table with the new count' );
$this->addOption( 'use-master', 'Count using the master database' );
}
parent::__construct();
global $wgCategoryCollation;
- $this->mDescription = <<<TEXT
+ $this->addDescription( <<<TEXT
This script will find all rows in the categorylinks table whose collation is
out-of-date (cl_collation != '$wgCategoryCollation') and repopulate cl_sortkey
using the page title and cl_sortkey_prefix. If all collations are
up-to-date, it will do nothing.
-TEXT;
+TEXT
+ );
$this->addOption( 'force', 'Run on all rows, even if the collation is ' .
'supposed to be up-to-date.' );
public function __construct() {
parent::__construct();
- $this->mDescription = "Script to normalize double-byte latin UTF-8 characters";
+ $this->addDescription( 'Script to normalize double-byte latin UTF-8 characters' );
$this->addOption( 'q', 'quiet', false, true );
$this->addOption(
'l',
class UpdateRestrictions extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Updates page_restrictions table from old page_restriction column";
+ $this->addDescription( 'Updates page_restrictions table from old page_restriction column' );
$this->setBatchSize( 100 );
}
public function __construct() {
parent::__construct();
- $this->mDescription = "Script for periodic off-peak updating of the search index";
+ $this->setDescription( 'Script for periodic off-peak updating of the search index' );
$this->addOption( 's', 'starting timestamp', false, true );
$this->addOption( 'e', 'Ending timestamp', false, true );
$this->addOption(
class WrapOldPasswords extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Wrap all passwords of a certain type in a new layered type";
+ $this->addDescription( 'Wrap all passwords of a certain type in a new layered type' );
$this->addOption( 'type',
'Password type to wrap passwords in (must inherit LayeredParameterizedPassword)', true, true );
$this->addOption( 'verbose', 'Enables verbose output', false, false, 'v' );
'idIsSafe' => true,
) ),
$store,
+ $store,
new \Psr\Log\NullLogger(),
10
);
'idIsSafe' => true,
) ),
new \EmptyBagOStuff(),
+ new \EmptyBagOStuff(),
new \Psr\Log\NullLogger(),
10
);
'idIsSafe' => true,
) ),
$store,
+ $store,
new \Psr\Log\NullLogger(),
10
);
'idIsSafe' => true,
) ),
new \EmptyBagOStuff(),
+ new \EmptyBagOStuff(),
new \Psr\Log\NullLogger(),
10
);
$this->assertSame( $expect, $_SESSION );
}
- // Test expiry
- session_write_close();
- ini_set( 'session.gc_divisor', 1 );
- ini_set( 'session.gc_probability', 1 );
- sleep( 3 );
- session_start();
- $this->assertSame( array(), $_SESSION );
-
// Re-fill the session, then test that session_destroy() works.
$_SESSION['AuthenticationSessionTest'] = $rand;
session_write_close();
) );
$id = new SessionId( $info->getId() );
- $backend = new SessionBackend( $id, $info, $this->store, $logger, 10 );
+ $backend = new SessionBackend( $id, $info, $this->store, $this->store, $logger, 10 );
$priv = \TestingAccessWrapper::newFromObject( $backend );
$priv->persist = false;
$priv->requests = array( 100 => new \FauxRequest() );
$id = new SessionId( $info->getId() );
$logger = new \Psr\Log\NullLogger();
try {
- new SessionBackend( $id, $info, $this->store, $logger, 10 );
+ new SessionBackend( $id, $info, $this->store, $this->store, $logger, 10 );
$this->fail( 'Expected exception not thrown' );
} catch ( \InvalidArgumentException $ex ) {
$this->assertSame(
) );
$id = new SessionId( $info->getId() );
try {
- new SessionBackend( $id, $info, $this->store, $logger, 10 );
+ new SessionBackend( $id, $info, $this->store, $this->store, $logger, 10 );
$this->fail( 'Expected exception not thrown' );
} catch ( \InvalidArgumentException $ex ) {
$this->assertSame( 'Cannot create session without a provider', $ex->getMessage() );
) );
$id = new SessionId( '!' . $info->getId() );
try {
- new SessionBackend( $id, $info, $this->store, $logger, 10 );
+ new SessionBackend( $id, $info, $this->store, $this->store, $logger, 10 );
$this->fail( 'Expected exception not thrown' );
} catch ( \InvalidArgumentException $ex ) {
$this->assertSame(
'idIsSafe' => true,
) );
$id = new SessionId( $info->getId() );
- $backend = new SessionBackend( $id, $info, $this->store, $logger, 10 );
+ $backend = new SessionBackend( $id, $info, $this->store, $this->store, $logger, 10 );
$this->assertSame( self::SESSIONID, $backend->getId() );
$this->assertSame( $id, $backend->getSessionId() );
$this->assertSame( $this->provider, $backend->getProvider() );
'idIsSafe' => true,
) );
$id = new SessionId( $info->getId() );
- $backend = new SessionBackend( $id, $info, $this->store, $logger, 10 );
+ $backend = new SessionBackend( $id, $info, $this->store, $this->store, $logger, 10 );
$this->assertSame( self::SESSIONID, $backend->getId() );
$this->assertSame( $id, $backend->getSessionId() );
$this->assertSame( $this->provider, $backend->getProvider() );
$manager = \TestingAccessWrapper::newFromObject( $this->getManager() );
$this->assertSame( $this->config, $manager->config );
$this->assertSame( $this->logger, $manager->logger );
- $this->assertSame( $this->store, $manager->store );
+ $this->assertSame( $this->store, $manager->permStore );
$manager = \TestingAccessWrapper::newFromObject( new SessionManager() );
$this->assertSame( \RequestContext::getMain()->getConfig(), $manager->config );
$manager = \TestingAccessWrapper::newFromObject( new SessionManager( array(
'config' => $this->config,
) ) );
- $this->assertSame( \ObjectCache::$instances['testSessionStore'], $manager->store );
+ $this->assertSame( \ObjectCache::$instances['testSessionStore'], $manager->permStore );
foreach ( array(
'config' => '$options[\'config\'] must be an instance of Config',
public function testGetSessionById() {
$manager = $this->getManager();
+ // Disable the in-process cache so our $this->store->setSession() takes effect.
+ \TestingAccessWrapper::newFromObject( $manager )->tempStore = new \EmptyBagOStuff;
+
try {
$manager->getSessionById( 'bad' );
$this->fail( 'Expected exception not thrown' );
$manager->setLogger( $logger );
$request = new \FauxRequest();
+ // Disable the in-process cache so our $this->store->setSession() takes effect.
+ \TestingAccessWrapper::newFromObject( $manager )->tempStore = new \EmptyBagOStuff;
+
// TestingAccessWrapper can't handle methods with reference arguments, sigh.
$rClass = new \ReflectionClass( $manager );
$rMethod = $rClass->getMethod( 'loadSessionInfoFromStore' );