mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-08-14 17:24:53 +02:00
Refactor PHP.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user