Aryeh Gregor wrote:
On Fri, May 1, 2009 at 4:32 PM, Ilmari Karonen nospam@vyznev.net wrote:
Not sure if it's worth the trouble, at least unless someone can think of a good place to put the check such that we don't have to run it on each and every request. Sure, the cost of such a check is minimal, but so is the frequency with which most people change their $wgUploadPath.
If avoiding a single preg_match() would make a noticeable difference in the speed of our code, I'd be *very* happy. :) We already run plenty of trivial sanity checks on every page view. One more is not going to hurt anything.
Yeah, but having sanity checks for each and every config option that someone could possibly screw up in the main code path can't be good for performance. The cost of every single one is vanishing, but we have a lot of config options that could use them as much as $wgUploadPath would. And we serve a lot of requests.
Sure, we probably _could_ do it, for each and every config option if we like, without making the code much more bloated than it is. But it's not really the direction I'd personally prefer to see us go. We already suffer from a serious enough case of the inner-platform effect as it is.
Anyway, what I was really thinking was that $wgUploadPath is one of those variables that people rarely if ever change once they've set up their wiki for the first time, and most will get it right the first time anyway. So even if checking it takes only a fraction of a millisecond, the total CPU time spent on checks *per successful detection of an error* may well be surprisingly high.
Hmm... maybe we could make that setting (and the other upload-related ones) part of the install process, and include the checks there. Or we could go with my earlier idea and just include prominent notices saying "After modifying LocalSettings.php, go to Special:CheckConfig to make sure you've made no mistakes.")