diff --git a/.editorconfig b/.editorconfig
index fbddd4b..026c030 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -50,3 +50,20 @@ indent_style = tab
# phpstan.neon
[*.neon]
indent_style = tab
+
+# Ignore paths
+[/var/**]
+charset = unset
+end_of_line = unset
+insert_final_newline = unset
+trim_trailing_whitespace = unset
+indent_style = unset
+indent_size = unset
+
+[package-lock.json]
+charset = unset
+end_of_line = unset
+insert_final_newline = unset
+trim_trailing_whitespace = unset
+indent_style = unset
+indent_size = unset
diff --git a/Classes/Backend/ToolbarItems/UpdateItem.php b/Classes/Backend/ToolbarItems/UpdateItem.php
deleted file mode 100644
index d466aa0..0000000
--- a/Classes/Backend/ToolbarItems/UpdateItem.php
+++ /dev/null
@@ -1,116 +0,0 @@
-setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:' . Configuration::EXT_KEY
- . '/Resources/Private/Templates/Backend/ToolbarItems/UpdateItem.html'));
- return $view->assignMultiple([
- 'count' => count($this->getRelevantUpdates()),
- ])->render();
- }
-
- /**
- * TRUE if this toolbar item has a collapsible drop down
- *
- * @return bool
- */
- public function hasDropDown(): bool
- {
- return true;
- }
-
- /**
- * Render "drop down" part of this toolbar
- *
- * @return string Drop down HTML
- */
- public function getDropDown(): string
- {
- $view = GeneralUtility::makeInstance(StandaloneView::class);
- $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:' . Configuration::EXT_KEY
- . '/Resources/Private/Templates/Backend/ToolbarItems/UpdateItemDropDown.html'));
- $view->setPartialRootPaths([
- GeneralUtility::getFileAbsFileName('EXT:' . Configuration::EXT_KEY . '/Resources/Private/Partials/'),
- ]);
- return $view->assignMultiple([
- 'data' => $this->getRelevantUpdates(),
- ])->render();
- }
-
- /**
- * Returns an array with additional attributes added to containing
tag of the item.
- *
- * Typical usages are additional css classes and data-* attributes, classes may be merged
- * with other classes needed by the framework. Do NOT set an id attribute here.
- *
- * array(
- * 'class' => 'my-class',
- * 'data-foo' => '42',
- * )
- *
- * @return array List item HTML attributes
- */
- public function getAdditionalAttributes(): array
- {
- return [];
- }
-
- /**
- * Returns an integer between 0 and 100 to determine
- * the position of this item relative to others
- *
- * By default, extensions should return 50 to be sorted between main core
- * items and other items that should be on the very right.
- *
- * @return int 0 .. 100
- */
- public function getIndex(): int
- {
- return 50;
- }
-
- private function getRelevantUpdates(): array
- {
- $cacheIdentifier = sha1('contentplanner_toolbarcache' . $GLOBALS['BE_USER']->user['uid']);
- $data = $this->cache->get($cacheIdentifier);
- if ($data === false) {
- // Store the data in cache
- $data = $this->contentUpdateDataProvider->fetchUpdateData(true, maxItems: 5);
- $this->cache->set($cacheIdentifier, $data, ['ximatypo3contentplanner_toolbarcache'], 300);
- }
-
- return $data ?: [];
- }
-}
diff --git a/Classes/Command/NotifyUpdateCommand.php b/Classes/Command/NotifyUpdateCommand.php
deleted file mode 100644
index a7720ce..0000000
--- a/Classes/Command/NotifyUpdateCommand.php
+++ /dev/null
@@ -1,102 +0,0 @@
- 86400,
- 'weekly' => 604800,
- ];
-
- public function __construct(private readonly ContentUpdateDataProvider $contentUpdateDataProvider)
- {
- parent::__construct();
- }
-
- protected function configure(): void
- {
- $this
- ->setHelp('A command to notify users about relevant updates in the content planner.');
- }
-
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $backendUserRepository = GeneralUtility::makeInstance(BackendUserRepository::class);
-
- // ToDo: only regard users with access to the content planner
- foreach ($backendUserRepository->findAll() as $user) {
- if ($user->getEmail() === '' || !(bool)$user->getSubscribe() || ($user->getLastMail() + self::SUBSCRIBE_FREQUENCY[$user->getSubscribe()]) > time()) {
- continue;
- }
- $output->writeln('Checking updates for user ' . $user->getUsername() . ' ...');
-
- $since = time() - (int)self::SUBSCRIBE_FREQUENCY[$user->getSubscribe()];
-
- $updates = $this->contentUpdateDataProvider->fetchUpdateData(false, null, $since, null, true);
- if (count($updates) > 0) {
- $output->writeln('User ' . $user->getUsername() . ' has ' . count($updates) . ' updates.');
- $result = $this->notify($user, $updates);
-
- if ($result) {
- $user->setLastMail(time());
- $backendUserRepository->update($user);
- // ToDo: why isn't the user updated?
- }
- }
- }
-
- return Command::SUCCESS;
- }
-
- private function notify(BackendUser $user, array $updates): bool
- {
- $siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
- $array = $siteFinder->getAllSites();
- $site = reset($array);
-
- $view = GeneralUtility::makeInstance(StandaloneView::class);
- /** @var StandaloneView $view */
- $view->setTemplatePathAndFilename('EXT:' . Configuration::EXT_KEY . '/Resources/Private/Templates/Email/ContentUpdates.html');
-
- $view->setTemplateRootPaths(['EXT:' . Configuration::EXT_KEY . '/Resources/Private/Templates/']);
- $view->setPartialRootPaths(['EXT:' . Configuration::EXT_KEY . '/Resources/Private/Partials/']);
- $view->setLayoutRootPaths(['EXT:' . Configuration::EXT_KEY . '/Resources/Private/Layouts/']);
-
- $view->assignMultiple(
- [
- 'data' => $updates,
- 'user' => $user,
- 'backendUrl' => $site->getBase()->__toString() . '/typo3',
- ]
- );
-
- $email = new MailMessage();
- $email
- ->to(new Address($user->getEmail(), $user->getUsername()))
- ->subject('TYPO3 Content Planner Updates')
- ->html(
- // workaround: to resolve the base url in the email
- str_replace('href="', 'href="' . $site->getBase()->__toString() . '/', $view->render())
- );
- GeneralUtility::makeInstance(MailerInterface::class)->send($email);
-
- return true;
- }
-}
diff --git a/Classes/Utility/ContentUtility.php b/Classes/Utility/ContentUtility.php
index 121fc45..a5ee5a2 100644
--- a/Classes/Utility/ContentUtility.php
+++ b/Classes/Utility/ContentUtility.php
@@ -29,19 +29,6 @@ public static function getPage(int $pageId): array|bool
return $pageRepository->getPage($pageId);
}
- public static function getAssignedPages(): array|bool
- {
- $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
-
- return $queryBuilder
- ->select('*')
- ->from('pages')
- ->where(
- $queryBuilder->expr()->eq('tx_ximatypo3contentplanner_assignee', $queryBuilder->createNamedParameter($GLOBALS['BE_USER']->user['uid'], \TYPO3\CMS\Core\Database\Connection::PARAM_INT))
- )
- ->executeQuery()->fetchAllAssociative();
- }
-
public static function getRecordsByFilter(?string $search = null, ?int $status = null, ?int $assignee = null, ?string $type = null, int $maxResults = 20): array|bool
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
diff --git a/Classes/Widgets/Provider/ContentUpdateDataProvider.php b/Classes/Widgets/Provider/ContentUpdateDataProvider.php
index 5c168ca..a669ba0 100644
--- a/Classes/Widgets/Provider/ContentUpdateDataProvider.php
+++ b/Classes/Widgets/Provider/ContentUpdateDataProvider.php
@@ -9,7 +9,6 @@
use TYPO3\CMS\Dashboard\Widgets\ListDataProviderInterface;
use Xima\XimaTypo3ContentPlanner\Configuration;
use Xima\XimaTypo3ContentPlanner\Domain\Model\Dto\HistoryItem;
-use Xima\XimaTypo3ContentPlanner\Utility\ContentUtility;
class ContentUpdateDataProvider implements ListDataProviderInterface
{
@@ -21,7 +20,7 @@ public function getItems(): array
return $this->fetchUpdateData(maxItems: 15);
}
- public function fetchUpdateData(bool $relevanteUpdatesForCurrentUser = false, ?int $beUser = null, ?int $tstamp = null, ?int $maxItems = null, bool $cliContext = false): array
+ public function fetchUpdateData(?int $beUser = null, ?int $tstamp = null, ?int $maxItems = null, bool $cliContext = false): array
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_history');
@@ -52,14 +51,6 @@ public function fetchUpdateData(bool $relevanteUpdatesForCurrentUser = false, ?i
$query->setMaxResults($maxItems*2);
}
- // Filter for relevant history entries, which are not created by the current user
- if ($relevanteUpdatesForCurrentUser) {
- $query
- ->andWhere('h.userid != :userid')
- ->andWhere('p.tx_ximatypo3contentplanner_assignee = :userid')
- ->setParameter('userid', $beUser ?: $GLOBALS['BE_USER']->user['uid']);
- }
-
if ($tstamp) {
$query->andWhere('h.tstamp > :tstamp')
->setParameter('tstamp', $tstamp);
@@ -76,16 +67,6 @@ public function fetchUpdateData(bool $relevanteUpdatesForCurrentUser = false, ?i
}
}
- if ($relevanteUpdatesForCurrentUser) {
- $additionalItems = $this->getRecentRelevantCommentsForUser($beUser);
- $items = array_merge($items, $additionalItems);
-
- // sort by tstamp
- usort($items, function ($a, $b) {
- return $b->data['tstamp'] <=> $a->data['tstamp'];
- });
- }
-
foreach ($items as $key => $item) {
if ($item->getHistoryData() === '') {
unset($items[$key]);
@@ -98,50 +79,4 @@ public function fetchUpdateData(bool $relevanteUpdatesForCurrentUser = false, ?i
return $items;
}
-
- /*
- * It's a workaround to fetch all comments and afterwards filter them by assigned pages, because this information is serialized and cannot be filtered within the query
- */
- private function getRecentRelevantCommentsForUser(?int $beUser = null): array
- {
- $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_history');
-
- $query = $queryBuilder
- ->select(
- 'h.uid',
- 'h.tstamp as tstamp',
- 'h.recuid as recuid',
- 'h.userid as userid',
- 'h.actiontype as actiontype',
- 'h.tablename as tablename',
- 'h.history_data as history_data',
- 'b.username as username',
- )
- ->from('sys_history', 'h')
- ->leftJoin('h', 'be_users', 'b', 'h.userid = b.uid')
- ->andWhere('h.userid != :userid')
- ->andWhere('h.tablename = "tx_ximatypo3contentplanner_comment"')
- ->orderBy('h.tstamp', 'DESC')
- ->setParameter('userid', $beUser ?: $GLOBALS['BE_USER']->user['uid']);
-
- $assignedPages = ContentUtility::getAssignedPages();
- // only get uids from assigned pages
- $uids = array_map(function ($page) {
- return $page['uid'];
- }, $assignedPages);
-
- $items = [];
- $results = $query->executeQuery()
- ->fetchAllAssociative();
-
- foreach ($results as $result) {
- try {
- if (!is_null($result['history_data']) && in_array(json_decode($result['history_data'], true)['pid'], $uids)) {
- $items[] = HistoryItem::create($result);
- }
- } catch (\Exception $e) {
- }
- }
- return $items;
- }
}
diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml
index 8043c1c..83dcaf5 100644
--- a/Configuration/Services.yaml
+++ b/Configuration/Services.yaml
@@ -8,15 +8,6 @@ services:
resource: '../Classes/*'
exclude: '../Classes/Domain/Model/*'
- cache.ximatypo3contentplanner_toolbarcache:
- class: TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
- factory: [ '@TYPO3\CMS\Core\Cache\CacheManager', 'getCache' ]
- arguments: [ 'ximatypo3contentplanner_toolbarcache' ]
-
- Xima\XimaTypo3ContentPlanner\Backend\ToolbarItems\UpdateItem:
- arguments:
- $cache: '@cache.ximatypo3contentplanner_toolbarcache'
-
Xima\XimaTypo3ContentPlanner\EventListener\DrawBackendHeaderListener:
tags:
- name: event.listener
@@ -42,12 +33,6 @@ services:
- name: event.listener
identifier: 'xima-typo3-content-planner/backend/modify-record-list-record-actions'
- Xima\XimaTypo3ContentPlanner\Command\NotifyUpdateCommand:
- tags:
- - name: console.command
- command: 'content-planner:notifiy-update'
- description: 'A command to notify users about relevant updates in the content planner.'
-
Xima\XimaTypo3ContentPlanner\Command\BulkUpdateCommand:
tags:
- name: console.command
diff --git a/ext_localconf.php b/ext_localconf.php
index a028377..8ecfb16 100644
--- a/ext_localconf.php
+++ b/ext_localconf.php
@@ -12,8 +12,6 @@
$GLOBALS['TYPO3_CONF_VARS']['BE']['toolbarItems'][1719820170] = \Xima\XimaTypo3ContentPlanner\Backend\ToolbarItems\UpdateItem::class;
-$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['ximatypo3contentplanner_toolbarcache'] ??= [];
-
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['templateRootPaths'][486] = 'EXT:xima_typo3_content_planner/Resources/Private/Templates/Email/';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = \Xima\XimaTypo3ContentPlanner\Hooks\DataHandlerHook::class;
@@ -24,5 +22,3 @@
// Feature toggles
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][Configuration::EXT_KEY]['features']['autoAssignment'] = true;
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][Configuration::EXT_KEY]['features']['autoUnassignment'] = true;
-
-$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][Configuration::EXT_KEY]['features']['relevantUpdates'] = false;
diff --git a/php-cs-fixer.php b/php-cs-fixer.php
index 9b70a45..06dd6c7 100644
--- a/php-cs-fixer.php
+++ b/php-cs-fixer.php
@@ -1,4 +1,5 @@