Warning! This package is not maintained any more
Documentation
This is a library, written in php, used to backup your project's files and databases., (*1)
Installation
- Clone the repository
- Install the composer dependencies:
composer install
- Create a file config/config.php according config/config.ini.php
Execution
Run php backup.php
, (*2)
Features
- Multiple projects can be backed up at once
- Custom selection of backup directories per project
- Custom selection of excluded paths
- Password protection of backup files (.zip)
- Detailed logs are saved to the server and are uploaded to dropbox.
Requirements
- This script can only be used in Unix systems (Linux/Mac), as we are using the zip command of the system.
- The function exec() should be available as we use it to zip our backups.
- The user executing the script must be able to write in the backups folder.
- The cURL extension is required if you want to use the dropbox uploader.
Instructions
- Copy config.ini.php to config.php.
- Edit config.php to define your projects to be backed up.
- Run cron.php using the command line or a web server.
- See the magic happen!
Defining your projects is a piece of cake:, (*3)
/*
* Define in this array the projects you wish to backup.
*
* The key of the array marks the name of the project
* and it is used for folder and file names. So better
* use alphanumeric characters with slash/underscores.
*/
"projects" => array(
/*
* Here we define a project to be backed-up.
* For this project, we want to backup only
* the database. We use the default host and
* port, and we override the username and password.
*
* For this project we are overriding the default
* password with another one.
*/
"project-1" => array(
"database" => array(
"name" =>"db-name",
"username"=>"db-user",
"password"=>"db-pass",
),
"password" => "another-secret",
),
/*
* For this project we backup both some files
* and the database.
*
* We use the default database settings, so we
* define only the database name.
*
* Under "paths" we put a list of absolute paths
* of directories or files.
*
* Under "excludes" we put a list of absolute paths
* of directories or files that should not be
* included in the compressed backup files. The
* contents of these directories will be skipped
* recursively.
*/
"project-2" => array(
"database" => array(
"name"=>"db-name",
),
"paths" => array(
"/absolute/project/folder/path",
"/absolute/project/file/text.txt",
),
"excludes" => array(
"/absolute/project/folder/path/cache",
"/absolute/project/folder/path/logs",
"/absolute/project/folder/path/bigfile.tar",
),
),
/*
* Here we disable for project-3 the default password,
* as we don't want any password for this project.
*/
"project-3" => array(
"paths" => array(
"/project/folder",
),
"password" => null,
)
),