diff options
-rw-r--r-- | it_text.class | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/it_text.class b/it_text.class index 7b27006..dbfda47 100644 --- a/it_text.class +++ b/it_text.class @@ -274,18 +274,12 @@ function dump_php() $oldmask = umask(002); $filename = $this->p['phpfiles'][0]; - $oldsyntax = file_exists($filename) && it::system('fgrep -q " => [" {filename}', ['filename' => $filename]); - if ((count($this->p['phpfiles']) == 1) && ($f = it::fopen($filename, 'w'))) + if ((count($this->p['phpfiles']) == 1)) { $dump = '<?php return ' . strtr(var_export($this->statictext, true), array("=> \n array (" => "=> array(", "array (\n '_'" => "array(\n'_'", "\n ),\n " => "\n),\n", "\n ),\n" => "\n),\n", "\r" => "")) . ";\n?>\n"; - if (!$oldsyntax) - { - it::file_put_contents($tmpfile = tempnam('/tmp/', 'texts_'), $dump); - $dump = it::exec('/www/server/bin/convertsyntax.php -a {tmpfile}', ['tmpfile' => $tmpfile]); - unlink($tmpfile); - } - $result = (fputs($f, $dump) !== false); - fclose($f); + it::file_put_contents($tmpfile = tempnam('/tmp/', 'texts_'), $dump); + $result = it::system('/www/server/bin/convertsyntax.php -a {tmpfile} >{filename}', ['tmpfile' => $tmpfile, 'filename' => $filename]) == 0; + unlink($tmpfile); } umask($oldmask); |