mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-29 06:25:18 -04:00
Refactor PHP.
This commit is contained in:
parent
ea24ae3b5f
commit
7f687e0a84
2 changed files with 7 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue