01055: Slight tweak to sample-config.php include_once lines for farm use
Description:
Intro
This is a slight usability tweak to the sample-config.php. This is to address an issue with single quotes in the sample-config.php when used with farms. It is not a bug, but a simple change would avoid a gotcha that users might face.
Background
The sample-config.php has several lines that use the include_once feature, most are commented out, they are:
Line#52 # include_once(scripts/creole.php); Line#104 # if ($action == 'refcount') include_once(scripts/refcount.php); Line#108 # if ($action == 'rss') include_once(scripts/feeds.php); # RSS 2.0 Line#109 # if ($action == 'atom') include_once(scripts/feeds.php); # Atom 1.0 Line#110 # if ($action == 'dc') include_once(scripts/feeds.php); # Dublin Core Line#111 # if ($action == 'rdf') include_once(scripts/feeds.php); # RSS 1.0 Line#137 # include_once(scripts/urlapprove.php);
Issue
If the user is using farms, he or she will change these lines to from...
include_once(
to...
include_once($FarmD
/
so for example, the line...
# if ($action == 'rss') include_once(scripts/feeds.php); # RSS 2.0
Should be...
# if ($action == 'rss') include_once($FarmD
/scripts/feeds.php); # RSS 2.0
So that the Farm directory is used. This induces a bug whereby some scripts need this include to be double quotes rather than single quotes. The following two warnings are displayed, and the RSS feed (for example) is not returned. When seeing these warnings and the error the URL was ?action=rss
Warning: include_once(
$FarmD
/scripts/feeds.php) [function.include-once]: failed to open stream: No such file or directory in /var/www/code/ssofb_website/local/farmconfig.php on line 115Warning: include_once() [function.include]: Failed opening '
$FarmD
/scripts/feeds.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/code/ssofb_website/local/farmconfig.php on line 115
Platform info
PmWiki version: 2.2.0-beta67
Solution
The solution to this is simple. Just change the single quotes to double quotes. For example the line...
# if ($action == 'rss') include_once(scripts/feeds.php); # RSS 2.0
Should be...
# if ($action == 'rss') include_once(scripts/feeds.php); # RSS 2.0
Ill try and include a patch for this. The contents of the patch would be Attach: PmWIki_PITS_01055_patch.txt
While additional wikis in a wiki farm will need the $FarmD
variable, most new admins will likely start with a single wiki which doesn't need the $FarmD
variable. An advanced admin may try to install a farm after reading and learning a little bit. So, in order to keep things simple for new admins with their first wiki, sample-config.php intentionally omits the $FarmD
variable (less information overload). And advanced admins already know how to use the $FarmD
variable. This was suggested before (and even changed in subversion), but Pm prefers it the current way (so it was reverted). --Petko October 17, 2012, at 04:01 PM