File tree Expand file tree Collapse file tree 5 files changed +49
-25
lines changed
wcfsetup/install/files/lib
endpoint/controller/core/notices Expand file tree Collapse file tree 5 files changed +49
-25
lines changed Original file line number Diff line number Diff line change 44
55use wcf \data \DatabaseObjectEditor ;
66use wcf \data \IEditableCachedObject ;
7- use wcf \data \object \type \ObjectTypeCache ;
8- use wcf \system \cache \builder \ConditionCacheBuilder ;
9- use wcf \system \cache \builder \NoticeCacheBuilder ;
7+ use wcf \system \cache \eager \NoticeCache ;
108use wcf \system \WCF ;
119
1210/**
@@ -67,11 +65,6 @@ public function setShowOrder($showOrder = 0)
6765 */
6866 public static function resetCache ()
6967 {
70- NoticeCacheBuilder::getInstance ()->reset ();
71- ConditionCacheBuilder::getInstance ()->reset ([
72- 'definitionID ' => ObjectTypeCache::getInstance ()
73- ->getDefinitionByName ('com.woltlab.wcf.condition.notice ' )
74- ->definitionID ,
75- ]);
68+ (new NoticeCache ())->rebuild ();
7669 }
7770}
Original file line number Diff line number Diff line change 22
33namespace wcf \system \cache \builder ;
44
5- use wcf \data \ notice \ NoticeList ;
5+ use wcf \system \ cache \ eager \ NoticeCache ;
66
77/**
88 * Caches the enabled notices.
99 *
1010 * @author Matthias Schmidt
1111 * @copyright 2001-2019 WoltLab GmbH
1212 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
13+ *
14+ * @deprecated 6.2 use `NoticeCache` instead
1315 */
14- class NoticeCacheBuilder extends AbstractCacheBuilder
16+ final class NoticeCacheBuilder extends AbstractLegacyCacheBuilder
1517{
16- /**
17- * @inheritDoc
18- */
19- protected function rebuild (array $ parameters )
18+ #[\Override]
19+ protected function rebuild (array $ parameters ): array
2020 {
21- $ noticeList = new NoticeList ();
22- $ noticeList ->getConditionBuilder ()->add ('isDisabled = ? ' , [0 ]);
23- $ noticeList ->sqlOrderBy = 'showOrder ASC ' ;
24- $ noticeList ->readObjects ();
21+ return (new NoticeCache ())->getCache ();
22+ }
2523
26- return $ noticeList ->getObjects ();
24+ #[\Override]
25+ public function reset (array $ parameters = [])
26+ {
27+ (new NoticeCache ())->rebuild ();
2728 }
2829}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace wcf \system \cache \eager ;
4+
5+ use wcf \data \notice \Notice ;
6+ use wcf \data \notice \NoticeList ;
7+
8+ /**
9+ * Caches the enabled notices.
10+ *
11+ * @author Olaf Braun
12+ * @copyright 2001-2025 WoltLab GmbH
13+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
14+ * @since 6.3
15+ *
16+ * @extends AbstractEagerCache<array<int, Notice>>
17+ */
18+ final class NoticeCache extends AbstractEagerCache
19+ {
20+ #[\Override]
21+ protected function getCacheData (): array
22+ {
23+ $ noticeList = new NoticeList ();
24+ $ noticeList ->getConditionBuilder ()->add ('isDisabled = ? ' , [0 ]);
25+ $ noticeList ->getConditionBuilder ()->add ('isLegacy = ? ' , [0 ]);
26+ $ noticeList ->sqlOrderBy = 'showOrder ASC ' ;
27+ $ noticeList ->readObjects ();
28+
29+ return $ noticeList ->getObjects ();
30+ }
31+ }
Original file line number Diff line number Diff line change 66use Psr \Http \Message \ResponseInterface ;
77use Psr \Http \Message \ServerRequestInterface ;
88use wcf \data \notice \Notice ;
9- use wcf \data \notice \NoticeCache ;
109use wcf \data \notice \NoticeList ;
11- use wcf \system \cache \builder \ NoticeCacheBuilder ;
10+ use wcf \system \cache \eager \ NoticeCache ;
1211use wcf \system \endpoint \IController ;
1312use wcf \system \endpoint \PostRequest ;
1413use wcf \system \showOrder \ShowOrderHandler ;
@@ -63,6 +62,6 @@ private function saveShowOrder(array $items): void
6362 }
6463 WCF ::getDB ()->commitTransaction ();
6564
66- NoticeCacheBuilder:: getInstance ()-> reset ();
65+ ( new NoticeCache ())-> rebuild ();
6766 }
6867}
Original file line number Diff line number Diff line change 33namespace wcf \system \notice ;
44
55use wcf \data \notice \Notice ;
6- use wcf \system \cache \builder \ NoticeCacheBuilder ;
6+ use wcf \system \cache \eager \ NoticeCache ;
77use wcf \system \condition \ConditionHandler ;
88use wcf \system \condition \provider \combined \NoticeConditionProvider ;
99use wcf \system \condition \type \IGlobalConditionType ;
@@ -36,7 +36,7 @@ class NoticeHandler extends SingletonFactory
3636 */
3737 protected function init ()
3838 {
39- $ this ->notices = NoticeCacheBuilder:: getInstance ()-> getData ();
39+ $ this ->notices = ( new NoticeCache ())-> getCache ();
4040 }
4141
4242 /**
You can’t perform that action at this time.
0 commit comments