From 43dc86d3ba361cd5e55737022335e1ff04f316c3 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Fri, 17 Feb 2023 14:08:01 +1300 Subject: [PATCH 1/3] API Standardise deprecations --- _config.php | 5 ----- src/Extension/FluentExtension.php | 14 +++++++++----- 2 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 _config.php diff --git a/_config.php b/_config.php deleted file mode 100644 index e1f5792a..00000000 --- a/_config.php +++ /dev/null @@ -1,5 +0,0 @@ -LocaleInformation($locale)->getLinkingMode(); } @@ -949,11 +949,11 @@ public function BaseURLForLocale($locale) /** * @param string $locale * @return string - * @deprecated Use LocaleInformation instead + * @deprecated 5.0.0 Use LocaleInformation() instead */ public function LocaleLink($locale) { - Deprecation::notice('5.0', 'Use LocaleInformation instead'); + Deprecation::notice('5.0.0', 'Use LocaleInformation() instead'); return $this->LocaleInformation($locale)->getLink(); } @@ -1021,7 +1021,11 @@ protected function requireSavedInLocale() } if ($this->owner->config()->get('cms_publish_required') !== null) { - Deprecation::notice('5.0', 'Use cms_localisation_required instead'); + Deprecation::notice( + '5.0.0', + 'The "' . self::class . '.cms_publish_required" configuration option is deprecated. Use "' + . self::class . '.cms_localisation_required instead' + ); return $this->owner->config()->get('cms_publish_required'); } From f79f0f90174f1b1ae49bd4656dc2accd7a2add62 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Thu, 21 Mar 2024 09:25:03 +1300 Subject: [PATCH 2/3] fix: don't invoke db for ready check outside of dev urls fixes #828 --- src/Model/CachableModel.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Model/CachableModel.php b/src/Model/CachableModel.php index 1c709b9d..b24dc8ae 100644 --- a/src/Model/CachableModel.php +++ b/src/Model/CachableModel.php @@ -2,6 +2,8 @@ namespace TractorCow\Fluent\Model; +use SilverStripe\Control\Director; +use SilverStripe\Control\HTTPRequest; use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Injector\Injector; @@ -69,6 +71,13 @@ public static function clearCached() */ protected static function databaseIsReady() { + // Outside of dev/ don't actually do any checks, assume ready + /** @var HTTPRequest $request */ + $request = Injector::inst()->get(HTTPRequest::class); + if (stripos($request->getURL(false), 'dev/') !== 0) { + return true; + } + $object = DataObject::singleton(static::class); // if any of the tables aren't created in the database From 05ef5774130a5102d7e2fd089516536745850900 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Thu, 21 Mar 2024 09:32:33 +1300 Subject: [PATCH 3/3] fix: redundant import --- src/Model/CachableModel.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Model/CachableModel.php b/src/Model/CachableModel.php index b24dc8ae..c005deec 100644 --- a/src/Model/CachableModel.php +++ b/src/Model/CachableModel.php @@ -2,7 +2,6 @@ namespace TractorCow\Fluent\Model; -use SilverStripe\Control\Director; use SilverStripe\Control\HTTPRequest; use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Config\Config;