From d58d74d5fc30034150801807c9056acf93b9d7ed Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Fri, 6 Dec 2013 17:01:46 +0100 Subject: [PATCH] Fix #1613 Can not launch lightbox --- lib/Alchemy/Phrasea/Core/Version.php | 2 +- lib/classes/patch/383alpha2a.php | 68 ++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 lib/classes/patch/383alpha2a.php diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php index 1aa849b74b..0de30582bb 100644 --- a/lib/Alchemy/Phrasea/Core/Version.php +++ b/lib/Alchemy/Phrasea/Core/Version.php @@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core; */ class Version { - protected static $number = '3.8.3-alpha.1'; + protected static $number = '3.8.3-alpha.2'; protected static $name = 'Diplodocus'; public static function getNumber() 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; + } +}