User Tools

Site Tools


dokuwiki:upgrade_dokuwiki

DokuWiki - Upgrade DokuWiki

Make a backup of your DokuWiki

tar zcpfv dokuwiki-backup.tar.gz /path/to/dokuwiki

NOTE: This will create the dokuwiki-backup.tar.gz backup.

Alternatively, create a copy of the DokuWiki directory:

cd /var/www
cp -R dokuwiki dokuwiki-20250429

Check for changes

Read the changelog to see if there are any special things to consider


Download the new version

Download the newest release from the download site.

cd ~
wget http://.../dokuwiki-xxxx-xx-xx.tgz

NOTE: The latest stable version can usually be downloaded.

cd ~
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz

Sometimes the stable version may be corrupt and does not extract okay.

  • In this case try to download a specified version.
  • And then get the actual version needed:
    wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-2024-02-06b.tgz

Unpack the distribution tarball

tar zxvf dokuwiki-xxxx-xx-xx.tgz

Upload/copy the files over your previous installation

Make sure to overwrite all files when prompted.

'cp' -af dokuwiki-xxxx-xx-xx/* /path/to/dokuwiki/

NOTE: The quotes on cp assure that it will run as is, even if an alias is set.


Set permissions for the updated files

cd /var/www
chown -R www-data:www-data dokuwiki

Re-enable security settings for Dokuwiki

Change directory to the Dokuwiki config directory.

cd /var/www/dokuwiki/conf

Edit the Dokuwiki config file, and set the useacl option to a 1.

/var/www/dokuwiki/conf/dokuwiki.php
...
 
/* Authentication Settings */
$conf['useacl']      = 1;                //Use Access Control Lists to restrict access?
 
...

Restart NginX

systemctl restart nginx.service

Check copied files ownership and permissions

<?php
 
if(function_exists('posix_geteuid')){
  // use posix to get current uid and gid
  $uid   = posix_geteuid();
  $usr   = posix_getpwuid($uid);
  $user  = $usr['name'];
  $gid   = posix_getegid();
  $grp   = posix_getgrgid($gid);
  $group = $grp['name'];
}else{
  // try to create a file and read it's ids
  $tmp = tempnam ('/tmp', 'check');
  $uid = fileowner($tmp);
  $gid = filegroup($tmp);
 
  // try to run ls on it
  $out = `ls -l $tmp`;
  $lst = explode(' ',$out);
  $user  = $lst[2];
  $group = $lst[3];
  unlink($tmp);
}
 
echo "Your PHP process seems to run with the UID $uid ($user) and the GID $gid ($group)\n"; ?>

Here are the most commonly used values for setting permissions on directories and files.

directoriesfilesresult
07000600read/write for owner only. Owner must be the same as the PHP process user.
07700660read/write for owner and group. The PHP process user needs to be in the user group
07770666read/write for everyone. Dangerous because everybody with access to the server may write and delete your files. Use only as a last resort on trusted machines, NOT on a cheap shared hosting server.

Delete all unused files

grep -Ev '^($|#)' data/deleted.files | xargs -n 1 rm -vf

Upgrade your template and plugins

Upgrade your template and plugins if necessary.


References

dokuwiki/upgrade_dokuwiki.txt · Last modified: 2025/04/29 13:19 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki