Skip to content

Commit

Permalink
Merge pull request #605 from creative-commoners/pulls/3/protect-hooks
Browse files Browse the repository at this point in the history
API Set extension hook implementation visibility to protected
  • Loading branch information
GuySartorelli authored May 21, 2024
2 parents a89f3e1 + 5a3231d commit 170fc27
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/AssetControlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ public function appCategory()
/**
* Should be called after the file was uploaded
*/
public function onAfterUpload()
protected function onAfterUpload()
{
$this->extend('onAfterUpload');
}
Expand Down Expand Up @@ -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) &&
Expand Down
10 changes: 5 additions & 5 deletions src/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -103,7 +103,7 @@ public function onBeforeDelete()
parent::onBeforeDelete();
}

public function onBeforeWrite()
protected function onBeforeWrite()
{
parent::onBeforeWrite();

Expand Down Expand Up @@ -245,7 +245,7 @@ public function getAbsoluteURL()
return null;
}

public function onAfterWrite()
protected function onAfterWrite()
{
parent::onAfterWrite();

Expand All @@ -258,7 +258,7 @@ public function onAfterWrite()
$this->updateChildFilesystem();
}

public function onAfterDelete()
protected function onAfterDelete()
{
parent::onAfterDelete();

Expand All @@ -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();
}
Expand Down
8 changes: 4 additions & 4 deletions src/Shortcodes/FileLinkTracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) &&
Expand Down Expand Up @@ -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) &&
Expand Down Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion tests/php/Flysystem/FlysystemAssetStoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down

0 comments on commit 170fc27

Please sign in to comment.