Remove "\\" in namespacing. This is a Doxygen compatibility hack but
does not seem needed anymore, Doxygen reads namespaced class names
correctly, see e.g. https://doc.wikimedia.org/mediawiki-core/master/php/classMediaWiki_1_1Services_1_1ServiceContainer.html
PHP IDEs, on the other hand, were broken by the double backslash.
As an unrelated small doc fix, add parameter docs to PermissionError
constructor (parent has different arguments so the inherited
documentation is wrong).
Change-Id: I6da0f512b8c84f65fd20e90e4617108fe6a8fcd2
17 files changed:
$wgObjectCacheSessionExpiry = 3600;
/**
$wgObjectCacheSessionExpiry = 3600;
/**
- * @deprecated since 1.27, MediaWiki\\Session\\SessionManager doesn't use PHP session storage.
+ * @deprecated since 1.27, MediaWiki\Session\SessionManager doesn't use PHP session storage.
*/
$wgSessionHandler = null;
*/
$wgSessionHandler = null;
* @param array $data Array of *non*-urlencoded key => value pairs, the
* fake GET/POST values
* @param bool $wasPosted Whether to treat the data as POST
* @param array $data Array of *non*-urlencoded key => value pairs, the
* fake GET/POST values
* @param bool $wasPosted Whether to treat the data as POST
- * @param MediaWiki\\Session\\Session|array|null $session Session, session
+ * @param MediaWiki\Session\Session|array|null $session Session, session
* data array, or null
* @param string $protocol 'http' or 'https'
* @throws MWException
* data array, or null
* @param string $protocol 'http' or 'https'
* @throws MWException
/**
* @deprecated since 1.27, PHP's session generation isn't used with
/**
* @deprecated since 1.27, PHP's session generation isn't used with
- * MediaWiki\\Session\\SessionManager
+ * MediaWiki\Session\SessionManager
*/
function wfFixSessionID() {
wfDeprecated( __FUNCTION__, '1.27' );
*/
function wfFixSessionID() {
wfDeprecated( __FUNCTION__, '1.27' );
/**
* Reset the session id
*
/**
* Reset the session id
*
- * @deprecated since 1.27, use MediaWiki\\Session\\SessionManager instead
+ * @deprecated since 1.27, use MediaWiki\Session\SessionManager instead
* @since 1.22
*/
function wfResetSessionID() {
* @since 1.22
*/
function wfResetSessionID() {
/**
* Initialise php session
*
/**
* Initialise php session
*
- * @deprecated since 1.27, use MediaWiki\\Session\\SessionManager instead.
+ * @deprecated since 1.27, use MediaWiki\Session\SessionManager instead.
* Generally, "using" SessionManager will be calling ->getSessionById() or
* ::getGlobalSession() (depending on whether you were passing $sessionId
* here), then calling $session->persist().
* Generally, "using" SessionManager will be calling ->getSessionById() or
* ::getGlobalSession() (depending on whether you were passing $sessionId
* here), then calling $session->persist().
// Set up the session
$ps_session = Profiler::instance()->scopedProfileIn( $fname . '-session' );
/**
// Set up the session
$ps_session = Profiler::instance()->scopedProfileIn( $fname . '-session' );
/**
- * @var MediaWiki\\Session\\SessionId|null $wgInitialSessionId The persistent
+ * @var MediaWiki\Session\SessionId|null $wgInitialSessionId The persistent
* session ID (if any) loaded at startup
*/
$wgInitialSessionId = null;
* session ID (if any) loaded at startup
*/
$wgInitialSessionId = null;
+use MediaWiki\Session\Session;
+use MediaWiki\Session\SessionId;
use MediaWiki\Session\SessionManager;
/**
use MediaWiki\Session\SessionManager;
/**
- * @var \\MediaWiki\\Session\\SessionId|null Session ID to use for this
+ * @var SessionId|null Session ID to use for this
* request. We can't save the session directly due to reference cycles not
* working too well (slow GC in Zend and never collected in HHVM).
*/
* request. We can't save the session directly due to reference cycles not
* working too well (slow GC in Zend and never collected in HHVM).
*/
* @since 1.27
* @note For performance, keep the session locally if you will be making
* much use of it instead of calling this method repeatedly.
* @since 1.27
* @note For performance, keep the session locally if you will be making
* much use of it instead of calling this method repeatedly.
- * @return MediaWiki\\Session\\Session
*/
public function getSession() {
if ( $this->sessionId !== null ) {
*/
public function getSession() {
if ( $this->sessionId !== null ) {
/**
* Set the session for this request
* @since 1.27
/**
* Set the session for this request
* @since 1.27
- * @private For use by MediaWiki\\Session classes only
- * @param MediaWiki\\Session\\SessionId $sessionId
+ * @private For use by MediaWiki\Session classes only
+ * @param SessionId $sessionId
- public function setSessionId( MediaWiki\Session\SessionId $sessionId ) {
+ public function setSessionId( SessionId $sessionId ) {
$this->sessionId = $sessionId;
}
/**
* Get the session id for this request, if any
* @since 1.27
$this->sessionId = $sessionId;
}
/**
* Get the session id for this request, if any
* @since 1.27
- * @private For use by MediaWiki\\Session classes only
- * @return MediaWiki\\Session\\SessionId|null
+ * @private For use by MediaWiki\Session classes only
+ * @return SessionId|null
*/
public function getSessionId() {
return $this->sessionId;
*/
public function getSessionId() {
return $this->sessionId;
* This does not necessarily mean that the user is logged in!
*
* @deprecated since 1.27, use
* This does not necessarily mean that the user is logged in!
*
* @deprecated since 1.27, use
- * \\MediaWiki\\Session\\SessionManager::singleton()->getPersistedSessionId()
+ * \MediaWiki\Session\SessionManager::singleton()->getPersistedSessionId()
* instead.
* @return bool
*/
* instead.
* @return bool
*/
* @return (string|array)[] Returning a string will use that as the salt
* for User::getEditTokenObject() to fetch the token, which will give a
* LoggedOutEditToken (always "+\\") for anonymous users. Returning an
* @return (string|array)[] Returning a string will use that as the salt
* for User::getEditTokenObject() to fetch the token, which will give a
* LoggedOutEditToken (always "+\\") for anonymous users. Returning an
- * array will use it as parameters to MediaWiki\\Session\\Session::getToken(),
+ * array will use it as parameters to MediaWiki\Session\Session::getToken(),
* which will always return a full token even for anonymous users.
*/
public static function getTokenTypeSalts() {
* which will always return a full token even for anonymous users.
*/
public static function getTokenTypeSalts() {
/**
* Get a token from a salt
* @param User $user
/**
* Get a token from a salt
* @param User $user
- * @param MediaWiki\\Session\\Session $session
+ * @param MediaWiki\Session\Session $session
* @param string|array $salt A string will be used as the salt for
* User::getEditTokenObject() to fetch the token, which will give a
* LoggedOutEditToken (always "+\\") for anonymous users. An array will
* @param string|array $salt A string will be used as the salt for
* User::getEditTokenObject() to fetch the token, which will give a
* LoggedOutEditToken (always "+\\") for anonymous users. An array will
- * be used as parameters to MediaWiki\\Session\\Session::getToken(), which
+ * be used as parameters to MediaWiki\Session\Session::getToken(), which
* will always return a full token even for anonymous users. An array will
* also persist the session.
* will always return a full token even for anonymous users. An array will
* also persist the session.
- * @return MediaWiki\\Session\\Token
+ * @return MediaWiki\Session\Token
*/
public static function getToken( User $user, MediaWiki\Session\Session $session, $salt ) {
if ( is_array( $salt ) ) {
*/
public static function getToken( User $user, MediaWiki\Session\Session $session, $salt ) {
if ( is_array( $salt ) ) {
class PermissionsError extends ErrorPageError {
public $permission, $errors;
class PermissionsError extends ErrorPageError {
public $permission, $errors;
+ /**
+ * @param string $permission A permission name.
+ * @param string[] $errors Error message keys
+ */
public function __construct( $permission, $errors = [] ) {
global $wgLang;
public function __construct( $permission, $errors = [] ) {
global $wgLang;
* wish to add a submit button to a form.
*
* Additional recognized configuration parameters include:
* wish to add a submit button to a form.
*
* Additional recognized configuration parameters include:
- * - flags: OOUI flags for the button, see OOUI\\FlaggedElement
+ * - flags: OOUI flags for the button, see OOUI\FlaggedElement
* - buttonlabel-message: Message to use for the button display text, instead
* of the value from 'default'. Overrides 'buttonlabel' and 'buttonlabel-raw'.
* - buttonlabel: Text to display for the button display text, instead
* - buttonlabel-message: Message to use for the button display text, instead
* of the value from 'default'. Overrides 'buttonlabel' and 'buttonlabel-raw'.
* - buttonlabel: Text to display for the button display text, instead
*
* @param string|string[] $salt Token salt
* @param string $key Token key
*
* @param string|string[] $salt Token salt
* @param string $key Token key
- * @return MediaWiki\\Session\\Token
*/
public function getToken( $salt = '', $key = 'default' ) {
$new = false;
*/
public function getToken( $salt = '', $key = 'default' ) {
$new = false;
/**
* This is the actual workhorse for Session.
*
/**
* This is the actual workhorse for Session.
*
- * Most code does not need to use this class, you want \\MediaWiki\\Session\\Session.
+ * Most code does not need to use this class, you want \MediaWiki\Session\Session.
* The exceptions are SessionProviders and SessionMetadata hook functions,
* which get an instance of this class rather than Session.
*
* The exceptions are SessionProviders and SessionMetadata hook functions,
* which get an instance of this class rather than Session.
*
/**
* Deregister a Session
/**
* Deregister a Session
- * @private For use by \\MediaWiki\\Session\\Session::__destruct() only
+ * @private For use by \MediaWiki\Session\Session::__destruct() only
* @param int $index
*/
public function deregisterSession( $index ) {
* @param int $index
*/
public function deregisterSession( $index ) {
* Note the caller is responsible for calling $this->dirty() if anything in
* the array is changed.
*
* Note the caller is responsible for calling $this->dirty() if anything in
* the array is changed.
*
- * @private For use by \\MediaWiki\\Session\\Session only.
+ * @private For use by \MediaWiki\Session\Session only.
* @return array
*/
public function &getData() {
* @return array
*/
public function &getData() {
- * @private For use by \\MediaWiki\\Session\\Session only.
+ * @private For use by \MediaWiki\Session\Session only.
*/
public function dirty() {
$this->dataDirty = true;
*/
public function dirty() {
$this->dataDirty = true;
- * @private For use by \\MediaWiki\\Session\\SessionManager only
+ * @private For use by \MediaWiki\Session\SessionManager only
* @param string $id
*/
public function setId( $id ) {
* @param string $id
*/
public function setId( $id ) {
* The intention is that the named account will never again be usable for
* normal login (i.e. there is no way to undo the prevention of access).
*
* The intention is that the named account will never again be usable for
* normal login (i.e. there is no way to undo the prevention of access).
*
- * @private For use from \\User::newSystemUser only
+ * @private For use from \User::newSystemUser only
* @param string $username
*/
public function preventSessionsForUser( $username ) {
* @param string $username
*/
public function preventSessionsForUser( $username ) {
/**
* Deregister a SessionBackend
/**
* Deregister a SessionBackend
- * @private For use from \\MediaWiki\\Session\\SessionBackend only
+ * @private For use from \MediaWiki\Session\SessionBackend only
* @param SessionBackend $backend
*/
public function deregisterSessionBackend( SessionBackend $backend ) {
* @param SessionBackend $backend
*/
public function deregisterSessionBackend( SessionBackend $backend ) {
/**
* Change a SessionBackend's ID
/**
* Change a SessionBackend's ID
- * @private For use from \\MediaWiki\\Session\\SessionBackend only
+ * @private For use from \MediaWiki\Session\SessionBackend only
* @param SessionBackend $backend
*/
public function changeBackendId( SessionBackend $backend ) {
* @param SessionBackend $backend
*/
public function changeBackendId( SessionBackend $backend ) {
* @param WebRequest $request Any existing associated session will be reset
* to the session corresponding to the data in the request itself.
* @return Session
* @param WebRequest $request Any existing associated session will be reset
* to the session corresponding to the data in the request itself.
* @return Session
- * @throws \\OverflowException if there are multiple sessions tied for top
+ * @throws \OverflowException if there are multiple sessions tied for top
* priority in the request. Exception has a property "sessionInfos"
* holding the SessionInfo objects for the sessions involved.
*/
* priority in the request. Exception has a property "sessionInfos"
* holding the SessionInfo objects for the sessions involved.
*/
* @note The SessionProvider must not attempt to auto-create users.
* MediaWiki will do this later (when it's safe) if the chosen session has
* a user with a valid name but no ID.
* @note The SessionProvider must not attempt to auto-create users.
* MediaWiki will do this later (when it's safe) if the chosen session has
* a user with a valid name but no ID.
- * @protected For use by \\MediaWiki\\Session\\SessionManager only
+ * @protected For use by \MediaWiki\Session\SessionManager only
* @param WebRequest $request
* @return SessionInfo|null
*/
* @param WebRequest $request
* @return SessionInfo|null
*/
* implementation assumes that it only makes sense if a session ID can be
* persisted and changing users is allowed.
*
* implementation assumes that it only makes sense if a session ID can be
* persisted and changing users is allowed.
*
- * @protected For use by \\MediaWiki\\Session\\SessionManager only
+ * @protected For use by \MediaWiki\Session\SessionManager only
* @param string|null $id ID to force for the new session
* @return SessionInfo|null
* If non-null, must return true for $info->isIdSafe(); pass true for
* @param string|null $id ID to force for the new session
* @return SessionInfo|null
* If non-null, must return true for $info->isIdSafe(); pass true for
* The default implementation checks that anything in both arrays is
* identical, then returns $providedMetadata.
*
* The default implementation checks that anything in both arrays is
* identical, then returns $providedMetadata.
*
- * @protected For use by \\MediaWiki\\Session\\SessionManager only
+ * @protected For use by \MediaWiki\Session\SessionManager only
* @param array $savedMetadata Saved provider metadata
* @param array $providedMetadata Provided provider metadata
* @return array Resulting metadata
* @param array $savedMetadata Saved provider metadata
* @param array $providedMetadata Provided provider metadata
* @return array Resulting metadata
* allows for updating the provider metadata. On failure, the provider is
* expected to write an appropriate message to its logger.
*
* allows for updating the provider metadata. On failure, the provider is
* expected to write an appropriate message to its logger.
*
- * @protected For use by \\MediaWiki\\Session\\SessionManager only
+ * @protected For use by \MediaWiki\Session\SessionManager only
* @param SessionInfo $info
* @param WebRequest $request
* @param array|null &$metadata Provider metadata, may be altered.
* @param SessionInfo $info
* @param WebRequest $request
* @param array|null &$metadata Provider metadata, may be altered.
* the session ID into a cookie can easily just set the cookie to a
* different value.
*
* the session ID into a cookie can easily just set the cookie to a
* different value.
*
- * @protected For use by \\MediaWiki\\Session\\SessionBackend only
+ * @protected For use by \MediaWiki\Session\SessionBackend only
* @return bool
*/
abstract public function persistsSessionId();
* @return bool
*/
abstract public function persistsSessionId();
* different user. A session provider that shoves information into cookies,
* on the other hand, could easily do so.
*
* different user. A session provider that shoves information into cookies,
* on the other hand, could easily do so.
*
- * @protected For use by \\MediaWiki\\Session\\SessionBackend only
+ * @protected For use by \MediaWiki\Session\SessionBackend only
* @return bool
*/
abstract public function canChangeUser();
* @return bool
*/
abstract public function canChangeUser();
*
* No need to persist here, persistSession() will be called if appropriate.
*
*
* No need to persist here, persistSession() will be called if appropriate.
*
- * @protected For use by \\MediaWiki\\Session\\SessionBackend only
+ * @protected For use by \MediaWiki\Session\SessionBackend only
* @param SessionBackend $session Session to persist
* @param string $oldId Old session ID
* @codeCoverageIgnore
* @param SessionBackend $session Session to persist
* @param string $oldId Old session ID
* @codeCoverageIgnore
* A backend that cannot persist sesison ID or user info should implement
* this as a no-op.
*
* A backend that cannot persist sesison ID or user info should implement
* this as a no-op.
*
- * @protected For use by \\MediaWiki\\Session\\SessionBackend only
+ * @protected For use by \MediaWiki\Session\SessionBackend only
* @param SessionBackend $session Session to persist
* @param WebRequest $request Request into which to persist the session
*/
* @param SessionBackend $session Session to persist
* @param WebRequest $request Request into which to persist the session
*/
* A backend that cannot persist sesison ID or user info should implement
* this as a no-op.
*
* A backend that cannot persist sesison ID or user info should implement
* this as a no-op.
*
- * @protected For use by \\MediaWiki\\Session\\SessionManager only
+ * @protected For use by \MediaWiki\Session\SessionManager only
* @param WebRequest $request Request from which to remove any session data
*/
abstract public function unpersistSession( WebRequest $request );
* @param WebRequest $request Request from which to remove any session data
*/
abstract public function unpersistSession( WebRequest $request );
* User::idFromName( $username ) === 0); the name should still be
* prevented, if applicable.
*
* User::idFromName( $username ) === 0); the name should still be
* prevented, if applicable.
*
- * @protected For use by \\MediaWiki\\Session\\SessionManager only
+ * @protected For use by \MediaWiki\Session\SessionManager only
* @param string $username
*/
public function preventSessionsForUser( $username ) {
* @param string $username
*/
public function preventSessionsForUser( $username ) {
- * @protected For use by \\MediaWiki\\Session\\SessionManager only
+ * @protected For use by \MediaWiki\Session\SessionManager only
* @return array
*/
public function getVaryHeaders() {
* @return array
*/
public function getVaryHeaders() {
/**
* Return the list of cookies that need varying on.
/**
* Return the list of cookies that need varying on.
- * @protected For use by \\MediaWiki\\Session\\SessionManager only
+ * @protected For use by \MediaWiki\Session\SessionManager only
* @return string[]
*/
public function getVaryCookies() {
* @return string[]
*/
public function getVaryCookies() {
/**
* Get a suggested username for the login form
/**
* Get a suggested username for the login form
- * @protected For use by \\MediaWiki\\Session\\SessionBackend only
+ * @protected For use by \MediaWiki\Session\SessionBackend only
* @param WebRequest $request
* @return string|null
*/
* @param WebRequest $request
* @return string|null
*/
*
* This default implementation takes the class name, lowercases it,
* replaces backslashes with dashes, and prefixes 'sessionprovider-' to
*
* This default implementation takes the class name, lowercases it,
* replaces backslashes with dashes, and prefixes 'sessionprovider-' to
- * determine the message key. For example, MediaWiki\\Session\\CookieSessionProvider
+ * determine the message key. For example, MediaWiki\Session\CookieSessionProvider
* produces 'sessionprovider-mediawiki-session-cookiesessionprovider'.
*
* @note If self::__toString() is overridden, this will likely need to be
* produces 'sessionprovider-mediawiki-session-cookiesessionprovider'.
*
* @note If self::__toString() is overridden, this will likely need to be
/**
* Get the login token from the current session
/**
* Get the login token from the current session
- * @since 1.27 returns a MediaWiki\\Session\\Token instead of a string
- * @return MediaWiki\\Session\\Token
+ * @since 1.27 returns a MediaWiki\Session\Token instead of a string
+ * @return MediaWiki\Session\Token
*/
public static function getLoginToken() {
global $wgRequest;
*/
public static function getLoginToken() {
global $wgRequest;
/**
* Get the createaccount token from the current session
/**
* Get the createaccount token from the current session
- * @since 1.27 returns a MediaWiki\\Session\\Token instead of a string
- * @return MediaWiki\\Session\\Token
+ * @since 1.27 returns a MediaWiki\Session\Token instead of a string
+ * @return MediaWiki\Session\Token
*/
public static function getCreateaccountToken() {
global $wgRequest;
*/
public static function getCreateaccountToken() {
global $wgRequest;
/**
* Value object representing a logged-out user's edit token
*
/**
* Value object representing a logged-out user's edit token
*
- * This exists so that code generically dealing with MediaWiki\\Session\\Token
+ * This exists so that code generically dealing with MediaWiki\Session\Token
* (i.e. the API) doesn't have to have so many special cases for anon edit
* tokens.
*
* (i.e. the API) doesn't have to have so many special cases for anon edit
* tokens.
*
/**
* String Some punctuation to prevent editing from broken text-mangling proxies.
/**
* String Some punctuation to prevent editing from broken text-mangling proxies.
- * @deprecated since 1.27, use \\MediaWiki\\Session\\Token::SUFFIX
+ * @deprecated since 1.27, use \MediaWiki\Session\Token::SUFFIX
* @ingroup Constants
*/
define( 'EDIT_TOKEN_SUFFIX', Token::SUFFIX );
* @ingroup Constants
*/
define( 'EDIT_TOKEN_SUFFIX', Token::SUFFIX );
/**
* Global constant made accessible as class constants so that autoloader
* magic can be used.
/**
* Global constant made accessible as class constants so that autoloader
* magic can be used.
- * @deprecated since 1.27, use \\MediaWiki\\Session\\Token::SUFFIX
+ * @deprecated since 1.27, use \MediaWiki\Session\Token::SUFFIX
*/
const EDIT_TOKEN_SUFFIX = EDIT_TOKEN_SUFFIX;
*/
const EDIT_TOKEN_SUFFIX = EDIT_TOKEN_SUFFIX;
* @since 1.27
* @param string|array $salt Array of Strings Optional function-specific data for hashing
* @param WebRequest|null $request WebRequest object to use or null to use $wgRequest
* @since 1.27
* @param string|array $salt Array of Strings Optional function-specific data for hashing
* @param WebRequest|null $request WebRequest object to use or null to use $wgRequest
- * @return MediaWiki\\Session\\Token The new edit token
+ * @return MediaWiki\Session\Token The new edit token
*/
public function getEditTokenObject( $salt = '', $request = null ) {
if ( $this->isAnon() ) {
*/
public function getEditTokenObject( $salt = '', $request = null ) {
if ( $this->isAnon() ) {
/**
* Get the embedded timestamp from a token.
/**
* Get the embedded timestamp from a token.
- * @deprecated since 1.27, use \\MediaWiki\\Session\\Token::getTimestamp instead.
+ * @deprecated since 1.27, use \MediaWiki\Session\Token::getTimestamp instead.
* @param string $val Input token
* @return int|null
*/
* @param string $val Input token
* @return int|null
*/