PM-401 Backup workspace modified
Backup database modified
This commit is contained in:
@@ -381,16 +381,22 @@ function run_workspace_backup($args, $opts) {
|
||||
} else if (sizeof($args) > 0) {
|
||||
$workspace = new workspaceTools($args[0]);
|
||||
$workspaces[] = $workspace;
|
||||
if (sizeof($args) == 2)
|
||||
if (sizeof($args) == 2) {
|
||||
$filename = $args[1];
|
||||
else
|
||||
} else {
|
||||
$filename = "{$workspace->name}.tar";
|
||||
}
|
||||
} else {
|
||||
throw new Exception("No workspace specified for backup");
|
||||
}
|
||||
foreach ($workspaces as $workspace)
|
||||
if (!$workspace->workspaceExists())
|
||||
|
||||
|
||||
foreach ($workspaces as $workspace) {
|
||||
if (!$workspace->workspaceExists()) {
|
||||
throw new Exception("Workspace '{$workspace->name}' not found");
|
||||
}
|
||||
}
|
||||
|
||||
//If this is a relative path, put the file in the backups directory
|
||||
if (strpos($filename, "/") === false && strpos($filename, '\\') === false){
|
||||
$filename = PATH_DATA . "backups/$filename";
|
||||
@@ -398,34 +404,32 @@ function run_workspace_backup($args, $opts) {
|
||||
CLI::logging("Backing up to $filename\n");
|
||||
|
||||
$filesize = array_key_exists("filesize", $opts) ? $opts['filesize'] : -1;
|
||||
if($filesize >= 0)
|
||||
{
|
||||
if(!Bootstrap::isLinuxOs()){
|
||||
|
||||
if ($filesize >= 0) {
|
||||
if (!Bootstrap::isLinuxOs()) {
|
||||
CLI::error("This is not a Linux enviroment, cannot use this filesize [-s] feature.\n");
|
||||
return;
|
||||
}
|
||||
$multipleBackup = new multipleFilesBackup ($filename,$filesize);//if filesize is 0 the default size will be took
|
||||
//using new method
|
||||
foreach ($workspaces as $workspace){
|
||||
foreach ($workspaces as $workspace) {
|
||||
$multipleBackup->addToBackup($workspace);
|
||||
}
|
||||
$multipleBackup->letsBackup();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//ansient method to backup into one large file
|
||||
$backup = workspaceTools::createBackup($filename);
|
||||
|
||||
foreach ($workspaces as $workspace)
|
||||
foreach ($workspaces as $workspace) {
|
||||
$workspace->backup($backup);
|
||||
}
|
||||
}
|
||||
CLI::logging("\n");
|
||||
workspaceTools::printSysInfo();
|
||||
foreach ($workspaces as $workspace) {
|
||||
CLI::logging("\n");
|
||||
$workspace->printMetadata(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function run_workspace_restore($args, $opts) {
|
||||
|
||||
@@ -1032,10 +1032,14 @@ class workspaceTools
|
||||
|
||||
$wfDsn = $fields['DB_ADAPTER'] . '://' . $fields['DB_USER'] . ':' . $fields['DB_PASS'] . '@' . $fields['DB_HOST'] . '/' . $fields['DB_NAME'];
|
||||
|
||||
if ($fields['DB_NAME'] == $fields['DB_RBAC_NAME']) {
|
||||
$info = array('Workspace Name' => $fields['WORKSPACE_NAME'], 'Workflow Database' => sprintf("%s://%s:%s@%s/%s", $fields['DB_ADAPTER'], $fields['DB_USER'], $fields['DB_PASS'], $fields['DB_HOST'], $fields['DB_NAME']), 'MySql Version' => $fields['DATABASE']);
|
||||
} else {
|
||||
$info = array('Workspace Name' => $fields['WORKSPACE_NAME'],
|
||||
//'Available Databases' => $fields['AVAILABLE_DB'],
|
||||
'Workflow Database' => sprintf("%s://%s:%s@%s/%s", $fields['DB_ADAPTER'], $fields['DB_USER'], $fields['DB_PASS'], $fields['DB_HOST'], $fields['DB_NAME']), 'RBAC Database' => sprintf("%s://%s:%s@%s/%s", $fields['DB_ADAPTER'], $fields['DB_RBAC_USER'], $fields['DB_RBAC_PASS'], $fields['DB_RBAC_HOST'], $fields['DB_RBAC_NAME']), 'Report Database' => sprintf("%s://%s:%s@%s/%s", $fields['DB_ADAPTER'], $fields['DB_REPORT_USER'], $fields['DB_REPORT_PASS'], $fields['DB_REPORT_HOST'], $fields['DB_REPORT_NAME']), 'MySql Version' => $fields['DATABASE']
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($info as $k => $v) {
|
||||
if (is_numeric($k)) {
|
||||
@@ -1073,11 +1077,14 @@ class workspaceTools
|
||||
|
||||
if ($onedb) {
|
||||
$databases = array("rb", "rp");
|
||||
} else if ($dbInfo['DB_NAME'] == $dbInfo['DB_RBAC_NAME']) {
|
||||
$databases = array("wf");
|
||||
} else {
|
||||
$databases = array("wf", "rp", "rb");
|
||||
}
|
||||
|
||||
$dbNames = array();
|
||||
|
||||
foreach ($databases as $db) {
|
||||
$dbInfo = $this->getDBCredentials($db);
|
||||
$oDbMaintainer = new DataBaseMaintenance($dbInfo["host"], $dbInfo["user"], $dbInfo["pass"]);
|
||||
|
||||
Reference in New Issue
Block a user