mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Allowing to skip linktracking sync in Filesystem::sync() (useful for large bulk updates) (AIR-28)
This commit is contained in:
parent
e3cceb6038
commit
d6c050c6ce
@ -123,8 +123,13 @@ class Filesystem extends Object {
|
||||
* back to the equivalent filesystem record.
|
||||
*
|
||||
* @param int $folderID Folder ID to sync along with all it's children
|
||||
* @param Boolean $syncLinkTracking Determines if the link tracking data should also
|
||||
* be updated via {@link SiteTree->syncLinkTracking()}. Setting this to FALSE
|
||||
* means that broken links inside page content are not noticed, at least until the next
|
||||
* call to {@link SiteTree->write()} on this page.
|
||||
* @return string Localized status message
|
||||
*/
|
||||
static function sync($folderID = null) {
|
||||
static function sync($folderID = null, $syncLinkTracking = true) {
|
||||
$folder = DataObject::get_by_id('Folder', (int) $folderID);
|
||||
if(!($folder && $folder->exists())) $folder = singleton('Folder');
|
||||
|
||||
@ -145,6 +150,7 @@ class Filesystem extends Object {
|
||||
}
|
||||
|
||||
// Update the image tracking of all pages
|
||||
if($syncLinkTracking) {
|
||||
if(class_exists('SiteTree')) {
|
||||
$origDisableSubsiteFilter = Subsite::$disable_subsite_filter;
|
||||
if(class_exists('Subsite')) Subsite::$disable_subsite_filter = true;
|
||||
@ -155,6 +161,7 @@ class Filesystem extends Object {
|
||||
}
|
||||
if(class_exists('Subsite')) Subsite::disable_subsite_filter($origDisableSubsiteFilter);
|
||||
}
|
||||
}
|
||||
|
||||
return _t(
|
||||
'Filesystem.SYNCRESULTS',
|
||||
|
Loading…
Reference in New Issue
Block a user