Reintruduced old templatepath option

For backward compatibility: if the old template is found, it will be
used as a source
This commit is contained in:
Simon DELAGE 2014-09-03 03:29:33 +02:00
parent a8b8f56a76
commit 8bb4f0838a
4 changed files with 10 additions and 1 deletions

View file

@ -20,7 +20,13 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
}
function templates(&$event, $param) {
if (!file_exists(DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt')) {
if (!copy(DOKU_INC.'lib/plugins/userhomepage/userhomepage_private.default', DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt')) {
if (file_exists(DOKU_INC.$this->getConf('templatepath'))) {
if (!copy(DOKU_INC.$this->getConf('templatepath'), DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt')) {
// echo ' An error occured while attempting to copy old template to '.DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt';
// } else {
// echo ' Successfully copied private template.';
}
} elseif (!copy(DOKU_INC.'lib/plugins/userhomepage/userhomepage_private.default', DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt')) {
// echo ' An error occured while attempting to copy userhomepage_private.default to '.DOKU_INC.$this->getConf('templates_path').'/userhomepage_private.txt';
// } else {
// echo ' Successfully copied private template.';

View file

@ -17,3 +17,4 @@ $conf['edit_before_create'] = 0;
$conf['create_public_page'] = 0;
$conf['public_pages_ns'] = 'user';
$conf['templates_path'] = 'data/pages/wiki';
$conf['templatepath'] = 'lib/plugins/userhomepage/_template.txt';

View file

@ -17,3 +17,4 @@ $meta['edit_before_create'] = array('onoff');
$meta['create_public_page'] = array('onoff');
$meta['public_pages_ns'] = array('string','_pattern' => '/^(|[a-zA-Z\-:]+)$/','_caution' => 'warning');
$meta['templates_path'] = array('string');
$meta['templatepath'] = array('string');

View file

@ -23,3 +23,4 @@ $lang['edit_before_create'] = 'Allow users to edit their namespace start page be
$lang['create_public_page'] = 'Create a public page for user';
$lang['public_pages_ns'] = 'Namespace under wich public pages are created. If a value other than <code>user</code> is used, you will have to manually handle interwiki user link used by <code>showuseras</code> option (in Display settings).';
$lang['templates_path'] = 'Path from DokuWiki root to store templates (userhomepage_private.txt and userhomepage_public.txt). Examples: <code>data/pages/wiki</code> (wich will make templates editable within DokuWiki) or <code>lib/plugins/userhomepage</code> (usefull in a farm setup to centralize templates).';
$lang['templatepath'] = 'Template path from version 3.0.4. Don\'t change it, it is only there for backward compatibility. If this file exists, it will be used as default for new private namespace start page template.';