Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dokuwiki:server [2024/06/02 21:04] – [Customization] Bernard Condraudokuwiki:server [2026/09/07 17:17] (current) – [Move to new web server] Bernard Condrau
Line 37: Line 37:
   * Add "_blank" to "Target window for external links" and "Target window for media links" under //Links// in DokuWiki's //Configuration Settings//.   * Add "_blank" to "Target window for external links" and "Target window for media links" under //Links// in DokuWiki's //Configuration Settings//.
 ==== Customization ==== ==== Customization ====
-There are a few core hacks required to make my template work properly, both for a regular wiki as well as for a help server. <span orange>**Note: you need to verify below modifications after every DokuWiki upgrade.**</span>+There are a few core hacks required to make my template work properly, both for a regular wiki as well as for a help server. Additionally, there is a bug fix required to display table of contents if you utilize the plugin:condition and plugin:toctweak.\\ <span orange>**Note: you need to verify below modifications after every DokuWiki upgrade.**</span>
 === Concept === === Concept ===
   * The dispatcher calls files ''doku.php'' and ''help.php'' in the template directory instead of ''main.php'' (function ''bethico_dispatch'')   * The dispatcher calls files ''doku.php'' and ''help.php'' in the template directory instead of ''main.php'' (function ''bethico_dispatch'')
   * Language detection and fallback added to ''doku.php'' in the root directory which then dispatches ''doku.php'' in the template directory   * Language detection and fallback added to ''doku.php'' in the root directory which then dispatches ''doku.php'' in the template directory
   * Language detection and fallback added to ''help.php'' (copy of ''doku.php'') in the root directory which then dispatches ''help.php'' in the template directory   * Language detection and fallback added to ''help.php'' (copy of ''doku.php'') in the root directory which then dispatches ''help.php'' in the template directory
-=== Install === + 
-  - Install my {{ :dokuwiki:tpl_bethico.zip |Bethico Template}} into ''/lib/tpl/''. Current version is 2022-10-09 suitable for DokuWiki "Igor".+=== Core hacks === 
 +  - Install my {{ :dokuwiki:tpl_bethico.zip |Bethico Template}} into ''/lib/tpl/''. Current version is v55.1 / 2024-06-09 suitable for DokuWiki "Kaos".
   - Add the following lines in ''doku.php'' in DokuWiki's root after line ''$ID = getID();'' at the beginning...<file>require_once(template('dispatcher.php'));   - Add the following lines in ''doku.php'' in DokuWiki's root after line ''$ID = getID();'' at the beginning...<file>require_once(template('dispatcher.php'));
 $langcode = bethico_language(); $langcode = bethico_language();
Line 49: Line 50:
   - ...and replace at the end line ''act_dispatch();'' with<file>init_lang($langcode);   - ...and replace at the end line ''act_dispatch();'' with<file>init_lang($langcode);
 bethico_dispatch(basename(__FILE__));</file> bethico_dispatch(basename(__FILE__));</file>
-  - Copy ''doku.php'' to ''help.php'' in the DokuWiki root folder +  - Add a line to file ''/lib/scripts/page.js'' in function ''makeToggle'' to allow the template to set the table of contents to //open// or //closed//<file>$handle[0].setState = function(state){ 
-  - Modify ''/inc/template.php'' and add before line ''Event::createAndTrigger('TPL_TOC_RENDER', $toc, null, false);'' in function ''tpl_toc''. This is a non-destructive change which fixes an issue in the table of contents if plugin ''condition'' is installed in the wiki<file>if (@include_once(template('dispatcher.php'))) bethico_update_toc($toc$TOC);</file> +            var hidden; 
-  - Copies of the modified files for "Igor" are in folder ''/lib/tpl/bethico/core/'', copy them with<file>cp -R /lib/tpl/bethico/core/* /</file>+        --> if(!state && JSINFO.toc) state = JSINFO.toc.initial_state; 
 +            if(!state) state = 1;</file> 
 + 
 +=== Fix toc handling in core === 
 +  - Modify ''/inc/template.php'' in function ''tpl_toc'' add before line ''Event::createAndTrigger('TPL_TOC_RENDER', $toc, null, false);'':<file>if (@include_once(template('dispatcher.php'))) bethico_update_toc($toc, $TOC);</file>This is a non-destructive change which fixes an issue in the table of contents if plugin:condition is installed
 + 
 +=== Fix toc handling in plugin:toctweak === 
 +  - Make elements of items array unique at the end of function ''_toc'' in file ''lib/plugins/toctweak/helper.php''<file>$items = array_unique($itemsSORT_REGULAR);</file> 
 + 
 +=== Install === 
 +  - Copies of the modified files for "Kaos" are in folder ''/lib/tpl/bethico/core/v551/'', copy them with<file>cp -R /lib/tpl/bethico/core/v551/* /</file>then check file permissions
   - After a DokuWiki upgrade check and change if necessary   - After a DokuWiki upgrade check and change if necessary
     - Check ''/inc/actions.php'' and change ''/lib/tpl/bethico/dispatcher.php''     - Check ''/inc/actions.php'' and change ''/lib/tpl/bethico/dispatcher.php''
Line 61: Line 72:
  
  
 +===== Move Wiki to new web server =====
 +  - Log in to your old server via SSH.
 +  - Clear out everything inside your ''data/cache/*'' folder to save space and avoid corrupt cache issues on the new host.
 +  - Pack the entire DokuWiki installation directory into a .tgz archive:<file>tar -czvf dokuwiki-backup.tgz -C /path/to/dokuwiki .</file>
 +  - Transfer the archive to your new server, then extract the archive into your new web server document root directory:<file>tar -xzvf dokuwiki-backup.tgz -C /path/to/new/webroot</file>
 +  - Make sure your new server runs a compatible or identical version of PHP as your old server. Check and update your ''.htaccess'' file if you use URL rewriting or custom paths on the new domain.
 +  - Set the correct owner and permissions so your web server user (like www-data or nginx) can write to the wiki.Ensure the data/ and conf/ directories (and their contents) are fully writable by the web server:bashsudo chown -R www-data:www-data /path/to/new/webroot
 +sudo chmod -R 775 /path/to/new/webroot/data /path/to/new/webroot/conf
 +Use code with caution. [1] (https://forum.dokuwiki.org/d/8687-move-to-another-server), [2] (https://forum.dokuwiki.org/d/6797-moving-my-dokuwiki-to-an-external-website)5. Test Your InstallationPoint your browser to your new domain or temporary URL to verify that pages, media files, and plugins load correctly.If old or incompatible plugins break the interface, reinstall or update them via the DokuWiki plugin manager. [1] (https://forum.dokuwiki.org/d/20489-migrating-old-wiki-to-new-wiki-and-server), [2] (https://yyhh.org/blog/2018/10/migrate-dokuwiki-to-another-server/), [3] (https://www.dokuwiki.org/faq:backup)
 ===== Joomla Access ===== ===== Joomla Access =====
   * Set the Help URL in the component configuration of com_bethico to<code>'https://your.wiki.server/help.php?id={langcode}:{keyref}'</code>   * Set the Help URL in the component configuration of com_bethico to<code>'https://your.wiki.server/help.php?id={langcode}:{keyref}'</code>