ENHANCEMENT Allowing to skip linktracking sync in Filesystem::sync() (useful for large bulk updates) (AIR-28)

This commit is contained in:
Ingo Schommer 2011-09-27 14:02:35 +02:00
parent e3cceb6038
commit d6c050c6ce

View File

@ -123,8 +123,13 @@ class Filesystem extends Object {
* back to the equivalent filesystem record. * back to the equivalent filesystem record.
* *
* @param int $folderID Folder ID to sync along with all it's children * @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); $folder = DataObject::get_by_id('Folder', (int) $folderID);
if(!($folder && $folder->exists())) $folder = singleton('Folder'); if(!($folder && $folder->exists())) $folder = singleton('Folder');
@ -145,6 +150,7 @@ class Filesystem extends Object {
} }
// Update the image tracking of all pages // Update the image tracking of all pages
if($syncLinkTracking) {
if(class_exists('SiteTree')) { if(class_exists('SiteTree')) {
$origDisableSubsiteFilter = Subsite::$disable_subsite_filter; $origDisableSubsiteFilter = Subsite::$disable_subsite_filter;
if(class_exists('Subsite')) Subsite::$disable_subsite_filter = true; 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); if(class_exists('Subsite')) Subsite::disable_subsite_filter($origDisableSubsiteFilter);
} }
}
return _t( return _t(
'Filesystem.SYNCRESULTS', 'Filesystem.SYNCRESULTS',