add detection and proper error message for musl based systems
This commit is contained in:
Родитель
31eb8c807d
Коммит
7a71acf9c2
|
@ -1,9 +0,0 @@
|
|||
// suppress "ONLYOFFICE cannot be reached"
|
||||
DocsAPI = {};
|
||||
DocsAPI.DocEditor = function() {};
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
OC.Notification.show(t("documentserver", "3rdparty dependencies not setup, please run `make`"), {
|
||||
type: "error"
|
||||
});
|
||||
});
|
|
@ -86,9 +86,7 @@ class StaticController extends Controller {
|
|||
// we use this as an opportunity to do some checks and present error messages
|
||||
// by serving a custom js file instead
|
||||
if ($path === 'apps/api/documents/api.js') {
|
||||
if (!file_exists($localPath)) {
|
||||
$localPath = __DIR__ . '/../../js/notbuild.js';
|
||||
} else if (!$this->setupCheck->check()) {
|
||||
if (!$this->setupCheck->check()) {
|
||||
$hint = $this->setupCheck->getHint();
|
||||
$localPath = __DIR__ . '/../../js/binaryerror.js';
|
||||
$rawContent = file_get_contents($localPath);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace OCA\DocumentServer;
|
||||
|
||||
|
||||
use OCA\DocumentServer\Document\ConverterBinary;
|
||||
|
||||
class SetupCheck {
|
||||
|
@ -49,7 +48,29 @@ class SetupCheck {
|
|||
if (!is_executable(ConverterBinary::BINARY_DIRECTORY . '/x2t')) {
|
||||
return "can't execute x2t binary, ensure php can execute binaries in the app folder";
|
||||
}
|
||||
$ldError = $this->lddError();
|
||||
if (strpos($ldError, 'ld-linux') !== false) {
|
||||
return "using a musl libc based distribution is not supported";
|
||||
} else if ($ldError) {
|
||||
return "one or more dependencies are missing";
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
private function lddError(): string {
|
||||
$descriptorSpec = [
|
||||
0 => ["pipe", "r"],// stdin
|
||||
1 => ["pipe", "w"],// stdout
|
||||
2 => ["pipe", "w"] // stderr
|
||||
];
|
||||
|
||||
$pipes = [];
|
||||
proc_open('ldd x2t', $descriptorSpec, $pipes, ConverterBinary::BINARY_DIRECTORY, []);
|
||||
|
||||
fclose($pipes[0]);
|
||||
$error = stream_get_contents($pipes[2]);
|
||||
|
||||
return trim($error);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче