Refactor PHP.

This commit is contained in:
Lars Jung 2015-05-07 01:27:02 +02:00
parent ea24ae3b5f
commit 7f687e0a84
2 changed files with 7 additions and 7 deletions

View file

@ -37,9 +37,9 @@ class Api {
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$as\"");
header("Connection: close");
$rc = $archive->output($type, $base_href, $hrefs);
$ok = $archive->output($type, $base_href, $hrefs);
Util::json_fail(Util::ERR_FAILED, "packaging failed", $rc !== 0);
Util::json_fail(Util::ERR_FAILED, "packaging failed", !$ok);
exit;
}

View file

@ -19,7 +19,7 @@ class Archive {
$this->base_path = $this->app->to_path($base_href);
if (!$this->app->is_managed_path($this->base_path)) {
return 500;
return false;
}
$this->dirs = [];
@ -47,7 +47,7 @@ class Archive {
return $this->shell_cmd(Archive::$ZIP_PASSTHRU_CMD);
}
return 500;
return false;
}
@ -59,9 +59,9 @@ class Archive {
try {
Util::passthru_cmd($cmd);
} catch (Exeption $err) {
return 500;
return false;
}
return 0;
return true;
}
@ -98,7 +98,7 @@ class Archive {
}
}
return 0;
return true;
}