mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 09:05:53 +00:00
BUGFIX #4642: Fixed creation of folders in non-english languages.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@90552 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
0071e37840
commit
287887ccca
@ -499,32 +499,34 @@ JS;
|
|||||||
if(isset($parentObj->ID)) $filename = $parentObj->FullPath . $name;
|
if(isset($parentObj->ID)) $filename = $parentObj->FullPath . $name;
|
||||||
else $filename = ASSETS_PATH . '/' . $name;
|
else $filename = ASSETS_PATH . '/' . $name;
|
||||||
|
|
||||||
// Ensure uniqueness
|
|
||||||
$i = 2;
|
|
||||||
$baseFilename = $filename . '-';
|
|
||||||
while(file_exists($filename)) {
|
|
||||||
$filename = $baseFilename . $i;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actually create
|
// Actually create
|
||||||
if(!file_exists(ASSETS_PATH)) {
|
if(!file_exists(ASSETS_PATH)) {
|
||||||
mkdir(ASSETS_PATH);
|
mkdir(ASSETS_PATH);
|
||||||
}
|
}
|
||||||
mkdir($filename);
|
|
||||||
chmod($filename, Filesystem::$file_create_mask);
|
|
||||||
|
|
||||||
// Create object
|
|
||||||
$p = new Folder();
|
$p = new Folder();
|
||||||
$p->ParentID = $parent;
|
$p->ParentID = $parent;
|
||||||
$p->Name = $p->Title = basename($filename);
|
$p->Name = $p->Title = basename($filename);
|
||||||
|
|
||||||
|
// Ensure uniqueness
|
||||||
|
$i = 2;
|
||||||
|
$baseFilename = substr($p->Filename, 0, -1) . '-';
|
||||||
|
while(file_exists($p->FullPath)) {
|
||||||
|
$p->Filename = $baseFilename . $i . '/';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
$p->write();
|
$p->write();
|
||||||
|
|
||||||
|
mkdir($p->FullPath);
|
||||||
|
chmod($p->FullPath, Filesystem::$file_create_mask);
|
||||||
|
|
||||||
if(isset($_REQUEST['returnID'])) {
|
if(isset($_REQUEST['returnID'])) {
|
||||||
return $p->ID;
|
return $p->ID;
|
||||||
} else {
|
} else {
|
||||||
return $this->returnItemToUser($p);
|
return $this->returnItemToUser($p);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user