Last modified: 2013-03-12 00:57:24 UTC
See https://gerrit.wikimedia.org/r/#/c/53009/ Some developers proposed to me https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/OpenID.git;a=commitdiff;h=61d5807ea49252683c04408c34913952049a26c8 --- a/OpenID.php +++ b/OpenID.php @@ -46,7 +46,7 @@ $wgOpenIDHideOpenIDLoginLink = false; * Location of the OpenID login logo. You can copy this to your server if you * want. */ -$wgOpenIDLoginLogoUrl = $wgScriptPath . '/extensions/OpenID/skin/icons/openid-inputicon.png'; +$wgOpenIDLoginLogoUrl = $wgExtensionAssetsPath . '/OpenID/skin/icons/openid-inputicon.png'; This is empty in all my installations, also on the instances on wmflabs which are standards. It's not clear, what is happening, and I think, the setup of this variable in core in includes/setup.php is substantially >> wrong << at this place in core. https://gerrit.wikimedia.org/r/#/c/53009/ comment to patch set 2 I ask you, as an expert, can you try -- in your code just BEFORE you include the extension add three lines and tell me if your browser shows the correct path - or nothing - when navigating to your wiki: ### $wgExtensionAssetsPath = "$wgScriptPath/extensions"; echo $wgExtensionAssetsPath; // We need this because wfDebug() is not working at this stage !! die(); require_once( "$IP/extensions/OpenID/OpenID.php" );
You should only use things like $wgExtensionAssetsPath *after* basic initialziation, or it probably won't be set yet. Use it at general runtime -- when using something -- or from an initialization function. (Same really goes for $wgScriptPath as it can be customized, though usually the autodetected value will already be set correctly.)
So basically I need a variable for the web-access to the image = the fully specified path of an image in the extension. It is strange, that the value is empty, in my installations. Is its setup in includes/setup.php perhaps wrong, when it is to be used in LocalSettings or DefaultSettings ?
(In reply to comment #1) > You should only use things like $wgExtensionAssetsPath *after* basic > initialziation, or it probably won't be set yet. Use it at general runtime -- > when using something -- or from an initialization function. > > (Same really goes for $wgScriptPath as it can be customized, though usually > the > autodetected value will already be set correctly.) mid-air... what would you suggest ? One working method is to parse the _url_ of the running file (here: OpenID.php ) directly from the $_SERVER[], strip-off the basename to get the Web-path --- but this is ugly, isn't it ?Ireally wish to have a method for that.
(copied from one of my sniplet archives) $server = $_SERVER['SERVER_NAME']; $remoteAddress = $_SERVER['REMOTE_ADDR']; $pathParts = pathinfo( __FILE__ ); $scriptName = $pathParts['basename']; function scriptUrl() { $pageUrl = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == "on" ) ? 'https://' : 'http://'; $pageUrl .= $_SERVER['SERVER_PORT'] != '80' ? $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $_SERVER['SCRIPT_NAME'] : $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME']; return $pageUrl; } $imageBase = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR; $imageBaseUrl = str_replace( $scriptName, "", scriptUrl() ) . "img/";
It is normal that it is empty when your extension's configuration file is being loaded, because it may be *set by* LocalSettings.php. If not set explicitly, it will be derived by other settings that may be set or overridden in LocalSettings.php. As mentioned above, either use it at runtime -- NOT at config time -- or make an initialization function ($wgSetupFunctions or whatever it's called) which get run after these auto-detected settings are filled out.
can you help in this single case: https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/OpenID.git;a=blob;f=OpenID.php;h=468175395ac489f7adc8eff1cf7c744423de7799;hb=61d5807ea49252683c04408c34913952049a26c8#l49
I read this. thanks "As mentioned above, either use it at runtime -- NOT at config time -- or make an initialization function ($wgSetupFunctions or whatever it's called) which get run after these auto-detected settings are filled out."
just for my (E:OpenId) records: fixed in https://gerrit.wikimedia.org/r/#/c/53292/