X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=blobdiff_plain;f=includes%2FTitle.php;h=95ccd9a4569e7414edbcbaf08030bdd23ee653e9;hb=dd49c0c312043062e919549390ca46595b01bbb0;hp=6e75102c9212c30422a732af38c35414991df69f;hpb=d72f24589b3eece35b334d080e6e609b048fc22f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index 6e75102c92..95ccd9a456 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1770,6 +1770,7 @@ class Title implements LinkTarget, IDBAccessObject { if ( !MediaWikiServices::getInstance()->getNamespaceInfo()-> hasSubpages( $this->mNamespace ) + || strtok( $this->getText(), '/' ) === false ) { return $this->getText(); } @@ -1887,7 +1888,12 @@ class Title implements LinkTarget, IDBAccessObject { * @since 1.20 */ public function getSubpage( $text ) { - return self::makeTitleSafe( $this->mNamespace, $this->getText() . '/' . $text ); + return self::makeTitleSafe( + $this->mNamespace, + $this->getText() . '/' . $text, + '', + $this->mInterwiki + ); } /** @@ -2294,34 +2300,6 @@ class Title implements LinkTarget, IDBAccessObject { ->getPermissionErrors( $action, $user, $this, $rigor, $ignoreErrors ); } - /** - * Add the resulting error code to the errors array - * - * @param array $errors List of current errors - * @param array|string|MessageSpecifier|false $result Result of errors - * - * @return array List of errors - */ - private function resultToError( $errors, $result ) { - if ( is_array( $result ) && count( $result ) && !is_array( $result[0] ) ) { - // A single array representing an error - $errors[] = $result; - } elseif ( is_array( $result ) && is_array( $result[0] ) ) { - // A nested array representing multiple errors - $errors = array_merge( $errors, $result ); - } elseif ( $result !== '' && is_string( $result ) ) { - // A string representing a message-id - $errors[] = [ $result ]; - } elseif ( $result instanceof MessageSpecifier ) { - // A message specifier representing an error - $errors[] = [ $result ]; - } elseif ( $result === false ) { - // a generic "We don't want them to do that" - $errors[] = [ 'badaccess-group0' ]; - } - return $errors; - } - /** * Get a filtered list of all restriction types supported by this wiki. * @param bool $exists True to get all restriction types that apply to @@ -2949,7 +2927,7 @@ class Title implements LinkTarget, IDBAccessObject { $this->mHasSubpages = false; $subpages = $this->getSubpages( 1 ); if ( $subpages instanceof TitleArray ) { - $this->mHasSubpages = (bool)$subpages->count(); + $this->mHasSubpages = (bool)$subpages->current(); } } @@ -4290,7 +4268,7 @@ class Title implements LinkTarget, IDBAccessObject { * Get the timestamp when this page was updated since the user last saw it. * * @param User|null $user - * @return string|null + * @return string|bool|null String timestamp, false if not watched, null if nothing is unseen */ public function getNotificationTimestamp( $user = null ) { global $wgUser;