Fix use of option RunWithEndFile

This commit is contained in:
Michael RICOIS 2014-06-09 08:37:32 +00:00
parent 6a608349f5
commit e88cf15c86

View File

@ -121,8 +121,15 @@ if ( isset($opts->file) )
}
}
if ( $OptionsRunWithEndFile && !in_array( $extension, $runExtensions) ) {
exit;
//Get the realname of file IN or exit
if ( $OptionsRunWithEndFile ) {
if ( in_array( $extension, $runExtensions) ) {
$extensionLength = strlen($extension)+1;
$filenameIn = substr($filenameIn, 0, strlen($filenameIn) - $extensionLength);
$extension = '';
} else {
exit;
}
}
$lines = file($fluxBasePath . '/' . $filenameIn);
@ -136,7 +143,7 @@ if ( isset($opts->file) )
$extensionLength = 0;
if ( $extension != '' ) {
$extensionLength = strlen($extension)+1;
$filenameOut = substr($filenameIn, 0, strlen($filenameIn)-$extensionLength);
$filenameOut = substr($filenameIn, 0, strlen($filenameIn) - $extensionLength);
$filenameOut = $filenameOut . '_' . date('YmdHis') . '.' . $extension;
} else {
$filenameOut = $filenameIn . '_' . date('YmdHis');