From 5a3231dc4d0818586f0d8e7dbbeac732bb71a2b4 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 20 May 2024 16:57:33 +1200 Subject: [PATCH] API Set extension hook implementation visibility to protected --- src/AssetControlExtension.php | 4 ++-- src/File.php | 4 ++-- src/Folder.php | 10 +++++----- src/Shortcodes/FileLinkTracking.php | 8 ++++---- tests/php/Flysystem/FlysystemAssetStoreExtension.php | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/AssetControlExtension.php b/src/AssetControlExtension.php index dc742dd7..46cfb7c9 100644 --- a/src/AssetControlExtension.php +++ b/src/AssetControlExtension.php @@ -49,7 +49,7 @@ class AssetControlExtension extends DataExtension * Ensure that deletes records remove their underlying file assets, without affecting * other staged records. */ - public function onAfterDelete() + protected function onAfterDelete() { if (!$this->hasAssets()) { return; @@ -72,7 +72,7 @@ public function onAfterDelete() * Ensure that changes to records flush overwritten files, and update the visibility * of other assets. */ - public function onBeforeWrite() + protected function onBeforeWrite() { if (!$this->hasAssets()) { return; diff --git a/src/File.php b/src/File.php index 7f085d46..60641b58 100644 --- a/src/File.php +++ b/src/File.php @@ -672,7 +672,7 @@ public function appCategory() /** * Should be called after the file was uploaded */ - public function onAfterUpload() + protected function onAfterUpload() { $this->extend('onAfterUpload'); } @@ -750,7 +750,7 @@ protected function onAfterDelete() $this->updateDependantObjects(); } - public function onAfterRevertToLive() + protected function onAfterRevertToLive() { // Force query of draft object and update (as source record is bound to live stage) if (class_exists(Versioned::class) && diff --git a/src/Folder.php b/src/Folder.php index f5efc563..81c819f8 100644 --- a/src/Folder.php +++ b/src/Folder.php @@ -94,7 +94,7 @@ public static function find_or_make($folderPath) return $item; } - public function onBeforeDelete() + protected function onBeforeDelete() { foreach ($this->AllChildren() as $child) { $child->delete(); @@ -103,7 +103,7 @@ public function onBeforeDelete() parent::onBeforeDelete(); } - public function onBeforeWrite() + protected function onBeforeWrite() { parent::onBeforeWrite(); @@ -245,7 +245,7 @@ public function getAbsoluteURL() return null; } - public function onAfterWrite() + protected function onAfterWrite() { parent::onAfterWrite(); @@ -258,7 +258,7 @@ public function onAfterWrite() $this->updateChildFilesystem(); } - public function onAfterDelete() + protected function onAfterDelete() { parent::onAfterDelete(); @@ -276,7 +276,7 @@ public function updateFilesystem() /** * If a write is skipped due to no changes, ensure that nested records still get asked to update */ - public function onAfterSkippedWrite() + protected function onAfterSkippedWrite() { $this->updateChildFilesystem(); } diff --git a/src/Shortcodes/FileLinkTracking.php b/src/Shortcodes/FileLinkTracking.php index 3ca68d9f..d6ecebf1 100644 --- a/src/Shortcodes/FileLinkTracking.php +++ b/src/Shortcodes/FileLinkTracking.php @@ -84,7 +84,7 @@ public function setFileParser(FileLinkTrackingParser $parser = null) return $this; } - public function onBeforeWrite() + protected function onBeforeWrite() { // Trigger link tracking // Note: SiteTreeLinkTracking::onBeforeWrite() has a check to @@ -106,7 +106,7 @@ public function syncLinkTracking() /** * Find HTMLText fields on {@link owner} to scrape for links that need tracking */ - public function augmentSyncLinkTracking() + protected function augmentSyncLinkTracking() { // If owner is versioned, skip tracking on live if (class_exists(Versioned::class) && @@ -145,7 +145,7 @@ public function augmentSyncLinkTracking() $this->owner->FileTracking()->setByIDList($linkedPages); } - public function onAfterDelete() + protected function onAfterDelete() { // If owner is versioned, skip tracking on live if (class_exists(Versioned::class) && @@ -223,7 +223,7 @@ protected function toggleElementClass(DOMElement $domReference, $class, $toggle) } } - public function updateCMSFields(FieldList $fields) + protected function updateCMSFields(FieldList $fields) { if (!$this->owner->config()->get('show_file_link_tracking')) { $fields->removeByName('FileTracking'); diff --git a/tests/php/Flysystem/FlysystemAssetStoreExtension.php b/tests/php/Flysystem/FlysystemAssetStoreExtension.php index a38d11ea..25ca85d6 100644 --- a/tests/php/Flysystem/FlysystemAssetStoreExtension.php +++ b/tests/php/Flysystem/FlysystemAssetStoreExtension.php @@ -15,7 +15,7 @@ class FlysystemAssetStoreExtension extends Extension * @param string $asset * @param array $context */ - public function updateResponse($response, $asset, $context) + protected function updateResponse($response, $asset, $context) { self::$lastHookCall = [$response, $asset, $context]; self::$callCount++;