mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fixed renaming of .tar.gz and .tar.bz2 files
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@40724 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
30fc2e2a50
commit
716d406754
@ -178,7 +178,12 @@ class File extends DataObject {
|
||||
while(file_exists("$base/$file")) {
|
||||
$i = isset($i) ? ($i+1) : 2;
|
||||
$oldFile = $file;
|
||||
$file = ereg_replace('[0-9]*(\.[^.]+$)',$i . '\\1', $file);
|
||||
if(substr($file, strlen($file) - strlen('.tar.gz')) == '.tar.gz' ||
|
||||
substr($file, strlen($file) - strlen('.tar.bz2')) == '.tar.bz2') {
|
||||
$file = ereg_replace('[0-9]*(\.tar\.[^.]+$)',$i . '\\1', $file);
|
||||
} else {
|
||||
$file = ereg_replace('[0-9]*(\.[^.]+$)',$i . '\\1', $file);
|
||||
}
|
||||
if($oldFile == $file && $i > 2) user_error("Couldn't fix $file with $i", E_USER_ERROR);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user