summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/io.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/inc/io.php b/inc/io.php
index c559feb17..4c7fb094f 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -324,14 +324,14 @@ function io_replaceInFile($file, $oldline, $newline, $regex=false, $maxlines=0)
$lines[$i] = preg_replace($pattern, $replace, $line, -1, $matched);
if ($matched) $count++;
}
- } else {
- $lines = ($maxlines == 0) ?
- preg_grep($pattern, $lines, PREG_GREP_INVERT) :
- preg_replace($pattern, $replace, $lines);
- }
+ } else if ($maxlines == 0) {
+ $lines = preg_grep($pattern, $lines, PREG_GREP_INVERT);
- if($maxlines == 0 && ((string)$newline) !== '') {
- $lines[] = $newline;
+ if ((string)$newline !== ''){
+ $lines[] = $newline;
+ }
+ } else {
+ $lines = preg_replace($pattern, $replace, $lines);
}
if(count($lines)){