public function create($params) {
$misc = $this->getModule('misc');
+ $jobid = property_exists($params, 'id') && $misc->isValidInteger($params->id) ? intval($params->id) : null;
$client = null;
if (property_exists($params, 'clientid')) {
$clientid = intval($params->clientid);
$client = $params->client;
}
+ $fileset = null;
+ if (property_exists($params, 'filesetid')) {
+ $filesetid = intval($params->filesetid);
+ $fileset_row = $this->getModule('fileset')->getFileSetById($filesetid);
+ $fileset = is_object($fileset_row) ? $fileset_row->fileset : null;
+ } elseif (property_exists($params, 'fileset') && $misc->isValidName($params->fileset)) {
+ $fileset = $params->fileset;
+ }
+
$rfile = property_exists($params, 'rpath') ? $params->rpath : null;
- $priority = property_exists($params, 'priority') ? intval($params->priority) : 10; // default priority is set to 10
+ $full = property_exists($params, 'full') && $misc->isValidInteger($params->full) ? (bool)$params->full : null;
$where = property_exists($params, 'where') ? $params->where : null;
$replace = property_exists($params, 'replace') ? $params->replace : null;
return;
}
- if(preg_match($misc::RPATH_PATTERN, $rfile) !== 1) {
+ if(!is_null($rfile) && preg_match($misc::RPATH_PATTERN, $rfile) !== 1) {
$this->output = JobError::MSG_ERROR_INVALID_RPATH;
$this->error = JobError::ERROR_INVALID_RPATH;
return;
}
$command = array('restore',
- 'file="?' . $rfile . '"',
'client="' . $client . '"'
);
+ if (is_string($rfile)) {
+ // Restore using Bvfs
+ $command[] = 'file="?' . $rfile . '"';
+ } elseif ($full === true && is_int($jobid) && $jobid > 0 && is_string($fileset)) {
+ // Full restore all files
+ $command[] = 'jobid="' . $jobid . '"';
+ $command[] = 'fileset="' . $fileset . '"';
+ $command[] = 'select';
+ $command[] = 'all';
+ $command[] = 'done';
+ }
if (is_string($replace)) {
$command[] = 'replace="' . $replace . '"';
}
- if (is_int($priority)) {
- $command[] = 'priority="' . $priority . '"';
- }
if (is_string($restorejob)) {
$command[] = 'restorejob="' . $restorejob . '"';
}
{
"name": "create[id]",
"in": "body",
- "description": "Job identifier",
- "required": true,
+ "description": "Job identifier (for full restore)",
+ "required": false,
"schema": {
"type": "integer"
}
},
- {
- "name": "create[name]",
- "in": "body",
- "description": "Job name (can be used instead id)",
- "required": true,
- "schema": {
- "type": "string",
- "pattern": "[a-zA-Z0-9:.-_ ]+"
- }
- },
{
"name": "create[clientid]",
"in": "body",
"pattern": "[a-zA-Z0-9:.-_ ]+"
}
},
+ {
+ "name": "create[where]",
+ "in": "body",
+ "description": "Where to restore files",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
{
"name": "create[rpath]",
"in": "body",
"description": "Rpath (restore path)",
- "required": true,
+ "required": false,
"schema": {
"type": "string",
"pattern": "b2[0-9]+"
}
},
{
- "name": "create[where]",
+ "name": "create[full]",
"in": "body",
- "description": "Where to restore files",
- "required": true,
+ "description": "Full restore all files",
+ "required": false,
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "name": "create[filesetid]",
+ "in": "body",
+ "description": "FileSet identifier (for full restore)",
+ "required": false,
"schema": {
"type": "string"
}
},
{
- "name": "create[priority]",
+ "name": "create[fileset]",
"in": "body",
- "description": "Job priority",
+ "description": "FileSet (can be used instead of filesetid) (for full restore)",
"required": false,
"schema": {
- "type": "integer"
+ "type": "string"
}
},
{
msgid "Nginx on most UNIX platforms"
msgstr "Nginx on most UNIX platforms"
+
+msgid "No file found for selected backup. It can mean file records for this backup are pruned. Restoring selected files is not available but if you continue, there will be performed full restore all backup files."
+msgstr "No file found for selected backup. It can mean file records for this backup are pruned. Restoring selected files is not available but if you continue, there will be performed full restore all backup files."
msgid "Nginx on most UNIX platforms"
msgstr "Nginx on most UNIX platforms"
+
+msgid "No file found for selected backup. It can mean file records for this backup are pruned. Restoring selected files is not available but if you continue, there will be performed full restore all backup files."
+msgstr "No file found for selected backup. It can mean file records for this backup are pruned. Restoring selected files is not available but if you continue, there will be performed full restore all backup files."
msgid "Nginx on most UNIX platforms"
msgstr "Nginx na większości platform UNIXowych"
+msgid "No file found for selected backup. It can mean file records for this backup are pruned. Restoring selected files is not available but if you continue, there will be performed full restore all backup files."
+msgstr "Nie znaleziono żadnego pliku dla wybranej kopii zapasowej. Może to oznaczać, że rekordy plików dla tej kopii są wyczyszczone. Przywracanie wybranych plików nie jest dostępne, ale jeżeli kontynuujesz, to zostanie wykonane pełne przywrócenie wszystkich plików kopii zapasowej."
msgid "Nginx on most UNIX platforms"
msgstr "Nginx na maioria das plataformas UNIX"
+msgid "No file found for selected backup. It can mean file records for this backup are pruned. Restoring selected files is not available but if you continue, there will be performed full restore all backup files."
+msgstr "No file found for selected backup. It can mean file records for this backup are pruned. Restoring selected files is not available but if you continue, there will be performed full restore all backup files."
</div>
</com:TWizardStep>
<com:TWizardStep ID="Step3" Title="<%[ Step 3 - select files to restore ]%>" StepType="Auto">
+ <com:TPanel ID="NoFileFound" Style="height: 38px" Display="None">
+ <%[ No file found for selected backup. It can mean file records for this backup are pruned. Restoring selected files is not available but if you continue, there will be performed full restore all backup files. ]%>
+ </com:TPanel>
<div class="w3-row">
<div class="w3-col" style="width: 15%;"><%[ Path: ]%></div>
<div class="w3-col" style="width: 85%;">
</com:TDropDownList>
</div>
</div>
- <div class="w3-section w3-row">
- <div class="w3-col w3-third"><com:TLabel ForControl="RestoreJobPriority" Text="<%[ Restore job priority: ]%>" /></div>
- <div class="w3-col w3-third">
- <com:TTextBox ID="RestoreJobPriority" CssClass="w3-input w3-border" CausesValidation="false" MaxLength="5" Text="10" />
- </div>
- </div>
<div class="w3-section w3-row w3-margin-bottom">
<div class="w3-col w3-third"><%[ File relocation option: ]%></div>
<div class="w3-col w3-third">
<com:TLabel Visible="<%=$this->ReplaceFiles->SelectedValue == 'always'%>" Text="<%[ always replace files ]%>"/>
</div>
</div>
- <div class="w3-section w3-row">
- <div class="w3-col w3-third"><%[ Restore job priority: ]%></div>
- <div class="w3-col w3-third bold"><%=$this->RestoreJobPriority->Text%></div>
- </div>
<div class="w3-section w3-row">
<div class="w3-col w3-third"><%[ File relocation option: ]%></div>
<div class="w3-col w3-third bold">
* @return none
*/
public function setPreDefinedJobIdToRestore() {
- $jobid = 0;
if ($this->Request->contains('jobid')) {
$jobid = intval($this->Request['jobid']);
$this->setRestoreByJobId($jobid);
array_unshift($elements, $this->browser_root_dir);
}
}
+ if (count($elements) > 0) {
+ $this->NoFileFound->Display = 'None';
+ } elseif (isset($_SESSION['restore_single_jobid'])) {
+ $this->NoFileFound->Display = 'Dynamic';
+ }
$this->loadBrowserFiles($elements);
}
}
$jobid = null;
+ $ret = new stdClass;
+ $restore_props = [];
+ $restore_props['client'] = $this->RestoreClient->SelectedValue;
+ if ($_SESSION['file_relocation'] == 2) {
+ if (!empty($this->RestoreStripPrefix->Text)) {
+ $restore_props['strip_prefix'] = $this->RestoreStripPrefix->Text;
+ }
+ if (!empty($this->RestoreAddPrefix->Text)) {
+ $restore_props['add_prefix'] = $this->RestoreAddPrefix->Text;
+ }
+ if (!empty($this->RestoreAddSuffix->Text)) {
+ $restore_props['add_suffix'] = $this->RestoreAddSuffix->Text;
+ }
+ } elseif ($_SESSION['file_relocation'] == 3) {
+ if (!empty($this->RestoreRegexWhere->Text)) {
+ $restore_props['regex_where'] = $this->RestoreRegexWhere->Text;
+ }
+ }
+ if (!key_exists('add_prefix', $restore_props)) {
+ $restore_props['where'] = $this->RestorePath->Text;
+ }
+ $restore_props['replace'] = $this->ReplaceFiles->SelectedValue;
+ $restore_props['restorejob'] = $this->RestoreJob->SelectedValue;
if ($is_element) {
$this->getModule('api')->create(array('bvfs', 'restore'), $cmd_props);
- $restore_props = array();
$restore_props['rpath'] = $path;
- $restore_props['client'] = $this->RestoreClient->SelectedValue;
- $restore_props['priority'] = intval($this->RestoreJobPriority->Text);
- if ($_SESSION['file_relocation'] == 2) {
- if (!empty($this->RestoreStripPrefix->Text)) {
- $restore_props['strip_prefix'] = $this->RestoreStripPrefix->Text;
- }
- if (!empty($this->RestoreAddPrefix->Text)) {
- $restore_props['add_prefix'] = $this->RestoreAddPrefix->Text;
- }
- if (!empty($this->RestoreAddSuffix->Text)) {
- $restore_props['add_suffix'] = $this->RestoreAddSuffix->Text;
- }
- } elseif ($_SESSION['file_relocation'] == 3) {
- if (!empty($this->RestoreRegexWhere->Text)) {
- $restore_props['regex_where'] = $this->RestoreRegexWhere->Text;
- }
- }
- if (!key_exists('add_prefix', $restore_props)) {
- $restore_props['where'] = $this->RestorePath->Text;
- }
- $restore_props['replace'] = $this->ReplaceFiles->SelectedValue;
- $restore_props['restorejob'] = $this->RestoreJob->SelectedValue;
$ret = $this->getModule('api')->create(array('jobs', 'restore'), $restore_props);
$jobid = $this->getModule('misc')->findJobIdStartedJob($ret->output);
// Remove temporary BVFS table
$this->getModule('api')->set(array('bvfs', 'cleanup'), array('path' => $path));
+ } elseif (count($_SESSION['files_browser']) === 0 && isset($_SESSION['restore_single_jobid'])) {
+ $restore_props['full'] = 1;
+ $restore_props['id'] = $_SESSION['restore_single_jobid'];
+ $job = $this->getModule('api')->get(array('jobs', $_SESSION['restore_single_jobid']))->output;
+ if (is_object($job)) {
+ $restore_props['fileset'] = $job->fileset;
+ }
+ $ret = $this->getModule('api')->create(array('jobs', 'restore'), $restore_props);
+ $jobid = $this->getModule('misc')->findJobIdStartedJob($ret->output);
+ } else {
+ $ret->output = ['No file to restore found'];
}
$url_params = array();
if (is_numeric($jobid)) {