@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | if ($owner->hasMethod('canCachePage')) { |
| 51 | 51 | // if it can cache the page, then it the cache string will remain empty. |
| 52 | 52 | $canCache = $owner->canCachePage(); |
| 53 | - self::$_can_cache_content_string .= $canCache ? '' : $this->getRandomKey(); |
|
| 53 | + self::$_can_cache_content_string .= $canCache ? '' : $this->getRandomKey(); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | //action |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | if ($requestVars) { |
| 77 | 77 | $canCache = false; |
| 78 | 78 | foreach ($requestVars as $key => $item) { |
| 79 | - if (! $item) { |
|
| 79 | + if (!$item) { |
|
| 80 | 80 | $item = ''; |
| 81 | 81 | } |
| 82 | 82 | self::$_can_cache_content_string .= serialize($key . '_' . serialize($item)); |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | // NB. |
| 22 | 22 | // if the dataobject has the versioned extension then the cache should be invalidated onAfterPublish |
| 23 | 23 | // hasStages function is part of the Versioned class so safe to check here |
| 24 | - if (! $owner->hasExtension(Versioned::class)) { |
|
| 24 | + if (!$owner->hasExtension(Versioned::class)) { |
|
| 25 | 25 | $this->doUpdateCache(); |
| 26 | - } elseif (! $owner->hasStages()) { |
|
| 26 | + } elseif (!$owner->hasStages()) { |
|
| 27 | 27 | $this->doUpdateCache(); |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -94,6 +94,6 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | $excludedClasses = (array) Config::inst()->get(DataObjectExtension::class, 'excluded_classes_for_caching'); |
| 96 | 96 | |
| 97 | - return ! in_array($className, $excludedClasses, true); |
|
| 97 | + return !in_array($className, $excludedClasses, true); |
|
| 98 | 98 | } |
| 99 | 99 | } |
@@ -24,11 +24,11 @@ |
||
| 24 | 24 | ORDER BY "ClassNameLastEdited" ASC |
| 25 | 25 | '); |
| 26 | 26 | foreach ($query as $row) { |
| 27 | - $array[$row['ClassNameLastEdited']] = |
|
| 28 | - Injector::inst()->get($row['ClassNameLastEdited'])->i18n_singular_name() . |
|
| 29 | - ' (×' . $row['Count'] . ')'; |
|
| 30 | - if ($myClass && $myClass === $row['ClassNameLastEdited']) { |
|
| 31 | - return $row['Count']; |
|
| 27 | + $array[ $row[ 'ClassNameLastEdited' ] ] = |
|
| 28 | + Injector::inst()->get($row[ 'ClassNameLastEdited' ])->i18n_singular_name() . |
|
| 29 | + ' (×' . $row[ 'Count' ] . ')'; |
|
| 30 | + if ($myClass && $myClass === $row[ 'ClassNameLastEdited' ]) { |
|
| 31 | + return $row[ 'Count' ]; |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | return '<br />' . implode('<br> ', $array); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | ), |
| 38 | 38 | ] |
| 39 | 39 | ); |
| 40 | - if (! (bool) $owner->NeverCachePublicly) { |
|
| 40 | + if (!(bool) $owner->NeverCachePublicly) { |
|
| 41 | 41 | $fields->addFieldsToTab( |
| 42 | 42 | 'Root.Cache', |
| 43 | 43 | [ |
@@ -105,8 +105,7 @@ discard block |
||
| 105 | 105 | public function PageCanBeCachedEntirelyDuration(): int |
| 106 | 106 | { |
| 107 | 107 | return (int) ( |
| 108 | - $this->getOwner()->PublicCacheDurationInSeconds ?: |
|
| 109 | - SiteConfig::current_site_config()->PublicCacheDurationInSeconds); |
|
| 108 | + $this->getOwner()->PublicCacheDurationInSeconds ?: SiteConfig::current_site_config()->PublicCacheDurationInSeconds); |
|
| 110 | 109 | } |
| 111 | 110 | |
| 112 | 111 | public function EditCacheSettingsLink(): string |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | public function sourceRecords($params = null) |
| 36 | 36 | { |
| 37 | 37 | $sc = SiteConfig::current_site_config(); |
| 38 | - if (! $sc->HasCaching) { |
|
| 38 | + if (!$sc->HasCaching) { |
|
| 39 | 39 | return Page::get(); |
| 40 | 40 | } elseif ($sc->PublicCacheDurationInSeconds > 0) { |
| 41 | - return Page::get()->filter(['NeverCachePublicly' => true]); |
|
| 41 | + return Page::get()->filter([ 'NeverCachePublicly' => true ]); |
|
| 42 | 42 | } else { |
| 43 | 43 | return Page::get() |
| 44 | - ->filterAny(['PublicCacheDurationInSeconds' => 0, 'NeverCachePublicly' => true]); |
|
| 44 | + ->filterAny([ 'PublicCacheDurationInSeconds' => 0, 'NeverCachePublicly' => true ]); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | ], |
| 55 | 55 | 'ShowInSearch' => [ |
| 56 | 56 | 'title' => 'Edit Cache Settings', |
| 57 | - 'formatting' => function ($value, $item) { |
|
| 57 | + 'formatting' => function($value, $item) { |
|
| 58 | 58 | return '<a href="' . $item->EditCacheSettingsLink() . '" target="_blank">Edit Settings</a>'; |
| 59 | 59 | }, |
| 60 | 60 | ], |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | public function sourceRecords($params = null) |
| 36 | 36 | { |
| 37 | 37 | $sc = SiteConfig::current_site_config(); |
| 38 | - if (! $sc->HasCaching) { |
|
| 39 | - return Page::get()->filter(['ID' => 0]); |
|
| 38 | + if (!$sc->HasCaching) { |
|
| 39 | + return Page::get()->filter([ 'ID' => 0 ]); |
|
| 40 | 40 | } elseif ($sc->PublicCacheDurationInSeconds > 0) { |
| 41 | - return Page::get()->filter(['NeverCachePublicly' => false]); |
|
| 41 | + return Page::get()->filter([ 'NeverCachePublicly' => false ]); |
|
| 42 | 42 | } else { |
| 43 | 43 | return Page::get() |
| 44 | - ->filter(['PublicCacheDurationInSeconds:GreaterThan' => 0, 'NeverCachePublicly' => false]); |
|
| 44 | + ->filter([ 'PublicCacheDurationInSeconds:GreaterThan' => 0, 'NeverCachePublicly' => false ]); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | // ], |
| 61 | 61 | 'ShowInSearch' => [ |
| 62 | 62 | 'title' => 'Edit Cache Settings', |
| 63 | - 'formatting' => function ($value, $item) { |
|
| 63 | + 'formatting' => function($value, $item) { |
|
| 64 | 64 | return '<a href="' . $item->EditCacheSettingsLink() . '" target="_blank">Edit Settings</a>'; |
| 65 | 65 | }, |
| 66 | 66 | ], |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | ;'); |
| 214 | 214 | if ($obj->RecordCacheUpdates) { |
| 215 | 215 | $recordId = Injector::inst() |
| 216 | - ->create(ObjectsUpdated::class, ['ClassNameLastEdited' => $className]) |
|
| 216 | + ->create(ObjectsUpdated::class, [ 'ClassNameLastEdited' => $className ]) |
|
| 217 | 217 | ->write(); |
| 218 | 218 | DB::query('DELETE FROM "ObjectsUpdated" WHERE "ID" < ' . (int) ($recordId - self::MAX_OBJECTS_UPDATED)); |
| 219 | 219 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | 'FONT_CACHE_DIRECTIVE' => $currentSiteConfig->config()->get('font_cache_directive'), |
| 262 | 262 | ] as $key => $value |
| 263 | 263 | ) { |
| 264 | - if (! $currentSiteConfig->HasResourceCaching) { |
|
| 264 | + if (!$currentSiteConfig->HasResourceCaching) { |
|
| 265 | 265 | $value = ''; |
| 266 | 266 | } |
| 267 | 267 | if ($owner->ResourceCachingTimeInSeconds) { |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | public function DoesNotHaveCaching(): bool |
| 276 | 276 | { |
| 277 | 277 | $owner = $this->getOwner(); |
| 278 | - return ! $owner->HasCaching; |
|
| 278 | + return !$owner->HasCaching; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | protected function updateHtaccessForOne(string $code, string $toAdd) |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | return $this->returnNoCache(); |
| 41 | 41 | } |
| 42 | 42 | // avoid test sites being cached |
| 43 | - if (!(Director::isLive()|| Director::isDev())) { |
|
| 43 | + if (!(Director::isLive() || Director::isDev())) { |
|
| 44 | 44 | return $this->returnNoCache(); |
| 45 | 45 | } |
| 46 | 46 | |