Last modified: 2011-03-13 18:05:38 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T7125, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 5125 - Make config file location cleaner
Make config file location cleaner
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
Installer (Other open bugs)
1.5.x
All All
: Lowest enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-02-27 22:38 UTC by Marcus Bointon
Modified: 2011-03-13 18:05 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch to config/index.php to streamline config file location (2.12 KB, patch)
2006-02-27 22:40 UTC, Marcus Bointon
Details
Better config location patch for config/index.php (2.84 KB, patch)
2006-02-27 23:57 UTC, Marcus Bointon
Details

Description Marcus Bointon 2006-02-27 22:38:48 UTC
While attempting installation of MediaWiki 1.5.6 inside a sourceforge account, I ran into the problem that the web tree is not writable by the web 
server, so MediaWiki installation fails as the config folder cannot be made writable. In looking at how to fix this, I noticed that the location of the 
created config file is hard-coded in multiple locations. I cleaned this up a bit and defined a bunch of constants for naming and locating new and 
existing config files. This simplified my sourceforge install greatly, and should help others in similar situations. It would be nice to extend the 
config form to deal with this, but this is an improvement for now.

Three constants are defined: MEDIAWIKI_CONFIG_FILENAME contains the default 'LocalSettings.php' filename; MEDIAWIKI_NEW_CONFIG_DIR (defaults 
to '.') which is an absolute path or a path relative to the config folder indicating where a newly created config file should be placed; 
MEDIAWIKI_EXISTING_CONFIG_DIR (defaults to '..') which similarly indicated the location of an existing config file. I then amended the code that 
locates and creates the config file (don't think I missed any) to use these constants, and I attach a patch relative to the 1.5.6 source.
Comment 1 Marcus Bointon 2006-02-27 22:40:48 UTC
Created attachment 1420 [details]
Patch to config/index.php to streamline config file location
Comment 2 Marcus Bointon 2006-02-27 23:57:42 UTC
Created attachment 1421 [details]
Better config location patch for config/index.php

Apologies for that first patch - I had misinterpreted the purpose of $sep. This
patch is better (using DIRECTORY_SEPARATOR instead), and also improves
interface feedback to reflect the actual location of files written.
Comment 3 Marcus Bointon 2006-02-28 21:25:57 UTC
Why was this classed as invalid? It's pretty dumb to have multiple hardcoded paths at the best of times - MediaWiki's own code spends 
considerable effort working out an include path - why not apply the same approach to the config file? If it really is considered invalid, then there 
should (by definition) be a documentation change saying 'MediaWiki CANNOT be installed on servers that do not allow write access below the web 
root'. If on the other hand you don't consider that statement to be true, then this patch is not invalid, so make your mind up. If on the other hand 
you had an objection to the particular implementation, then you could at least have had the decency to say so.
Comment 4 Brion Vibber 2006-03-02 02:25:41 UTC
You're always free to do a manual installation if your host is 
broken.
Comment 5 Marcus Bointon 2006-03-02 10:15:23 UTC
Well that's what I did by fixing the installer, thus making it easier for others to do the same, and making 
MediaWiki more reliable, flexible and able to be installed easily on 'broken' hosts such as SourceForge. I can't 
think of any real downside to this patch - duplicated, hard-coded paths are considered by many to be a bug 
in their own right. I'm sorry if I got the impression that this was a collaborative, open-source project 
supported by contributors.
Comment 6 Brion Vibber 2006-03-02 10:30:06 UTC
(Note that MediaWiki is primarily in-house software for Wikipedia, so the 
installer doesn't get much lovin'.)

I don't really like this implementation; since it requires hacking up the 
source it's still not providing for a clean install out of the box. Would 
it be better to allow, say, automatic selection of a temp directory or 
just dumping the config file to output for copy-and-paste?
Comment 7 Marcus Bointon 2006-03-02 11:02:36 UTC
I mentioned something to that effect in my original post - yes it would be nice to be able to set this from an 
installer form - perhaps one that appears if it finds that the default file location is not writable? I also agree 
that while hacking the source to fix the install is not great, it's much better to only have to hack it in one 
place instead of six or so (and with a far greater chance of failure). Having changed the code so that it does 
have a single definition for the file location also means that writing an interface for it will be easier. I wasn't 
really planning to, but I could give it a go if you like.
I appreciate that MW is mainly in-house - that's why you need contributors to be annoyed by the bits you 
don't use ;^)
Comment 8 Roland Krystian Alberciak 2006-07-15 02:19:07 UTC
Hello,

I just ran into this bug posting after pulling my hair out why MediaWiki would
not install in our project team's sf.net webpage. [1] 

I know of at least one other person that gave up on trying ot get their sf.net
webspace up and running with mediawiki, and so loaded it on his own domain.

Action Item (just suggestions, but could help, I don't know if this this a
thread hijack but this topic is directly related to sf.net setup and user
workarounds):

- WikiMedia is great software and lots of project teams benefit from a wiki
being used to maintain doc. Please post some kind of information article
directed towards users of sf.net on the sf.net project webspace about the
problems sf.net users encounter and how it is recommended we should resolve them. =(
- Perhaps have a bug listing in Mantis with the words sf.net sourceforge.net in
the title of the submission (I wasn't able to locate one, so as a result I dug
inside the bug threads and found this! =) )
- Idea (may not be practical or appropraite): If you detect sourceforge.net as
the hostname in the wikipedia autoconfigure process, present a link in the
autoconfigure to tell someone to visit a particular link.
-- Better yet, maybe if you can detect somehow the the config folder cannot be
writable (how?- maybe if the user reruns the web based autoconfigure process
multiple times and keeps getting the same message...), present some information
to the user about the specific problem he/she could be experiancing and how to
resolve it (or where to read more on it)


Thank you so much for this thread. I hope we can at least save some time and
effort of future installers of mediawiki on sf.net. =)


