00708: Missing $FarmPubD variable leads to "Unable to find skin" error.
Description:
You cannot re-define the filesystem location of a farm's pub/ directory when you redefine its URL ($FarmPubDirUrl
). The farm's pub/ directory appears to be hard-wired to the base installation location, which confounds installing PmWiki outside the web document tree. If you do so, the following error results:
Here's a patch that adds the capability to set a $FarmPubD in the farm's local/farmconfig.php:
*** skins-old.php 2006-03-20 15:38:19.000000000 -0700 --- skins-new.php 2006-03-20 15:35:48.000000000 -0700 *************** *** 40,52 **** # the $skin array. function SetSkin($pagename, $skin) { global $Skin, $SkinDir, $SkinDirUrl, $IsTemplateLoaded, $PubDirUrl, ! $FarmPubDirUrl, $FarmD; unset($Skin); foreach((array)$skin as $s) { $sd = FmtPageName("./pub/skins/$s", $pagename); if (is_dir($sd)) { $Skin=$s; $SkinDirUrl="$PubDirUrl/skins/$Skin"; break; } ! $sd = FmtPageName("$FarmD/pub/skins/$s", $pagename); if (is_dir($sd)) { $Skin=$s; $SkinDirUrl="$FarmPubDirUrl/skins/$Skin"; break; } } --- 40,53 ---- # the $skin array. function SetSkin($pagename, $skin) { global $Skin, $SkinDir, $SkinDirUrl, $IsTemplateLoaded, $PubDirUrl, ! $FarmPubDirUrl, $FarmD, $FarmPubD; unset($Skin); + SDV($FarmPubD, "$FarmD/pub"); foreach((array)$skin as $s) { $sd = FmtPageName("./pub/skins/$s", $pagename); if (is_dir($sd)) { $Skin=$s; $SkinDirUrl="$PubDirUrl/skins/$Skin"; break; } ! $sd = FmtPageName("$FarmPubD/skins/$s", $pagename); if (is_dir($sd)) { $Skin=$s; $SkinDirUrl="$FarmPubDirUrl/skins/$Skin"; break; } }
I chose to go about this in a different way, by introducing a $SkinLibDirs
array that identifies all of the skin locations and their corresponding urls. This makes it possible to completely control the search space for skins.
Thus, there's not a $FarmPubD variable built-in, but one can use one in order to make things work. For example, supposing that the farm's pub directory location is indeed in $FarmPubD, then a config file may set:
$SkinLibDirs
= array( './pub/skins/$Skin
' => '$PubDirUrl
/skins/$Skin
', '$FarmPubD/skins/$Skin
' => '$FarmPubDirUrl
/skins/$Skin
');
which says to look in the local pub/skins/ directory followed by the $FarmPubD/skins/$Skin
directory.
Of course, this can also be used to tell the skin code to only look in a farm directory, or to extend the number of places to look for skins.
Thanks!
Pm