dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove 'bot' check before trying the edit stash
[lhc/web/wiklou.git]
/
includes
/
Title.php
diff --git
a/includes/Title.php
b/includes/Title.php
index
8a15b54
..
1fdeca8
100644
(file)
--- a/
includes/Title.php
+++ b/
includes/Title.php
@@
-206,7
+206,7
@@
class Title {
* @return TitleFormatter
*/
private static function getTitleFormatter() {
* @return TitleFormatter
*/
private static function getTitleFormatter() {
- //NOTE: we know that getTitleParser() returns a MediaWikiTitleCodec,
+ //
NOTE: we know that getTitleParser() returns a MediaWikiTitleCodec,
// which implements TitleFormatter.
return self::getTitleParser();
}
// which implements TitleFormatter.
return self::getTitleParser();
}
@@
-252,7
+252,7
@@
class Title {
* Create a new Title from text, such as what one would find in a link. De-
* codes any HTML entities in the text.
*
* Create a new Title from text, such as what one would find in a link. De-
* codes any HTML entities in the text.
*
- * @param string $text The link text; spaces, prefixes, and an
+ * @param string
|null
$text The link text; spaces, prefixes, and an
* initial ':' indicating the main namespace are accepted.
* @param int $defaultNamespace The namespace to use if none is specified
* by a prefix. If you want to force a specific namespace even if
* initial ':' indicating the main namespace are accepted.
* @param int $defaultNamespace The namespace to use if none is specified
* by a prefix. If you want to force a specific namespace even if
@@
-264,9
+264,13
@@
class Title {
public static function newFromText( $text, $defaultNamespace = NS_MAIN ) {
if ( is_object( $text ) ) {
throw new InvalidArgumentException( '$text must be a string.' );
public static function newFromText( $text, $defaultNamespace = NS_MAIN ) {
if ( is_object( $text ) ) {
throw new InvalidArgumentException( '$text must be a string.' );
- } elseif ( !is_string( $text ) ) {
+ }
+ if ( $text !== null && !is_string( $text ) ) {
wfDebugLog( 'T76305', wfGetAllCallers( 5 ) );
wfDebugLog( 'T76305', wfGetAllCallers( 5 ) );
- wfWarn( __METHOD__ . ': $text must be a string. This will throw an InvalidArgumentException in future.', 2 );
+ return null;
+ }
+ if ( $text === null ) {
+ return null;
}
try {
}
try {
@@
-292,7
+296,7
@@
class Title {
*/
public static function newFromTextThrow( $text, $defaultNamespace = NS_MAIN ) {
if ( is_object( $text ) ) {
*/
public static function newFromTextThrow( $text, $defaultNamespace = NS_MAIN ) {
if ( is_object( $text ) ) {
- throw new MWException( '
Title::newFromTextThrow
given an object' );
+ throw new MWException( '
$text must be a string,
given an object' );
}
$cache = self::getTitleCache();
}
$cache = self::getTitleCache();
@@
-526,7
+530,7
@@
class Title {
* @param string $title Database key form
* @param string $fragment The link fragment (after the "#")
* @param string $interwiki Interwiki prefix
* @param string $title Database key form
* @param string $fragment The link fragment (after the "#")
* @param string $interwiki Interwiki prefix
- * @return Title The new object, or null on an error
+ * @return Title
|null
The new object, or null on an error
*/
public static function makeTitleSafe( $ns, $title, $fragment = '', $interwiki = '' ) {
if ( !MWNamespace::exists( $ns ) ) {
*/
public static function makeTitleSafe( $ns, $title, $fragment = '', $interwiki = '' ) {
if ( !MWNamespace::exists( $ns ) ) {
@@
-1004,10
+1008,8
@@
class Title {
*/
public function getNsText() {
if ( $this->isExternal() ) {
*/
public function getNsText() {
if ( $this->isExternal() ) {
- // This probably shouldn't even happen. ohh man, oh yuck.
- // But for interwiki transclusion it sometimes does.
- // Shit. Shit shit shit.
- //
+ // This probably shouldn't even happen,
+ // but for interwiki transclusion it sometimes does.
// Use the canonical namespaces if possible to try to
// resolve a foreign namespace.
if ( MWNamespace::exists( $this->mNamespace ) ) {
// Use the canonical namespaces if possible to try to
// resolve a foreign namespace.
if ( MWNamespace::exists( $this->mNamespace ) ) {
@@
-1416,6
+1418,7
@@
class Title {
* Deprecated for public use, use Title::makeTitle() with fragment parameter.
* Still in active use privately.
*
* Deprecated for public use, use Title::makeTitle() with fragment parameter.
* Still in active use privately.
*
+ * @private
* @param string $fragment Text
*/
public function setFragment( $fragment ) {
* @param string $fragment Text
*/
public function setFragment( $fragment ) {
@@
-1939,10
+1942,9
@@
class Title {
* - quick : does cheap permission checks from slaves (usable for GUI creation)
* - full : does cheap and expensive checks possibly from a slave
* - secure : does cheap and expensive checks, using the master as needed
* - quick : does cheap permission checks from slaves (usable for GUI creation)
* - full : does cheap and expensive checks possibly from a slave
* - secure : does cheap and expensive checks, using the master as needed
- * @param bool $short Set this to true to stop after the first permission error.
* @param array $ignoreErrors Array of Strings Set this to a list of message keys
* whose corresponding errors may be ignored.
* @param array $ignoreErrors Array of Strings Set this to a list of message keys
* whose corresponding errors may be ignored.
- * @return array Array of arguments to wfMessage to explain permissions problems.
+ * @return array Array of ar
rays of the ar
guments to wfMessage to explain permissions problems.
*/
public function getUserPermissionsErrors(
$action, $user, $rigor = 'secure', $ignoreErrors = array()
*/
public function getUserPermissionsErrors(
$action, $user, $rigor = 'secure', $ignoreErrors = array()
@@
-1951,9
+1953,12
@@
class Title {
// Remove the errors being ignored.
foreach ( $errors as $index => $error ) {
// Remove the errors being ignored.
foreach ( $errors as $index => $error ) {
- $err
or_k
ey = is_array( $error ) ? $error[0] : $error;
+ $err
K
ey = is_array( $error ) ? $error[0] : $error;
- if ( in_array( $error_key, $ignoreErrors ) ) {
+ if ( in_array( $errKey, $ignoreErrors ) ) {
+ unset( $errors[$index] );
+ }
+ if ( $errKey instanceof MessageSpecifier && in_array( $errKey->getKey(), $ignoreErrors ) ) {
unset( $errors[$index] );
}
}
unset( $errors[$index] );
}
}
@@
-2052,6
+2057,9
@@
class Title {
} elseif ( $result !== '' && is_string( $result ) ) {
// A string representing a message-id
$errors[] = array( $result );
} elseif ( $result !== '' && is_string( $result ) ) {
// A string representing a message-id
$errors[] = array( $result );
+ } elseif ( $result instanceof MessageSpecifier ) {
+ // A message specifier representing an error
+ $errors[] = array( $result );
} elseif ( $result === false ) {
// a generic "We don't want them to do that"
$errors[] = array( 'badaccess-group0' );
} elseif ( $result === false ) {
// a generic "We don't want them to do that"
$errors[] = array( 'badaccess-group0' );
@@
-2945,7
+2953,7
@@
class Title {
$this->mRestrictions['move'] = explode( ',', trim( $temp[0] ) );
} else {
$restriction = trim( $temp[1] );
$this->mRestrictions['move'] = explode( ',', trim( $temp[0] ) );
} else {
$restriction = trim( $temp[1] );
- if ( $restriction != '' ) { //some old entries are empty
+ if ( $restriction != '' ) { //
some old entries are empty
$this->mRestrictions[$temp[0]] = explode( ',', $restriction );
}
}
$this->mRestrictions[$temp[0]] = explode( ',', $restriction );
}
}
@@
-4380,7
+4388,7
@@
class Title {
/**
* Updates page_touched for this page; called from LinksUpdate.php
*
/**
* Updates page_touched for this page; called from LinksUpdate.php
*
- * @param
integer $purgeTime TS_MW timestamp [optional]
+ * @param
string $purgeTime [optional] TS_MW timestamp
* @return bool True if the update succeeded
*/
public function invalidateCache( $purgeTime = null ) {
* @return bool True if the update succeeded
*/
public function invalidateCache( $purgeTime = null ) {
@@
-4415,19
+4423,16
@@
class Title {
* on the number of links. Typically called on create and delete.
*/
public function touchLinks() {
* on the number of links. Typically called on create and delete.
*/
public function touchLinks() {
- $u = new HTMLCacheUpdate( $this, 'pagelinks' );
- $u->doUpdate();
-
+ DeferredUpdates::addUpdate( new HTMLCacheUpdate( $this, 'pagelinks' ) );
if ( $this->getNamespace() == NS_CATEGORY ) {
if ( $this->getNamespace() == NS_CATEGORY ) {
- $u = new HTMLCacheUpdate( $this, 'categorylinks' );
- $u->doUpdate();
+ DeferredUpdates::addUpdate( new HTMLCacheUpdate( $this, 'categorylinks' ) );
}
}
/**
* Get the last touched timestamp
*
}
}
/**
* Get the last touched timestamp
*
- * @param
DatabaseB
ase $db Optional db
+ * @param
IDatab
ase $db Optional db
* @return string Last-touched timestamp
*/
public function getTouched( $db = null ) {
* @return string Last-touched timestamp
*/
public function getTouched( $db = null ) {