[1] I've tried installing wikimedia months ago then recently retried to get the
same error message regarding my config directory not being writable, and thus
began looking into it deeper. I was able to get it working without a problem
many times in the past on my own domains, so didn't understand where the problem
could have originated.
Comment 9 Roland Krystian Alberciak 2006-07-15 19:34:57 UTC
I'm claim to be no expert on this issue, but from what I've digested and
understood, I've posted a support request to sf.net on this issue. Please review
it, correct it, and lobby, as necessary, to see advancements in this area:

SourceForge.net: Modify: 1523144 - Web tree under web root is not writable by
the web sever
https://sourceforge.net/tracker/?func=detail&atid=200001&aid=1523144&group_id=1


This is also left here as a footprint for those trying to resolve this issue as
well, from a policy standpoint.
Comment 10 Marcus Bointon 2006-07-17 11:14:52 UTC
Getting SF.com to make their web space globally writable is not a good idea - because all project sites are run under the same user, it 
would mean that any site could write into any other. A better solution would be for mediawiki to support an alternative to writing a local 
config file, such as displaying the config file contents in the installation page so that it can manually be saved in a local file via non-web 
means.
Comment 11 Chad H. 2010-07-09 21:10:34 UTC
I'm WONTFIXing this for several reasons.

1) We're not going to change the name of LocalSettings.php or make it customizable.

2) The name of the installation path "/config/index.php" is static and also does not need customization. Whether or not this is a good name (/config seems to conflict) is under discussion at bug 1379.

3) Writing to /config is unsafe. Plans for the new-installer are to ditch writing of LocalSettings.php to the /config directory, and instead offer it as a download to the site administrator to then put in place.
Comment 12 Marcus Bointon 2010-07-10 08:40:34 UTC
Goodness, I'd forgotten I'd written all this.

I find your conclusion nonsensical - My changes for 1 above does not amount to customization, merely that making the definition only in one place (aka DRY), which is just good coding practice IMHO. WHEN you decide to change it, chances are you'll write code that does pretty much the same thing. Either that or invite disaster by making changes in multiple locations.

3 directly conflicts with 2: you say that writing to config is dangerous (which is why SF doesn't allow it), but then refuse to provide a workaround. Also, again my changes really only amount to making this so it's set only in once place, it doesn't represent any change in policy. Allowing someone to hack the path simply (for example so it writes somewhere that's writable but not under the web root) seems like a handy side effect.

To summarise: my patch would:

a) simplify changing paths used by mediawiki and make doing so safer and more reliable, pre-emptively fixing future bugs in that area
b) have a side effect of making changing them again easier, even though that may not be the primary aim
c) make mediawiki installations on sourceforge easier

I'm mystified why you'd not want this fix; the alternative means you're deliberately choosing to live with bad code for no good reason.
Comment 13 Chad H. 2010-07-10 09:01:23 UTC
(In reply to comment #12)
> Goodness, I'd forgotten I'd written all this.
> 

Lots of installer bugs are old. None of the patches on them apply to the new installer.

> I find your conclusion nonsensical - My changes for 1 above does not amount to
> customization, merely that making the definition only in one place (aka DRY),
> which is just good coding practice IMHO.  WHEN you decide to change it, chances
> are you'll write code that does pretty much the same thing. Either that or
> invite disaster by making changes in multiple locations.
> 

/config isn't hardcoded in a bazillion places these days. It wouldn't be hard to find and fix the few manual usages. Like I said above, if we decide to change where the entry point is, that's being discussed at bug 1379

> 3 directly conflicts with 2: you say that writing to config is dangerous (which
> is why SF doesn't allow it), but then refuse to provide a workaround. 

Writing to /config isn't safe. Neither is writing to /foobar or /mysecretinstaller. Changing the directory does nothing to mitigate the issue. We don't want the web server being the owner of the config file at all. See http://www.mediawiki.org/wiki/New-installer_issues?diff=334526&oldid=333913 for more information.

>Also,
> again my changes really only amount to making this so it's set only in once
> place, it doesn't represent any change in policy. Allowing someone to hack the
> path simply (for example so it writes somewhere that's writable but not under
> the web root) seems like a handy side effect.
> 
> To summarise: my patch would:
> 
> a) simplify changing paths used by mediawiki and make doing so safer and more
> reliable, pre-emptively fixing future bugs in that area
> b) have a side effect of making changing them again easier, even though that
> may not be the primary aim
> c) make mediawiki installations on sourceforge easier
> 

To summarize, we're changing the installer so that you no longer have the web server writing the config file. So customizing it is no longer an issue :)

> I'm mystified why you'd not want this fix; the alternative means you're
> deliberately choosing to live with bad code for no good reason.

You haven't seen the new installer, have you? The code is far better than when you submitted that patch ;-) http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/installer/

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links