From c4a3f80a6dccdff9b2abff6f159ef8fdd4382787 Mon Sep 17 00:00:00 2001 From: polo Date: Mon, 15 Jul 2024 17:49:31 +0200 Subject: =?UTF-8?q?d=C3=A9placement=20dossier=20d'ex=C3=A9cution,=20suppre?= =?UTF-8?q?ssion=20de=20Config::checkPath,=20bugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/files.php | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'src/files.php') diff --git a/src/files.php b/src/files.php index e78cfba..0bda901 100644 --- a/src/files.php +++ b/src/files.php @@ -5,8 +5,11 @@ function makeFile($path, $file_name, $data) { - file_put_contents($path. $file_name, $data); - chmod($path . $file_name, 0644); // droits en octal + //~ if(is_writable('../' . $path)) + //~ { + file_put_contents($path. $file_name, $data); + chmod($path . $file_name, 0644); // droits en octal + //~ } //~ protected function createFile(string $latex, string $file_name, string $latexPath) //~ { @@ -24,11 +27,31 @@ function makeFile($path, $file_name, $data) function makeFolder(string $path) { + $rights = 0755; // droits en octal + if(!file_exists($path)) { - mkdir($path); - chmod($path, 0755); // droits en octal + //~ if(is_writable('../' . $path)) + //~ { + mkdir($path); + chmod($path, $rights); + //~ } + //~ else + //~ { + //~ echo "debug: la création du dossier " . $path . " est impossible\n"; + //~ } } + else + { + //~ if(is_writable($path)) + //~ { + chmod($path, $rights); + //~ } + //~ else + //~ { + //~ echo "debug: la modification des droits du dossier " . $path . " est impossible\n"; + //~ } + } } // commande système pdflatex @@ -38,12 +61,13 @@ function latexToPdf(string $latex_path, string $file_name, string $pdf_path) $output_dir = ''; if($pdf_path !== '') { - $output_dir = '-output-directory=' . $pdf_path . ' '; + $output_dir = '-output-directory=' . $pdf_path; } // compilation - //echo 'pdflatex ' . $output_dir . $latex_path . $file_name . "\n"; - exec('pdflatex ' . $output_dir . $latex_path . $file_name); + //echo 'pdflatex ' . $output_dir . ' ' . $latex_path . $file_name . "\n"; + //die; + exec('pdflatex ' . $output_dir . ' ' . $latex_path . $file_name); // nettoyage $basename = basename($file_name, '.tex'); -- cgit v1.2.3