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