How does MediaWiki calculate the file path to an image? - image

I'm just installing MediaWiki (loving it). I'm lookin at this for adding images. I can se the logic of
[[File:MediaWiki:Image sample|50px]]
but where so I set the filepath for "File" (nothing obvious in LocalSettings.php) ... or is there some other logic at work?
I'd appreciate any help
Thanks

File location is determined by $wgLocalFileRepo which by default depends on $wgUploadDirectory and $wgHashedUploadDirectory. The upload directory defaults to [MediaWiki base dir]/images (Adrian must be using an older version). If hashing is enabled, /x/xy will be appended to the path, where xy are the first two letters of the md5 hash of the filename.

The defaults from DefaultSettings.php are:
$wgUploadPath = "$wgScriptPath/uploads";
$wgUploadDirectory = "$IP/uploads";
If you want to change this, you should copy and paste this into LocalSettings.php
And make sure that $wgEnableUploads = true; is in LocalSettings.php too.

Your "Image sample" is the name of image, not the name of a file. By config file you can just set the root folder for image uploads.

Just for future reference in case someone else runs into this issue:
I installed MediaWiki on my Mac OS Sierra and when I attempted to upload an image I got the following message:
Failed:
Could not open lock file for "mwstore://local-backend/local-public/d/d9/babypicture.png".
I changed the permissions on the mediawiki_root/images folder to be owned by _www user and group.
chown -R _www:_www wiki/images
I was able to upload the image afterward.

Related

Why am I getting error code 135 when applying patch through opatch?

I am trying to write a script that automates opatch, but before I get into the actual scripting I want to test the commands directly through the command prompt. My oracle home is C:\oracle\Middleware, and my patch 23094292 folder is located in the Middleware folder. Here are the commands I am using to apply the patch:
cd C:\oracle\Middleware\23094292
C:\oracle\Middleware\OPatch\opatch apply
When I run the latter command I get this:
ZOP-51: The patch location is not valid for apply, because it doesn't have correct metadata, or it points to a patch directory.
Argument(s) Error... Patch location is not valid for apply
Please check the arguments and try again.
OPatch failed with error code = 135
Shouldn't oracle home be the valid patch location? I am not too familiar with Oracle's product's, so I'm not certain. Please let me know if I can provide any further information. Any help explaining what I am doing wrong would be greatly appreciated.
You're missing a directory in the 23094292 directory. There should be two directories in there, "files" and "etc". And then there should be a "README.txt" file there as well.
Edit: I'd just suggest removing the 23094292 directory and unzipping the zip file again, or re-download it if that doesn't work.

"The selected directory is not valid home for Lua SDK"?

I'm new here so I apologize if this question is breaking some rule or something. But this is becoming a problem for me. I downloaded Intellij and downloaded the lua plugin for it. Well, now I'm trying to configure lua sdk but everytime I put in the location for it, it says "The selected directory is not valid home for Lua SDK"
What is the valid home? What am I doing wrong?
The problem might be that your lua.exe file is actually named luaXX.exe where XX is the version.
In my case it was lua53.exe. I renamed just the lua53.exe file to lua.exe; I didn't rename the rest.
So at first I had:
lua53.dll
lua53.exe
luac53.exe
wlua53.exe
After renaming the file I have:
lua53.dll
lua.exe
luac53.exe
wlua53.exe
With this changed, the Intellij plugin detected the folder as a valid home.

Tell selenium to look in my C:/Downloads folder (Ruby)

me again!!
I have a question based around the download of a file. I was helped with setting up a Firefox profile to set a download to save a file directly without a pop up window. Now I need to tell Selenium to confirm that the said downloaded file is in my downloads folder on C drive to complete the test. Is there a way to do this? I've trawled for answers and have gotten nothing.
I first tried by setting a path like so on my env.rb file but didn't get very far with it:
$download_location = 'C:/Users/User/Downloads'
def download_location(path)
$download_location + path
end
Then telling cucumber to visit this location and confirm the name of the file.
Any help on pointing selenium to the location and confirming the name of a csv file would be hugely appreciated
Thanks
If you want to use ruby instead of selenium, you can use the exists? method to check the downloads directory for a given file, and it will return a Boolean result. For example:
File.exists?('C:\Users\User\Downloads\foo.txt')
I have found a solution that worked for me:
puts Dir["C:/Users/OSAT TESTING/Downloads/**/fleet_#{export}_export_all_*.csv"]
This confirmed the download of the file by looking in my downloads folder and returning the file path + name of any file that contained "fleet_#{export}_export_all_*.csv" in cmd prompt.
Thank you all for your help
:-)

Firefox 19.0.2 deletes proxy extension file

Working on Windows 8 64bit, Firefox 19.0.2.
I went to .../Firefox/Profiles/.../extensions and put my ekons#www.solver.ws file containing
a string
h:\myextensions\ekons\
The directory h:\myextensions\ekons\ contains install.rdf file of my extension.
Every time I restart Firefox, it deletes .../Firefox/Profiles/.../extensions/ekons#www.solver.ws file. Of course, without trying to install the extension.
Any suggestions?
Addition
I attach an image FF extensions directory.
Well, it was my mistake: extension file name was not the same as ID inside install.rdf.
Such files are silently deleted by FireFox from profile directory.
I had the same isue, the problem was an extra tag </em:description> in the install.rdf file.
When it was a valid XML all goes ok.

Use relative path in Firefox extension

I develop Firefox extension with bundled executable file which should be run on browser startup.
To run process I need get nsIFile or nsILocalFile instance which points to executable file.
I know one solution how to get it using directory service:
var file = Components.classes["#mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
file.append("extensions");
file.append("<extension id>");
file.append("<relative path>");
But this solution has two disadvantages:
It doesn't work in development mode, when instead of installed extension I have only text file with real extension path
I'm not sure that it will work on all Firefox configurations because of hardcoded "extensions" part of the path
So is there any nicer way to run executable file which comes with Firefox extension?
Thanks.
You are making way too many assumptions about the directory structure of the Firefox profile - don't. The Add-on Manager API lets you get the path of a file inside the extension, you should use it:
Components.utils.import("resource://gre/modules/AddonManager.jsm");
AddonManager.getAddonByID("<extension id>", function(addon)
{
var uri = addon.getResourceURI("<relative path>");
var file = uri.QueryInterface(Components.interfaces.nsIFileURL).file;
...
});
A restartless addon's startup function (in the bootstrap.js file) will receive, as its first parameter, the path where the addon is installed. You can then play various tricks to read files inside the .jar file, if any: see https://github.com/protz/GMail-Conversation-View/blob/master/bootstrap.js#L55 as an example.
In a non-restartless case, I must confess I don't have much of an idea :).
I found this thread looking for a way to reference a path to an image hosted in extension's directory from a content script. Here's a solution:
Include your files in web_accessible_resources in the extension's manifest.
"web_accessible_resources": [
"images/*"
]
Absolute paths to these resources contain randomly generated UUID, therefore we're using runtime.getUrl() giving it the path relative to manifest.json. Example:
let myImg = document.createElement('img');
myImg.src = browser.runtime.getURL("images/my-img.png")

Resources