From 72fd0128c441a6733ddb2cee932eb46a3d082acc Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Fri, 15 Jun 2012 11:28:29 +1200 Subject: [PATCH] BUGFIX "Sync files" button doesn't work when syncing the root of the assets folder --- filesystem/Folder.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/filesystem/Folder.php b/filesystem/Folder.php index 2dc4af5bb..dc8ed5472 100644 --- a/filesystem/Folder.php +++ b/filesystem/Folder.php @@ -128,13 +128,17 @@ class Folder extends File { } } $unwantedDbChildren = $hasDbChild; - - + + // if we're syncing a folder with no ID, we assume we're syncing the root assets folder + // however the Filename field is populated with "NewFolder", so we need to set this to empty + // to satisfy the baseDir variable below, which is the root folder to scan for new files in + if(!$parentID) $this->Filename = ''; + // Iterate through the actual children, correcting the database as necessary $baseDir = $this->FullPath; - - if(!$this->Filename) die($this->ID . " - " . $this->FullPath); - + + // @todo this shouldn't call die() but log instead + if($parentID && !$this->Filename) die($this->ID . " - " . $this->FullPath); if(file_exists($baseDir)) { $actualChildren = scandir($baseDir);