MediaWiki upgrade breaks File prefix but legacy Image works - image

Did a MediaWiki upgrade from 1.15.1 to 1.20.2 by following the simple update instructions (basically a new installation, copying over the old LocalSettings.php, update script and copying over images). Weird thing now is that all of the File: prefixes don't work. Instead the internal links to images is a "file:name of image" URL rather than "http://mediawiki address/index.php/File:name of image".
Anybody else getting this. Assuming it is something wrong with the old LocalSettings.php.
Ran the refreshLinks and refreshImageMetadata maintenance scripts without fixing the problem.

In the comments, you wrote that you have file: added to $wgUrlProtocols. This is very likely what's triggering the problem.
It looks like something has changed in the parser between MW 1.15 and 1.20 so that it's now parsing file:whatever as an external link (since it matches the file: prefix you've defined in $wgUrlProtocols) even if it's inside square brackets.
The obvious workaround would be to change the $wgUrlProtocols entry from file: to file:// so that it will only match if the slashes are there (as they should be, according to standard file: URL syntax). Since your on-wiki filenames are, presumably, very unlikely to begin with double slashes, they should not match this more specific prefix.
That said, this could still be considered a bug in MediaWiki. You may want to file a bug report about it, if there isn't one yet.
(Edit: Looks like Mark A. Hershberger filed one already.)

Related

Comments in _CoqProject

Is there a way to have comments in a _CoqProject file?
I'd like to compile only part of a library, without completely removing all the other files from the _CoqProject file.
# is treated as a comment-the-rest-of-the-line symbol.
I think it is not documented as of now (see issue #7647). But the source code and some experiments show that it works.

how to space multiple lines in github issues

I am copying a bunch of log output to a github issue and I want to indent it so that it is distinguishable as code/output from the rest of the issue.
How do I do this?
I tried:
CTRL+Tab
CTRL+[
CTRL+]
CTRL+Spacebar
but none seem to work? I really don't want to do every single line individually..
Wrap your code inside ```.
You can also specify language name after if your log file is analogus to any programming language's syntax.
e.g.
```yaml
You can refer Gihub Flavored Markdown for more info.

Magento translation fails

I have trouble translating the phrase "%s was added to your shopping cart." in magento. This is a message that is called in a php-controller (cartController.php).
I use csv-files for the translation and checked them multiple times for errors (missing quotes, wrong quotes, ...), but the translation still won't work. Translating inline seems also impossible as no option is shown to translate success-messages.
I also checked the store language (which is set to Dutch), locale configuration and via code what language he finds, this all turns out fine, everything is okay.
Does anyone know what next steps I should take to investigate this problem or even better: does anyone know a solution for this problem? I found many threads like this one, but unanswered or without an answer for me.
One more thing: Yes, I cleared my cache and translations ;-).
Tx
Try to put translate.csv into your theme folder:
(root)/app/design/frontend/(theme)/default/locale/nl_NL/translate.csv
And put your translation there.
Check the encoding of your file Mage_Checkout.csv
Probably you have ANSI or UTF-8, but it should be "UTF-8 without BOM", otherwise Magento has troubles in using the translation file.

Insert a hyperlink to another file (Word) into Visual Studio code file

I am currently developing some functionality that implements some complex calculations. The calculations themselves are explained and defined in Word documents.
What I would like to do is create a hyperlink in each code file that references the assocciated Word document - just as you can in Word itself. Ideally this link would be placed in or near the XML comments for each class.
The files reside on a network share and there are no permissions to worry about.
So far I have the following but it always comes up with a file not found error.
file:///\\165.195.209.3\engdisk1\My Tool\Calculations\111-07 MyToolCalcOne.docx
I've worked out the problem is due to the spaces in the folder and filenames.
My Tool
111-07 MyToolCalcOne.docx
I tried replacing the spaces with %20, thus:
file:///\\165.195.209.3\engdisk1\My%20Tool\Calculations\111-07%20MyToolCalcOne.docx
but with no success.
So the question is; what can I use in place of the spaces?
Or, is there a better way?
One way that works beautifully is to write your own URL handler. It's absolutely trivial to do, but so very powerful and useful.
A registry key can be set to make the OS execute a program of your choice when the registered URL is launched, with the URL text being passed in as a command-line argument. It just takes a few trivial lines of code to will parse the URL in any way you see fit in order to locate and launch the documentation.
The advantages of this:
You can use a much more compact and readable form, e.g. mydocs://MyToolCalcOne.docx
A simplified format means no trouble trying to encode tricky file paths
Your program can search anywhere you like for the file, making the document storage totally portable and relocatable (e.g. you could move your docs into source control or onto a website and just tweak your URL handler to locate the files)
Your URL is unique, so you can differentiate files, web URLs, and documentation URLs
You can register many URLs, so can use different ones for specs, designs, API documentation, etc.
You have complete control over how the document is presented (does it launch Word, an Internet Explorer, or a custom viewer to display the docs, for example?)
I would advise against using spaces in filenames and URLs - spaces have never worked properly under Windows, and always cause problems (or require ugliness like %20) sooner or later. The easiest and cleanest solution is simply to remove the spaces or replace them with something like underscores, dashes or periods.

Set allow_url_include on SINGLE file

I've created a php file called pagebase.php that I'm quite proud of. It contains a class that created the whole html file for me from input such as css links and js links.
In any case, this file is several hundred lines long, as it includes several helper functions such as cleanHTML() that removes all whitespace from the html code then, in layman's terms, makes the source look pritty.
I have decided to use this pagebase in all my projects, particularly in all my internal projects. I also plan to add and expand to the pagebase file quite a lot. So what I'm wondering is if it's possible to set the allow_url_include option to on, but just on this one single file.
If I got my theory right, that would allow me to include() that file from any server and get the pagebase class.
So what I'm wondering is if it's possible to set the allow_url_include option to on, but just on this one single file.
No, as far as I'm aware this is not possible.
What you are planning to do sounds like a bad idea anyway, though. An include that gets loaded over the web on every request is awful for performance.
You should keep local copies of your library, and use a update script (or version control system) to keep versions up to date.
That is a bad practice.
You should put this file along with the project that needs it and locally include() it.
10 years and still no good solutions? Use this first one with allow_url_fopen for any convenient solution for your PHP file to allow the use of the php.ini brackets.
Replace allow_url_fopen in my example with allow_url_include to address the question.
This will surely be stated as a minor problem in future PHP. Especially if things aren't set up right with at least options are enabled globally. And this only works if there are no global php.ini rules.
Number 1 and 0 in code is either on and off.
<?php
echo ini_get('allow_url_fopen');
if (!ini_get('allow_url_fopen')) {
ini_set('allow_url_fopen', '1');
}
echo ini_get('allow_url_fopen');
Your code of use of either fopen() or copy() in between the code. Even some curl_init() might work.
echo ini_get('allow_url_fopen');
if (!ini_get('allow_url_fopen')) {
ini_set('allow_url_fopen', '0');
}
echo ini_get('allow_url_fopen');
}
?>
This also works for several other php.ini rules. I believe that this proof would be a security issue in many PHP codes further into the future. Surely a good thing to monitor in plugins in the further future or now for anti-malware signature. At least use the right global settings from now.

Resources