@@ -35,7 +35,7 @@ |
||
35 | 35 | ), |
36 | 36 | ] |
37 | 37 | ); |
38 | - if((bool) $this->getOwner()->NeverCachePublicly !== true) { |
|
38 | + if ((bool) $this->getOwner()->NeverCachePublicly !== true) { |
|
39 | 39 | $fields->addFieldsToTab( |
40 | 40 | 'Root.Cache', |
41 | 41 | [ |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public static function update_cache_key(?string $className = '') |
88 | 88 | { |
89 | 89 | // important - avoid endless loop! |
90 | - if(SiteConfig::get()->exists()) { |
|
90 | + if (SiteConfig::get()->exists()) { |
|
91 | 91 | $howOldIsIt = DB::query('SELECT Created FROM SiteConfig LIMIT 1')->value(); |
92 | 92 | if ($howOldIsIt && strtotime((string) $howOldIsIt) > strtotime('-5 minutes')) { |
93 | 93 | return; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | if ($obj && $obj->RecordCacheUpdates) { |
114 | 114 | $recordId = Injector::inst() |
115 | - ->create(ObjectsUpdated::class, ['ClassNameLastEdited' => $className]) |
|
115 | + ->create(ObjectsUpdated::class, [ 'ClassNameLastEdited' => $className ]) |
|
116 | 116 | ->write() |
117 | 117 | ; |
118 | 118 | DB::query('DELETE FROM ObjectsUpdated WHERE ID < ' . (int) ($recordId - self::MAX_OBJECTS_UPDATED)); |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | |
122 | 122 | public function requireDefaultRecords() |
123 | 123 | { |
124 | - if((int) SiteConfig::get()->count() > 100) { |
|
124 | + if ((int) SiteConfig::get()->count() > 100) { |
|
125 | 125 | $currentSiteConfig = SiteConfig::current_site_config(); |
126 | - if($currentSiteConfig) { |
|
126 | + if ($currentSiteConfig) { |
|
127 | 127 | DB::alteration_message('Deleting all SiteConfig records except for the current one.', 'deleted'); |
128 | 128 | DB::query('DELETE FROM "SiteConfig" WHERE ID <> ' . $currentSiteConfig->ID); |
129 | 129 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | public function onBeforeInit() |
18 | 18 | { |
19 | - if(Security::getCurrentUser()) { |
|
19 | + if (Security::getCurrentUser()) { |
|
20 | 20 | return; |
21 | 21 | } |
22 | 22 | if (Versioned::LIVE !== Versioned::get_stage()) { |
@@ -26,42 +26,42 @@ discard block |
||
26 | 26 | $owner = $this->getOwner(); |
27 | 27 | if ($owner instanceof ContentController) { |
28 | 28 | $extend = $owner->extend('updateCacheControl'); |
29 | - if($extend) { |
|
29 | + if ($extend) { |
|
30 | 30 | return; |
31 | 31 | } |
32 | - if($owner->param('Action')) { |
|
32 | + if ($owner->param('Action')) { |
|
33 | 33 | return; |
34 | 34 | } |
35 | - if($owner->param('ID')) { |
|
35 | + if ($owner->param('ID')) { |
|
36 | 36 | return; |
37 | 37 | } |
38 | - if($owner->request->isAjax()) { |
|
38 | + if ($owner->request->isAjax()) { |
|
39 | 39 | return; |
40 | 40 | } |
41 | - if($owner->request->getVar('flush')) { |
|
41 | + if ($owner->request->getVar('flush')) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | - if($owner->request->requestVars()) { |
|
44 | + if ($owner->request->requestVars()) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | $dataRecord = $owner->dataRecord; |
48 | 48 | if (empty($dataRecord)) { |
49 | 49 | return; |
50 | 50 | } |
51 | - if($dataRecord->NeverCachePublicly) { |
|
51 | + if ($dataRecord->NeverCachePublicly) { |
|
52 | 52 | HTTPCacheControlMiddleware::singleton() |
53 | 53 | ->disableCache() |
54 | 54 | ; |
55 | 55 | return; |
56 | 56 | } |
57 | - if($dataRecord->PublicCacheDurationInSeconds === -1 || $dataRecord->PublicCacheDurationInSeconds === 0) { |
|
57 | + if ($dataRecord->PublicCacheDurationInSeconds === -1 || $dataRecord->PublicCacheDurationInSeconds === 0) { |
|
58 | 58 | HTTPCacheControlMiddleware::singleton() |
59 | 59 | ->disableCache() |
60 | 60 | ; |
61 | 61 | return; |
62 | 62 | } |
63 | 63 | $sc = SiteConfig::current_site_config(); |
64 | - if($sc->HasCaching) { |
|
64 | + if ($sc->HasCaching) { |
|
65 | 65 | $cacheTime = $dataRecord->PublicCacheDurationInSecond ?: $sc->PublicCacheDurationInSeconds; |
66 | 66 | HTTPCacheControlMiddleware::singleton() |
67 | 67 | ->enableCache() |