X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FTitle.php;h=60adb570fe15cdf2397115c05e622d5703e4a619;hb=9ddd146c262806e993ea66994f367a0a795e762d;hp=0f5c3841ff84a2e450385840e9555704b860841a;hpb=f66b93107594a4fc56e6cb86f32543fd153cdf40;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index 0f5c3841ff..60adb570fe 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1266,13 +1266,11 @@ class Title implements LinkTarget, IDBAccessObject { /** * Returns true if the title is inside one of the specified namespaces. * - * @param int|int[] $namespaces,... The namespaces to check for + * @param int|int[] ...$namespaces The namespaces to check for * @return bool * @since 1.19 - * @suppress PhanCommentParamOnEmptyParamList Cannot make variadic due to HHVM bug, T191668#5263929 */ - public function inNamespaces( /* ... */ ) { - $namespaces = func_get_args(); + public function inNamespaces( ...$namespaces ) { if ( count( $namespaces ) > 0 && is_array( $namespaces[0] ) ) { $namespaces = $namespaces[0]; } @@ -2062,7 +2060,7 @@ class Title implements LinkTarget, IDBAccessObject { * * @see self::getLocalURL for the arguments. * @see wfExpandUrl - * @param string|string[] $query + * @param string|array $query * @param string|string[]|bool $query2 * @param string|int|null $proto Protocol type to use in URL * @return string The URL @@ -2123,7 +2121,7 @@ class Title implements LinkTarget, IDBAccessObject { * valid to link, locally, to the current Title. * @see self::newFromText to produce a Title object. * - * @param string|string[] $query An optional query string, + * @param string|array $query An optional query string, * not used for interwiki links. Can be specified as an associative array as well, * e.g., [ 'action' => 'edit' ] (keys and values will be URL-escaped). * Some query patterns will trigger various shorturl path replacements. @@ -2137,7 +2135,7 @@ class Title implements LinkTarget, IDBAccessObject { * @return string String of the URL. */ public function getLocalURL( $query = '', $query2 = false ) { - global $wgArticlePath, $wgScript, $wgServer, $wgRequest; + global $wgArticlePath, $wgScript, $wgServer, $wgRequest, $wgMainPageIsDomainRoot; $query = self::fixUrlQueryArgs( $query, $query2 ); @@ -2214,6 +2212,11 @@ class Title implements LinkTarget, IDBAccessObject { $url = $wgServer . $url; } } + + if ( $wgMainPageIsDomainRoot && $this->isMainPage() && $query === '' ) { + return '/'; + } + // Avoid PHP 7.1 warning from passing $this by reference $titleRef = $this; Hooks::run( 'GetLocalURL', [ &$titleRef, &$url, $query ] ); @@ -2258,7 +2261,7 @@ class Title implements LinkTarget, IDBAccessObject { * protocol-relative, the URL will be expanded to http:// * * @see self::getLocalURL for the arguments. - * @param string|string[] $query + * @param string|array $query * @param string|bool $query2 Deprecated * @return string The URL */ @@ -2281,7 +2284,7 @@ class Title implements LinkTarget, IDBAccessObject { * NOTE: Unlike getInternalURL(), the canonical URL includes the fragment * * @see self::getLocalURL for the arguments. - * @param string|string[] $query + * @param string|array $query * @param string|bool $query2 Deprecated * @return string The URL * @since 1.18