Skip to content
Permalink
Browse files

Fixed restore cache issue. Fixed group query issue. Fixed large file …

…extraction issue.
  • Loading branch information...
cubiclesoft committed Aug 12, 2016
1 parent 2eacdf7 commit 36c7a0c31fe80cb5f0d69259ce0555c26e170466
Showing with 14 additions and 10 deletions.
  1. +1 −1 restore.php
  2. +4 −4 restore_shell_exts/main.php
  3. +9 −5 support/cb_functions.php
@@ -42,7 +42,7 @@ function CleanupCache()
{
while (($file = readdir($dir)) !== false)
{
if (substr($file, 0, 7) === "restore_") @unlink($rootpath . "/cache/" . $file);
if (substr($file, 0, 8) === "restore_") @unlink($rootpath . "/cache/" . $file);
}
closedir($dir);
@@ -429,14 +429,14 @@ function shell_cmd_groups($line)
if (!function_exists("posix_getgrnam")) echo "[Notice] The PHP function posix_getgrnam() does not exist. The POSIX PHP extension is not enabled or not available for this OS.\n";
$result = $db->Query("SELECT", array(
"DISTINCT group",
"DISTINCT " . $db->QuoteIdentifier("group"),
"FROM" => "?",
"ORDER BY" => "group"
"ORDER BY" => $db->QuoteIdentifier("group")
), "files");
while ($row = $result->NextRow())
{
echo $row->owner . " - ";
echo $row->group . " - ";
if (!function_exists("posix_getgrnam")) echo "[Missing]\n";
else
@@ -478,7 +478,7 @@ function shell_cmd_mapgroup($line)
$db->Query("UPDATE", array("files", array(
"group" => $args["params"][1],
), "WHERE" => "group = ?"), $args["params"][0]);
), "WHERE" => $db->QuoteIdentifier("group") . " = ?"), $args["params"][0]);
}
function shell_cmd_restore($line)
@@ -778,7 +778,6 @@ public function ExtractBlock($destfp, $block, $shared)
else
{
// Uncompress the data.
$this->deflate->Init("rb");
while ($data !== "")
{
$size = (strlen($data) > 1048576 ? 1048576 : strlen($data));
@@ -787,10 +786,6 @@ public function ExtractBlock($destfp, $block, $shared)
$data2 = $this->deflate->Read();
if ($data2 !== "") fwrite($destfp, $data2);
}
$this->deflate->Finalize();
$data2 = $this->deflate->Read();
if ($data2 !== "") fwrite($destfp, $data2);
}
return true;
@@ -812,13 +807,22 @@ public function DownloadFile($destfilename, $incrementalid, $blocknum, $blockpar
$fp = fopen($destfilename, "wb");
if ($fp === false) CB_DisplayError("Unable to create file '" . $destfilename . "'.");
if (!$sharedblock) $this->deflate->Init("rb");
foreach ($blockparts as $partnum => $info)
{
$result = $this->service->DownloadBlock($info);
if (!$result["success"]) CB_DisplayError("Unable to download block " . $blocknum . ":" . $partnum . " from incremental " . $incrementalid . ".", $result);
if (!$this->ExtractBlock($fp, $result["data"], $sharedblock)) CB_DisplayError("Unable to decrypt/uncompress block " . $blocknum . ":" . $partnum . " from incremental " . $incrementalid . ". Possible data corruption detected.", $result);
}
if (!$sharedblock)
{
$this->deflate->Finalize();
$data2 = $this->deflate->Read();
if ($data2 !== "") fwrite($fp, $data2);
}
fclose($fp);
// Pre-calculate the index for the shared block.

0 comments on commit 36c7a0c

Please sign in to comment.
You can’t perform that action at this time.