@@ -158,6 +158,10 @@ public static function getOauthParams(
158158 return $ params ;
159159 }
160160
161+ public static function isLocalHost (): bool {
162+ return substr ($ _SERVER ['SERVER_NAME ' ], -10 , 10 ) === '.localhost ' ;
163+ }
164+
161165 /**
162166 * @param string $toolUrlTail Example: "/tools/widar"
163167 * @return mixed
@@ -167,7 +171,7 @@ public static function getSite(
167171 ) {
168172 // XXX: this same logic is in quickstatements.php and platform api WikiController backend
169173 $ domain = $ _SERVER ['SERVER_NAME ' ];
170- if ( substr ( $ domain ,- 10 , 10 ) === ' .localhost ' ){
174+ if ( self :: isLocalHost () ){
171175
172176 // localhost development, with a full domain prefixing .localhost
173177 // eg. wiki.addshore.com.localhost
@@ -186,10 +190,10 @@ public static function getSite(
186190 $ toolRoot = $ domain . $ toolUrlTail ;
187191
188192 // Directly for config
189- $ publicMwOAuthUrl = 'https:// ' . $ wbRoot . '/w/index.php?title=Special:OAuth ' ;
193+ $ publicMwOAuthUrl = 'https:// ' . $ wbRoot . '/w/index.php?title=Special:OAuth ' ; // TODO this could use the internal network
190194 $ mwOAuthUrl = 'https:// ' . $ wbRoot . '/w/index.php?title=Special:OAuth ' ;
191195 $ wbPublicHostAndPort = $ wbRoot ;
192- $ wbApi = 'https:// ' . $ wbRoot . '/w/api.php ' ;
196+ $ wbApi = 'https:// ' . $ wbRoot . '/w/api.php ' ; // TODO this could use the internal network
193197 $ wbPageBase = 'https:// ' . $ wbRoot . '/wiki/ ' ;
194198 $ toolbase = 'https:// ' . $ toolRoot ;
195199 }
0 commit comments