2017 © Pedro Peláez
 

library database-backup

image

clevis/database-backup

  • Saturday, November 7, 2015
  • by JanTvrdik
  • Repository
  • 6 Watchers
  • 2 Stars
  • 104 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

DatabaseBackup Tool

Tiny wrapper around Clevis/MySQLDump library which can limit the maximum number of kept backups. The kept backups are efficiently distributed over the whole period of time this tool is being used. The older the backups are the larger time gap is kept between them., (*1)

Visualisation of backups distribution in time, (*2)

Backups distribution in time, (*3)

Installation

The recommended way to install this library is to use Composer., (*4)

composer require clevis/database-backup

Basic Usage

$mysqli = new mysqli('localhost', 'root', 'password', 'database');
$dumper = new MySQLDump($mysqli);

// store backups to directory './backups' and keep at most 100 backups
$backup = new Clevis\DatabaseBackup\DatabaseBackup($dumper, __DIR__ . '/backups', 100);
$backup->backupDatabase();

If you use dibi, then you can get the $mysqli object this way:, (*5)

$mysqli = $dibiConnection->getDriver()->getResource();

Advanced Usage

You can customize the created dumps by configuring the $dumper instance., (*6)

  1. Do not dump table foo:, (*7)

    $dumper->tables['foo'] = $dumper::NONE;
    
  2. Dump only structure, but not data of table foo:, (*8)

    // CREATE TABLE `foo` (...)
    $dumper->tables['foo'] = $dumper::CREATE;
    
    // DROP TABLE `foo` IF EXISTS + CREATE TABLE `foo` (...)
    $dumper->tables['foo'] = $dumper::CREATE | $dumper::DROP;
    
  3. Dump only some rows in table foo:, (*9)

    $dumper->setCustomDataSelect('foo', 'SELECT * FROM `foo` WHERE `bar` = 1');
    
  4. Do not lock tables while dumping tables:, (*10)

    $dumper->setUseLock(FALSE);
    
  5. For more examples see documentation of Clevis/MySQLDump library., (*11)

The Versions

07/11 2015

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

mysql backup

03/02 2014

v1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

mysql backup

26/11 2013

v1.0.0-beta1

1.0.0.0-beta1

  Sources   Download

MIT

The Requires

 

The Development Requires

mysql backup