Commit 4f31433c authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fixed some error messages & codes.

parent 016d0b08
Pipeline #1039 passed with stage
in 1 minute and 52 seconds
......@@ -226,6 +226,7 @@ const ERROR_IO_CREATE_FILE = 1311;
const ERROR_IO_COPY_FILE = 1312;
const ERROR_IO_FILE_NOT_FOUND = 1313;
const ERROR_IO_CHMOD = 1314;
const ERROR_PDF2SVG = 1315;
//Report
const ERROR_UNKNOWN_LINK_QUALIFIER = 1400;
......
......@@ -578,8 +578,7 @@ class Save {
$this->doImport($formElement, $tmpFile);
}
// Upload
// Take care the necessary target directories exist.
// Upload - Take care the necessary target directories exist.
$cwd = getcwd();
$sitePath = $this->store->getVar(SYSTEM_SITE_PATH, STORE_SYSTEM);
if ($cwd === false || $sitePath === false || !chdir($sitePath)) {
......@@ -609,7 +608,7 @@ class Save {
$modeUpload = $flagDelete ? UPLOAD_MODE_DELETEOLD : UPLOAD_MODE_UNCHANGED;
}
// skip uploading the file if this is an import without a specified file destination
// skip uploading the file, if this is an import without a specified file destination
if (!isset($formElement[FE_IMPORT_TO_TABLE]) || isset($formElement[FE_FILE_DESTINATION])) {
$pathFileName = $this->copyUploadFile($formElement, $statusUpload);
}
......@@ -761,7 +760,6 @@ class Save {
*/
private function copyUploadFile(array $formElement, array $statusUpload) {
$pathFileName = '';
$vars = array();
if (!isset($statusUpload[FILES_TMP_NAME]) || $statusUpload[FILES_TMP_NAME] === '') {
// nothing to upload: e.g. user has deleted a previous uploaded file.
......@@ -916,7 +914,7 @@ class Save {
if (false === chdir($tempDir)) {
$msg = HelperFile::getLastErrorAsString() . " - chdir($tempDir)";
throw new UserFormException(json_encode([ERROR_MESSAGE_TO_USER => 'copy failed', ERROR_MESSAGE_SUPPORT => $msg]), ERROR_IO_COPY);
throw new UserFormException(json_encode([ERROR_MESSAGE_TO_USER => 'chdir failed', ERROR_MESSAGE_SUPPORT => $msg]), ERROR_IO_CHDIR);
}
// Split destination.
......@@ -932,7 +930,8 @@ class Save {
$cmd = 'pdf2svg "' . $newSrc . '" "' . $fileNameDest . '" all';
$output = Support::qfqExec($cmd, $rc);
if ($rc != 0) {
throw new UserFormException(json_encode([ERROR_MESSAGE_TO_USER => 'copy failed', ERROR_MESSAGE_SUPPORT => "[$cwd][cmd=$cmd]$output"]), ERROR_IO_COPY);
throw new UserFormException(json_encode([ERROR_MESSAGE_TO_USER => 'pdf2svg failed', ERROR_MESSAGE_SUPPORT => "[$cwd][cmd=$cmd]$output"]),
ERROR_PDF2SVG);
}
// Array of created filenames.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment