Hello,
I'm getting a rather funky issue with the latest trunks of ImageGallery, DOM, and Uploadify installed on a stock 2.4.4 install of SilverStripe.
Every time I try changing a page to ImageGallery type, if I click save it works. If I click Save & Publish, it'll give me this error:
Error: Uncaught Exception: Cannot move .../assets/image-gallery/Images-2/ to .../assets/image-gallery/Images-2/
At line 422 in .../sapphire/filesystem/File.php
The relevant code in File.php being (with line 422 labeled):
public function updateFilesystem() {
// Regenerate "Filename", just to be sure
$this->setField('Filename', $this->getRelativePath());
// If certain elements are changed, update the filesystem reference
if(!$this->isChanged('Filename')) return false;
$changedFields = $this->getChangedFields();
$pathBefore = $changedFields['Filename']['before'];
$pathAfter = $changedFields['Filename']['after'];
// If the file or folder didn't exist before, don't rename - its created
if(!$pathBefore) return;
$pathBeforeAbs = Director::getAbsFile($pathBefore);
$pathAfterAbs = Director::getAbsFile($pathAfter);
// TODO Fix Filetest->testCreateWithFilenameWithSubfolder() to enable this
// // Create parent folders recursively in database and filesystem
// if(!is_a($this, 'Folder')) {
// $folder = Folder::findOrMake(dirname($pathAfterAbs));
// if($folder) $this->ParentID = $folder->ID;
// }
// Check that original file or folder exists, and rename on filesystem if required.
// The folder of the path might've already been renamed by Folder->updateFilesystem()
// before any filesystem update on contained file or subfolder records is triggered.
if(!file_exists($pathAfterAbs)) {
if(!is_a($this, 'Folder')) {
// Only throw a fatal error if *both* before and after paths don't exist.
if(!file_exists($pathBeforeAbs)) throw new Exception("Cannot move $pathBefore to $pathAfter - $pathBefore doesn't exist");
// Check that target directory (not the file itself) exists.
// Only check if we're dealing with a file, otherwise the folder will need to be created
if(!file_exists(dirname($pathAfterAbs))) throw new Exception("Cannot move $pathBefore to $pathAfter - Directory " . dirname($pathAfter) . " doesn't exist");
}
// Rename file or folder
$success = rename($pathBeforeAbs, $pathAfterAbs);
if(!$success) throw new Exception("Cannot move $pathBeforeAbs to $pathAfterAbs"); //Line 422
}
// Update any database references
$this->updateLinks($pathBefore, $pathAfter);
}
When/if it works (by clicking Publish and waiting, sometimes it actually does it), it often obfusticates certain images/albums, by pointing to non-existent assets.
My guess is that it may have something to do with permissions (i.e. not being able to create the needed files), however one would (reasonably) assume that the rest of silverstripe would have an issues (especially at install time). Note please that I have not messed with permissions since install.
A stock 2.4.5 has the same issue.
Any ideas/need anything else?