Changed process to use old template again
Previous process was to rename files but it is better to leave all files as they are and choose wich source to use
This commit is contained in:
parent
b00823906a
commit
b0865ce8d2
15
action.php
15
action.php
|
@ -24,7 +24,7 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
|
|||
global $conf;
|
||||
global $INFO;
|
||||
global $uhpreplace;
|
||||
// CREATE LOCAL REPLACEMENT FILE IF IT DOESN'T EXIST YET
|
||||
// CREATE AND LOAD LOCAL REPLACEMENT FILE IF IT DOESN'T EXIST YET
|
||||
if (!file_exists(DOKU_INC.'conf/userhomepage_replace.php')) {
|
||||
$content = io_readFile(DOKU_INC.'lib/plugins/userhomepage/userhomepage_replace.default', false);
|
||||
$content = str_replace('privatenamespace',$this->getLang('privatenamespace'),$content);
|
||||
|
@ -32,14 +32,15 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
|
|||
file_put_contents(DOKU_INC.'conf/userhomepage_replace.php', $content);
|
||||
}
|
||||
if (file_exists(DOKU_INC.'conf/userhomepage_replace.php')) { require_once(DOKU_INC.'conf/userhomepage_replace.php'); }
|
||||
// IF OLD TEMPLATE EXISTS, RENAME userhomepage_private.default to .original and rename old template to userhomepage_private.default
|
||||
if (file_exists(DOKU_INC.$this->getConf('templatepath'))) {
|
||||
rename(DOKU_INC.'lib/plugins/userhomepage/userhomepage_private.default', DOKU_INC.'lib/plugins/userhomepage/userhomepage_private.original');
|
||||
rename(DOKU_INC.$this->getConf('templatepath'), DOKU_INC.'lib/plugins/userhomepage/userhomepage_private.default');
|
||||
}
|
||||
// CREATE PRIVATE NAMESPACE START PAGE TEMPLATES IF NEEDED
|
||||
if (($this->getConf('create_private_ns')) && (!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 old template exists, use it as source to create userhomepage_private.txt in templates_path
|
||||
if (file_exists(DOKU_INC.$this->getConf('templatepath'))) {
|
||||
$source_private = DOKU_INC.$this->getConf('templatepath');
|
||||
} else {
|
||||
$source_private = DOKU_INC.'lib/plugins/userhomepage/userhomepage_private.default';
|
||||
}
|
||||
if (!copy($source_private, 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.';
|
||||
|
|
Loading…
Reference in a new issue