English Français Deutsch

inc/backup.php

Provides the functions for the special pages Special:Backup and Special::Snapshot. The reason to create them as functions is that you can call them using the API for your cron-job.

Snapshot is the backup of the sofawiki code, eg. index.php, api.php and the inc folder. The restore for Snapshot is update
Backup is the backup of the site code and data. There is no restore function for backup yet.

Functions

swBackup($sitebackup, $logbackup, $revisionbackup, $filebackup)

Saves files from the site folder to the bak folder. It saves only the original files and not the index files, because the latter can be reconstructed. As there are many files, zip files are created in batches.

The parameters works as flags.

sitebackup: site.zip and siteYYYYMMDD.zip save the folder structure and the files with the code: configuration.php, the functions and the skin folder.

logbackup: the log files are saved by month as logs-YY-mm.zip

revisionbackup: the revisions are saved by thousands as revisions-N000.zip

filebackup: the files are saved by revisions in hundreds as files-N00.zip.

The files in cache, current, indexes, queries and bloom are not saved and upload is supposed to be a folder for temporary files.

The goal is to have ftp-downloadable zip files. There is no restore special page yet. You would have to combine the extractions manually actually.

swSnapShot($username)

Saves the current code in the inc folder and the index.php and the api.php file as zip file. There is a snapshot.zip, a versioned snapshotVERSION.zip and a timed snapshotYYYYmmdd.zip. The snapshots are saved to the site/files folder and image pages are created for them. One snapshot is also saved to the bak folder.

Snapshots use the zip.php code. Something prevents MacOS to open them directly in the finder. However, you can decompress it using the unzip command in the Terminal.

The username is used to create the Image pages for the snapshots.

File structure inc folder inc/special folder