diff --git a/storage/Mysql.php b/storage/Mysql.php index a390cce..0087eb8 100755 --- a/storage/Mysql.php +++ b/storage/Mysql.php @@ -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', @@ -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') ); @@ -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) @@ -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']) { diff --git a/storage/Mysql/Backup.php b/storage/Mysql/Backup.php index 4b33479..b6e0bbd 100644 --- a/storage/Mysql/Backup.php +++ b/storage/Mysql/Backup.php @@ -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 */ @@ -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'; @@ -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");