From c3a2a71105cfe638d16ee3adfc5b4e3aa1e0ccbb Mon Sep 17 00:00:00 2001 From: aina esokia Date: Mon, 7 Dec 2020 16:09:37 +0300 Subject: [PATCH] PHRAS-3276 update log_docs action push and validate --- lib/classes/patch/413.php | 79 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 lib/classes/patch/413.php diff --git a/lib/classes/patch/413.php b/lib/classes/patch/413.php new file mode 100644 index 0000000000..e4c2e43930 --- /dev/null +++ b/lib/classes/patch/413.php @@ -0,0 +1,79 @@ +release; + } + + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return []; + } + + /** + * {@inheritdoc} + */ + public function require_all_upgrades() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function concern() + { + return $this->concern; + } + + /** + * {@inheritdoc} + */ + public function apply(base $databox, Application $app) + { + // add a new temp action + $sql = "ALTER TABLE log_docs CHANGE action action ENUM('push','add','validate','edit','collection','status','print','substit','publish','download','mail','ftp','delete','to_do','') CHARACTER SET ascii COLLATE ascii_bin NOT NULL"; + $stmt = $databox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + $sql = "UPDATE log_docs SET action = 'to_do' where action = 'push'"; + $stmt = $databox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + $sql = "UPDATE log_docs SET action = 'push' where action = 'validate'"; + $stmt = $databox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + $sql = "UPDATE log_docs SET action = 'validate' where action = 'to_do'"; + $stmt = $databox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + // remove temp action + $sql = "ALTER TABLE log_docs CHANGE action action ENUM('push','add','validate','edit','collection','status','print','substit','publish','download','mail','ftp','delete','') CHARACTER SET ascii COLLATE ascii_bin NOT NULL"; + $stmt = $databox->get_connection()->prepare($sql); + $stmt->execute(); + $stmt->closeCursor(); + + return true; + } +}