Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Latest commit

 

History

History
122 lines (95 loc) · 3.48 KB

readme.md

File metadata and controls

122 lines (95 loc) · 3.48 KB

Warning! This package is not maintained any more

Try this alternative instead: https://github.com/dimsav/backupish

Documentation

This is a library, written in php, used to backup your project's files and databases.

Installation

  1. Clone the repository
  2. Install the composer dependencies: composer install
  3. Create a file config/config.php according config/config.ini.php

Execution

Run php backup.php

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

  1. This script can only be used in Unix systems (Linux/Mac), as we are using the zip command of the system.
  2. The function exec() should be available as we use it to zip our backups.
  3. The user executing the script must be able to write in the backups folder.
  4. The cURL extension is required if you want to use the dropbox uploader.

Instructions

  1. Copy config.ini.php to config.php.
  2. Edit config.php to define your projects to be backed up.
  3. Run cron.php using the command line or a web server.
  4. See the magic happen!

Defining your projects is a piece of cake:

    /*
     * 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,
        )

    ),