Skip to content

Commit

Permalink
add real updateNecessary condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Wappler committed Apr 2, 2024
1 parent ce2eb31 commit c1f2a5e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Classes/Updates/v12/RemoveDuplicateSysCategoryRecordMms.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,26 @@ public function executeUpdate(): bool
/**
* Is an update necessary?
*
* Looks for fe plugins in tt_content table to be migrated
*
* @return bool
* @throws Exception
*/
public function updateNecessary(): bool
{

$connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('sys_category_record_mm');

return true;
/** @var QueryBuilder $queryBuilder */
$queryBuilder = $connection->createQueryBuilder();
$statement = $queryBuilder->count('*')
->addSelect('uid_local', 'uid_foreign', 'tablenames', 'fieldname', 'sorting', 'sorting_foreign')
->from('sys_category_record_mm')
->groupBy('uid_local', 'uid_foreign', 'tablenames', 'fieldname')
->having('COUNT(*) > 1')
->executeQuery();
return $statement->rowCount() > 0;
}

/**
* Returns an array of class names of Prerequisite classes
*
* This way a wizard can define dependencies like "database up-to-date" or
* "reference index updated"
*
* @return string[]
*/
Expand Down

0 comments on commit c1f2a5e

Please sign in to comment.