Skip to content

Commit

Permalink
fix autoloading
Browse files Browse the repository at this point in the history
add no-data parameter to mysql storage driver
  • Loading branch information
k2s committed Nov 24, 2015
1 parent 2635f84 commit ae7aaf9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
11 changes: 9 additions & 2 deletions storage/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ static public function getConfigOptions($part = null)
'rotate' => array('days' => 0, 'weeks' => 0, 'months' => 0),
'filter-ext' => false,
'with-passwords' => false,
'server-location' => 'auto'
'server-location' => 'auto',
'no-data' => false,
),
CfgPart::DESCRIPTIONS => array(
'host' => 'mysql server host name',
Expand All @@ -85,7 +86,8 @@ static public function getConfigOptions($part = null)
'rotate.months' => 'for how many months should backups be kept',
'filter-ext' => "specify external filter application like 'php -f filter.php -- '",
'with-passwords' => 'if true hash of user passwords will be stored',
'server-location' => 'if server is able to access backup folder (auto=try to detect,local=server able to write to backup folder,remote=slower as local)'
'server-location' => 'if server is able to access backup folder (auto=try to detect,local=server able to write to backup folder,remote=slower as local)',
'no-data' => 'if used data from tables will not be included in backup',
),
CfgPart::REQUIRED => array('dbname')
);
Expand Down Expand Up @@ -249,6 +251,10 @@ public function init($myrole, $drivers)
if (!array_key_exists('server-location', $dbConfig)) {
$dbConfig['server-location'] = $this->_options['server-location'];
}
if (!array_key_exists('no-data', $dbConfig)) {
$dbConfig['no-data'] = $this->_options['no-data'];
}

}

// backup database(s)
Expand All @@ -262,6 +268,7 @@ public function init($myrole, $drivers)
$this->_driver->setFilterExt($dbConfig['filter-ext']);
$this->_driver->setWithPasswords($dbConfig['with-passwords']);
$this->_driver->setServerLocation($dbConfig['server-location']);
$this->_driver->setNoData($dbConfig['no-data']);

$createForced = false;
if ($dbConfig['addtobasedir']) {
Expand Down
15 changes: 14 additions & 1 deletion storage/Mysql/Backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ class Storage_Mysql_Backup implements Storage_Mysql_IBackup
*/
protected $_serverLocation = 'auto';

/**
* Exclude table data from export
* @var bool
*/
protected $_noData = false;

/**
* @var Output_Interface
*/
Expand Down Expand Up @@ -106,6 +112,10 @@ function setServerLocation($serverLocation)
$this->_serverLocation = $serverLocation;
}

function setNoData($nodata) {
$this->_noData = $nodata;
}

function addRestoreScript($folder)
{
$src = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cliRestore.php';
Expand Down Expand Up @@ -553,7 +563,10 @@ protected function _removeSecurity(/** @noinspection PhpUnusedParameterInspectio

protected function _backupData($store)
{
// TODO detect if server is localhost and if it is possible to use faster local backup command
if (true) {
return;
}

switch ($this->_serverLocation) {
case 'local':
$this->_out->logNotice("doing 'local' data backup");
Expand Down

0 comments on commit ae7aaf9

Please sign in to comment.