ENHANCEMENT Filesystem::sync() will now return the number of added and deleted files and folders instead of null (from r82616, 82617 and 82724)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89717 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-10-21 02:29:20 +00:00
parent 2cc2f41b45
commit 65501a6ff2

View File

@ -104,7 +104,7 @@ class Filesystem extends Object {
* This function ensures the file table is correct with the files in the assets folder.
*/
static function sync() {
singleton('Folder')->syncChildren();
$results = singleton('Folder')->syncChildren();
$finished = false;
while(!$finished) {
$orphans = DB::query("SELECT \"C\".\"ID\" FROM \"File\" AS \"C\"
@ -119,7 +119,11 @@ class Filesystem extends Object {
unset($file);
}
}
return _t(
'Filesystem.SYNCRESULTS',
sprintf('Sync complete: %s items created, %d items deleted', (int) $results['added'], (int) $results['deleted'])
);
}
}