From 2ffed8c4d5d79fd64f6a3b77b08421867856b0da Mon Sep 17 00:00:00 2001 From: aynsix Date: Thu, 6 Feb 2020 17:34:57 +0300 Subject: [PATCH 1/2] patch to change data format geolocation --- lib/Alchemy/Phrasea/Core/Version.php | 2 +- lib/classes/patch/410alpha21a.php | 111 +++++++++++++++++++++++++++ 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 lib/classes/patch/410alpha21a.php diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php index c209691c0b..3a3ff63afc 100644 --- a/lib/Alchemy/Phrasea/Core/Version.php +++ b/lib/Alchemy/Phrasea/Core/Version.php @@ -16,7 +16,7 @@ class Version /** * @var string */ - private $number = '4.1.0-alpha.19a'; + private $number = '4.1.0-alpha.21a'; /** * @var string diff --git a/lib/classes/patch/410alpha21a.php b/lib/classes/patch/410alpha21a.php new file mode 100644 index 0000000000..58091e62f2 --- /dev/null +++ b/lib/classes/patch/410alpha21a.php @@ -0,0 +1,111 @@ +release; + } + + /** + * {@inheritdoc} + */ + public function concern() + { + return $this->concern; + } + + /** + * {@inheritdoc} + */ + public function require_all_upgrades() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return []; + } + + /** + * {@inheritdoc} + */ + public function apply(base $databox, Application $app) + { + // fix the Longitude value + + $sql = 'SELECT id, record_id, name, value FROM technical_datas WHERE trim(name) = "LongitudeRef" '; + $stmt = $databox->get_connection()->prepare($sql); + $stmt->execute(); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + foreach ($rs as $row) { + if (trim($row['value']) === 'W' ) { + $sql = 'UPDATE technical_datas SET value = CONCAT("-", value) WHERE trim(name) = "Longitude" AND record_id =:record_id'; + $stmt = $databox->get_connection()->prepare($sql); + $stmt->execute([':record_id' => $row['record_id']]); + } + + $sqlDelete = 'DELETE FROM technical_datas WHERE id =:id'; + + $stmt1 = $databox->get_connection()->prepare($sqlDelete); + $stmt1->execute([':id' => $row['id']]); + $stmt1->closeCursor(); + } + + $stmt->closeCursor(); + + // fix the Latitude value + + $sql = 'SELECT id, record_id, name, value FROM technical_datas WHERE trim(name) = "LatitudeRef" '; + $stmt = $databox->get_connection()->prepare($sql); + $stmt->execute(); + $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + foreach ($rs as $row) { + if (trim($row['value']) === 'S' ) { + $sql = 'UPDATE technical_datas SET value = CONCAT("-", value) WHERE trim(name) = "Latitude" AND record_id =:record_id'; + $stmt = $databox->get_connection()->prepare($sql); + $stmt->execute([':record_id' => $row['record_id']]); + } + + $sqlDelete = 'DELETE FROM technical_datas WHERE id =:id'; + + $stmt1 = $databox->get_connection()->prepare($sqlDelete); + $stmt1->execute([':id' => $row['id']]); + $stmt1->closeCursor(); + } + + $stmt->closeCursor(); + + return true; + } +} From 6c1f3c3e62a6005bbc2dcbd79b841eb22d6a2c65 Mon Sep 17 00:00:00 2001 From: aynsix Date: Thu, 6 Feb 2020 18:01:05 +0300 Subject: [PATCH 2/2] use phraseanet version 4.1.0-alpha.20a --- lib/Alchemy/Phrasea/Core/Version.php | 2 +- lib/classes/patch/{410alpha21a.php => 410alpha20a.php} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename lib/classes/patch/{410alpha21a.php => 410alpha20a.php} (96%) diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php index 3a3ff63afc..5f488cdd5a 100644 --- a/lib/Alchemy/Phrasea/Core/Version.php +++ b/lib/Alchemy/Phrasea/Core/Version.php @@ -16,7 +16,7 @@ class Version /** * @var string */ - private $number = '4.1.0-alpha.21a'; + private $number = '4.1.0-alpha.20a'; /** * @var string diff --git a/lib/classes/patch/410alpha21a.php b/lib/classes/patch/410alpha20a.php similarity index 96% rename from lib/classes/patch/410alpha21a.php rename to lib/classes/patch/410alpha20a.php index 58091e62f2..ff02a35c96 100644 --- a/lib/classes/patch/410alpha21a.php +++ b/lib/classes/patch/410alpha20a.php @@ -11,10 +11,10 @@ use Alchemy\Phrasea\Application; -class patch_410alpha21a implements patchInterface +class patch_410alpha20a implements patchInterface { /** @var string */ - private $release = '4.1.0-alpha.21a'; + private $release = '4.1.0-alpha.20a'; /** @var array */ private $concern = [base::DATA_BOX];