adding faultString for backup/restore checking
This commit is contained in:
parent
ef3286911f
commit
a834ce6a5b
5 changed files with 22 additions and 6 deletions
|
@ -146,6 +146,7 @@ class Backup
|
|||
* @param token : token
|
||||
* @return hasharray with field:
|
||||
* status : string - susccess | working | fault
|
||||
* faultString: string - description of fault
|
||||
* token : stirng - backup token
|
||||
* url : string - access url
|
||||
* tmpfile : string - access filename
|
||||
|
@ -158,6 +159,9 @@ class Backup
|
|||
$this->token = $token;
|
||||
$this->setEnviroment();
|
||||
$status = file_get_contents($this->statusFile);
|
||||
if (strpos($status,'fault')!==false) {
|
||||
list($status,$faultString) = explode('|',$status);
|
||||
}
|
||||
switch ($status) {
|
||||
case 'success':
|
||||
$r['url'] = $this->gb->getUrlPart()."access/$token.".BACKUP_EXT;
|
||||
|
@ -165,6 +169,7 @@ class Backup
|
|||
case 'working':
|
||||
case 'fault':
|
||||
$r['status'] = $status;
|
||||
$r['faultString'] = $faultString;
|
||||
$r['token'] = $token;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1014,6 +1014,7 @@ class GreenBox extends BasicStor{
|
|||
* @param token : string - backup token
|
||||
* @return hasharray with field:
|
||||
* status : string - susccess | working | fault
|
||||
* faultString: string - description of fault
|
||||
* token : stirng - backup token
|
||||
* url : string - access url
|
||||
*/
|
||||
|
@ -1081,6 +1082,7 @@ class GreenBox extends BasicStor{
|
|||
* @return status : hasharray - fields:
|
||||
* token: string - restore token
|
||||
* status: string - working | fault | success
|
||||
* faultString: string - description of fault
|
||||
*/
|
||||
function backupRestoreCheck($token)
|
||||
{
|
||||
|
|
|
@ -950,6 +950,7 @@ class LocStor extends BasicStor{
|
|||
* @param token : string - backup token
|
||||
* @return hasharray with field:
|
||||
* status : string - susccess | working | fault
|
||||
* faultString: string - description of fault
|
||||
* token : stirng - backup token
|
||||
* url : string - access url
|
||||
*/
|
||||
|
@ -1017,6 +1018,7 @@ class LocStor extends BasicStor{
|
|||
* @return status : hasharray - fields:
|
||||
* token: string - restore token
|
||||
* status: string - working | fault | success
|
||||
* faultString: string - description of fault
|
||||
*/
|
||||
function restoreBackupCheck($token)
|
||||
{
|
||||
|
|
|
@ -87,6 +87,7 @@ class Restore {
|
|||
* @param token : token
|
||||
* @return hasharray with field:
|
||||
* status : string - susccess | working | fault
|
||||
* faultString : string - description of fault
|
||||
* token : stirng - backup token
|
||||
* url : string - access url
|
||||
* tmpfile : string - access filename
|
||||
|
@ -98,7 +99,12 @@ class Restore {
|
|||
$this->token = $token;
|
||||
$this->setEnviroment();
|
||||
if (is_file($this->statusFile)) {
|
||||
$r['status'] = file_get_contents($this->statusFile);
|
||||
$stat = file_get_contents($this->statusFile);
|
||||
if (strpos($stat,'fault|')!==false) {
|
||||
list($stat,$message) = explode('|',$stat);
|
||||
}
|
||||
$r['status'] = $stat;
|
||||
if ($stat=='fault') $r['faultString'] = $message;
|
||||
$r['token'] = $token;
|
||||
return $r;
|
||||
} else {
|
||||
|
@ -163,13 +169,13 @@ class Restore {
|
|||
" startRestore - addFileToStorage \n".
|
||||
"(".$put->getMessage()."/".$put->getUserInfo().")\n"
|
||||
);
|
||||
file_put_contents($this->statusFile, 'fault');
|
||||
file_put_contents($this->statusFile, 'fault|'.$put->getMessage()."/".$put->getUserInfo());
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->addLogItem("-E- ".date("Ymd-H:i:s")." startRestore - invalid archive format\n");
|
||||
file_put_contents($this->statusFile, 'fault');
|
||||
file_put_contents($this->statusFile, 'fault|invalid archive format');
|
||||
return;
|
||||
}
|
||||
file_put_contents($this->statusFile, 'success');
|
||||
|
@ -241,7 +247,7 @@ class Restore {
|
|||
" addFileToStorage - replaceFile Error ".
|
||||
"(".$replace->getMessage()."/".$replace->getUserInfo().")\n"
|
||||
);
|
||||
file_put_contents($this->statusFile, 'fault');
|
||||
file_put_contents($this->statusFile, 'fault|'.$replace->getMessage()."/".$replace->getUserInfo());
|
||||
return $replace;
|
||||
}
|
||||
#$this->addLogItem("replace it \n");
|
||||
|
@ -273,7 +279,7 @@ class Restore {
|
|||
"(".$put->getMessage()."/".$put->getUserInfo().")\n"
|
||||
."\n---\n".file_get_contents($file)."\n---\n"
|
||||
);
|
||||
file_put_contents($this->statusFile, 'fault');
|
||||
file_put_contents($this->statusFile, 'fault|'.$put->getMessage()."/".$put->getUserInfo());
|
||||
//$this->addLogItem("Error Object: ".print_r($put,true)."\n");
|
||||
return $put;
|
||||
}
|
||||
|
|
|
@ -2002,7 +2002,8 @@ class XR_LocStor extends LocStor{
|
|||
* <ul>
|
||||
* <li> status : hasharray - fields:
|
||||
* token: string - restore token
|
||||
* status: string - working | fault | success</li>
|
||||
* status: string - working | fault | success
|
||||
* faultString: string - description of fault</li>
|
||||
* </ul>
|
||||
*
|
||||
* On errors, returns an XML-RPC error response.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue