@@ -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 | } |
@@ -95,6 +95,6 @@ discard block |
||
95 | 95 | } |
96 | 96 | $excludedClasses = (array) Config::inst()->get(self::class, 'excluded_classes_for_caching'); |
97 | 97 | |
98 | - return ! in_array($className, $excludedClasses, true); |
|
98 | + return !in_array($className, $excludedClasses, true); |
|
99 | 99 | } |
100 | 100 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | return null; |
33 | 33 | } |
34 | 34 | $sc = SiteConfig::current_site_config(); |
35 | - if (! $sc->HasCaching) { |
|
35 | + if (!$sc->HasCaching) { |
|
36 | 36 | return null; |
37 | 37 | } |
38 | 38 | $request = $owner->getRequest(); |
@@ -54,38 +54,38 @@ discard block |
||
54 | 54 | //action |
55 | 55 | $action = $owner->request->param('Action'); |
56 | 56 | if ($action) { |
57 | - self::$_can_cache_content_string .= 'UA'.$action; |
|
57 | + self::$_can_cache_content_string .= 'UA' . $action; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // id |
61 | 61 | $id = $owner->request->param('ID'); |
62 | 62 | if ($id) { |
63 | - self::$_can_cache_content_string .= 'UI'.$id; |
|
63 | + self::$_can_cache_content_string .= 'UI' . $id; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | // otherid |
67 | 67 | $otherId = $owner->request->param('OtherID'); |
68 | 68 | if ($otherId) { |
69 | - self::$_can_cache_content_string .= 'UI'.$otherId; |
|
69 | + self::$_can_cache_content_string .= 'UI' . $otherId; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | //request vars |
73 | 73 | $requestVars = $owner->request->requestVars(); |
74 | 74 | if ($requestVars) { |
75 | 75 | foreach ($owner->request->requestVars() as $key => $item) { |
76 | - self::$_can_cache_content_string .= serialize($key.$item); |
|
76 | + self::$_can_cache_content_string .= serialize($key . $item); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
80 | 80 | //member |
81 | 81 | $member = Security::getCurrentUser(); |
82 | 82 | if ($member && $member->exists()) { |
83 | - if(Config::inst()->get(self::class, 'unique_cache_for_each_member')) { |
|
84 | - self::$_can_cache_content_string .= 'UM'.$member->ID; |
|
85 | - } elseif(Config::inst()->get(self::class, 'unique_cache_for_each_member_group_combo')) { |
|
83 | + if (Config::inst()->get(self::class, 'unique_cache_for_each_member')) { |
|
84 | + self::$_can_cache_content_string .= 'UM' . $member->ID; |
|
85 | + } elseif (Config::inst()->get(self::class, 'unique_cache_for_each_member_group_combo')) { |
|
86 | 86 | $groupIds = $member->Groups()->columnUnique(); |
87 | 87 | sort($groupIds, SORT_NUMERIC); |
88 | - self::$_can_cache_content_string .= 'UG'.implode(',', $groupIds); |
|
88 | + self::$_can_cache_content_string .= 'UG' . implode(',', $groupIds); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | // crucial |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | public function HasCacheKeyContent(): bool |
109 | 109 | { |
110 | - if($this->getOwner()->NeverCachePublicly) { |
|
110 | + if ($this->getOwner()->NeverCachePublicly) { |
|
111 | 111 | return false; |
112 | 112 | } |
113 | 113 | return $this->HasCacheKeys(); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public function CacheKeyContent(?bool $ignoreHasCacheKeys = false): string |
137 | 137 | { |
138 | 138 | $owner = $this->getOwner(); |
139 | - if($owner->NeverCachePublicly) { |
|
139 | + if ($owner->NeverCachePublicly) { |
|
140 | 140 | return $this->getRandomKey(); |
141 | 141 | } |
142 | 142 | $cacheKey = $this->CacheKeyGenerator('C'); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $string .= '_ID_' . $owner->ID; |
158 | 158 | } |
159 | 159 | } else { |
160 | - $string = 'NOT_CACHED__ID_' . $this->getRandomKey(); |
|
160 | + $string = 'NOT_CACHED__ID_' . $this->getRandomKey(); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | return $string; |
@@ -34,7 +34,7 @@ |
||
34 | 34 | ), |
35 | 35 | ] |
36 | 36 | ); |
37 | - if (! (bool) $this->getOwner()->NeverCachePublicly) { |
|
37 | + if (!(bool) $this->getOwner()->NeverCachePublicly) { |
|
38 | 38 | $fields->addFieldsToTab( |
39 | 39 | 'Root.Cache', |
40 | 40 | [ |
@@ -112,7 +112,7 @@ |
||
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)); |