mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT Filesystem::sync() now accepts a folderID argument, meaning you can specifically target a folder and it's children to sychronise, instead of everything (from r82840)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89724 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
1e09bc4907
commit
b85af0194e
@ -102,9 +102,18 @@ class Filesystem extends Object {
|
||||
|
||||
/**
|
||||
* This function ensures the file table is correct with the files in the assets folder.
|
||||
*
|
||||
* If a Folder record ID is given, all of that folder's children will be synchronised.
|
||||
* If the given Folder ID isn't found, or not specified at all, then everything will
|
||||
* be synchronised from the root folder (singleton Folder).
|
||||
*
|
||||
* @param int $folderID Folder ID to sync along with all it's children
|
||||
*/
|
||||
static function sync() {
|
||||
$results = singleton('Folder')->syncChildren();
|
||||
static function sync($folderID = null) {
|
||||
$folder = DataObject::get_by_id('Folder', (int) $folderID);
|
||||
if(!($folder && $folder->exists())) $folder = singleton('Folder');
|
||||
|
||||
$results = $folder->syncChildren();
|
||||
$finished = false;
|
||||
while(!$finished) {
|
||||
$orphans = DB::query("SELECT \"C\".\"ID\" FROM \"File\" AS \"C\"
|
||||
|
Loading…
x
Reference in New Issue
Block a user