BUG15479 Error during workspace restore
Error during the workspaces restore
This commit is contained in:
@@ -174,7 +174,6 @@ class workspaceTools
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (array_search($key, array('DB_HOST', 'DB_RBAC_HOST', 'DB_REPORT_HOST')) !== false) {
|
||||
/* Change the database hostname for these keys */
|
||||
$value = $this->newHost;
|
||||
@@ -214,14 +213,23 @@ class workspaceTools
|
||||
$this->newHost = $newHost;
|
||||
$this->resetDBNames = $resetDBNames;
|
||||
$this->resetDBDiff = array();
|
||||
$this->onedb = false;
|
||||
|
||||
if (!$this->workspaceExists()) {
|
||||
throw new Exception("Could not find db.php in the workspace");
|
||||
}
|
||||
$sDbFile = file_get_contents($this->dbPath);
|
||||
|
||||
if ($sDbFile === false) {
|
||||
throw new Exception("Could not read database information from db.php");
|
||||
} else {
|
||||
if (strpos($sDbFile, 'rb_')) {
|
||||
$this->onedb = false;
|
||||
} else {
|
||||
$this->onedb = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Match all defines in the config file. Check updateDBCallback to know what
|
||||
* keys are changed and what groups are matched.
|
||||
* This regular expression will match any "define ('<key>', '<value>');"
|
||||
@@ -481,20 +489,22 @@ class workspaceTools
|
||||
$appCache->setPathToAppCacheFiles(PATH_METHODS . 'setup' . PATH_SEP . 'setupSchemas' . PATH_SEP);
|
||||
|
||||
$userGrants = $appCache->checkGrantsForUser(false);
|
||||
|
||||
$currentUser = $userGrants['user'];
|
||||
$currentUserIsSuper = $userGrants['super'];
|
||||
//if user does not have the SUPER privilege we need to use the root user and grant the SUPER priv. to normal user.
|
||||
|
||||
if (!$currentUserIsSuper) {
|
||||
$appCache->checkGrantsForUser(true);
|
||||
$appCache->setSuperForUser($currentUser);
|
||||
$currentUserIsSuper = true;
|
||||
}
|
||||
|
||||
CLI::logging("-> Creating table\n");
|
||||
CLI::logging("-> Creating tables \n");
|
||||
//now check if table APPCACHEVIEW exists, and it have correct number of fields, etc.
|
||||
$res = $appCache->checkAppCacheView();
|
||||
|
||||
CLI::logging("-> Update DEL_LAST_INDEX field in APP_DELEGATION table\n");
|
||||
CLI::logging("-> Update DEL_LAST_INDEX field in APP_DELEGATION table \n");
|
||||
//Update APP_DELEGATION.DEL_LAST_INDEX data
|
||||
$res = $appCache->updateAppDelegationDelLastIndex($lang, $checkOnly);
|
||||
|
||||
@@ -820,7 +830,7 @@ class workspaceTools
|
||||
$sql = '';
|
||||
switch ($data['action']) {
|
||||
case 1:
|
||||
$sql = $dataBase->generateInsertSQL($data['table'], $data['data']);
|
||||
$sql = $dataoneBase->generateInsertSQL($data['table'], $data['data']);
|
||||
$message = "-> Row added in {$data['table']}\n";
|
||||
break;
|
||||
case 2:
|
||||
@@ -1350,7 +1360,9 @@ class workspaceTools
|
||||
CLI::logging("> Restoring " . CLI::info($backupWorkspace) . " to " . CLI::info($workspaceName) . "\n");
|
||||
}
|
||||
$workspace = new workspaceTools($workspaceName);
|
||||
|
||||
if ($workspace->workspaceExists()) {
|
||||
|
||||
if ($overwrite) {
|
||||
CLI::logging(CLI::warning("> Workspace $workspaceName already exist, overwriting!") . "\n");
|
||||
} else {
|
||||
@@ -1420,7 +1432,6 @@ class workspaceTools
|
||||
$final = $stop - $start;
|
||||
CLI::logging("<*> Updating cache view Process took $final seconds.\n");
|
||||
|
||||
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user