diff --git a/lib/classes/patch/383alpha2a.php b/lib/classes/patch/383alpha2a.php new file mode 100644 index 0000000000..26edbd7594 --- /dev/null +++ b/lib/classes/patch/383alpha2a.php @@ -0,0 +1,68 @@ +release; + } + + /** + * {@inheritdoc} + */ + public function require_all_upgrades() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function concern() + { + return $this->concern; + } + + /** + * {@inheritdoc} + */ + public function apply(base $appbox, Application $app) + { + // Clean validation sessions where initiator_id does not exist anymore + $sql = 'SELECT DISTINCT(v.id) AS validation_session_id FROM `ValidationSessions` v LEFT JOIN usr u ON (v.initiator_id = u.usr_id) WHERE u.usr_id IS NULL'; + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + foreach ($rows as $row) { + if (null !== $vsession = $app['EM']->find('Entities\ValidationSession', $row['validation_session_id'])) { + $app['EM']->remove($vsession); + } + } + + $app['EM']->flush(); + + return true; + } +} diff --git a/templates/web/admin/collection/collection.html.twig b/templates/web/admin/collection/collection.html.twig index e001ef6ac1..366abf90cd 100644 --- a/templates/web/admin/collection/collection.html.twig +++ b/templates/web/admin/collection/collection.html.twig @@ -116,21 +116,21 @@