Skip to content

Commit 1e88c45

Browse files
Daniel BerthereauDaniel Berthereau
authored andcommitted
Released version 3.3.2-beta.
1 parent 4503303 commit 1e88c45

2 files changed

Lines changed: 46 additions & 2 deletions

File tree

config/module.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[info]
22
name = "Data Type Geometry"
3-
description = "Adds data types to store latitude, longitude, markers and area highlights of images and maps with wkt for modules Cartography and Mapping."
3+
description = "Adds data types to store latitude, longitude, markers and area highlights of images and maps with wkt."
44
tags = "geographic coordinates, geometry, geography, annotation, cartography"
55
license = "CeCILL-2.1"
66
author = "Daniel Berthereau for EHESS and Campus Condorcet"
77
author_link = "https://gitlab.com/Daniel-KM"
88
module_link = "https://gitlab.com/Daniel-KM/Omeka-S-module-DataTypeGeometry"
99
support_link = "https://gitlab.com/Daniel-KM/Omeka-S-module-DataTypeGeometry/-/issues"
1010
configurable = true
11-
version = "3.3.1.9"
11+
version = "3.3.2-beta"
1212
omeka_version_constraint = "^3.1.0"

data/scripts/upgrade.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,47 @@
6060
);
6161
$messenger->addWarning($message);
6262
}
63+
64+
if (version_compare($oldVersion, '3.4.2-beta', '<')) {
65+
$sqls = <<<'SQL'
66+
UPDATE value
67+
SET type = "geography"
68+
WHERE type = "geometry:geography";
69+
UPDATE value
70+
SET type = "geometry"
71+
WHERE type = "geometry:geometry";
72+
UPDATE value
73+
SET type = "geography:coordinates"
74+
WHERE type = "geometry:geography:coordinates";
75+
UPDATE value
76+
SET type = "geometry:coordinates"
77+
WHERE type = "geometry:geometry:coordinates";
78+
UPDATE value
79+
SET type = "geometry:position"
80+
WHERE type = "geometry:geometry:position";
81+
82+
ALTER TABLE `data_type_geography` CHANGE `value` `value` GEOMETRY NOT NULL COMMENT '(DC2Type:geography)';
83+
ALTER TABLE `data_type_geometry` CHANGE `value` `value` GEOMETRY NOT NULL COMMENT '(DC2Type:geometry)';
84+
SQL;
85+
foreach (array_filter(explode(";\n", $sqls)) as $sql) {
86+
$connection->executeStatement($sql);
87+
}
88+
89+
// \DataTypeGeometry\DataType\Geography::DEFAULT_SRID
90+
$defaultSrid = (int) $settings->get('datatypegeometry_locate_srid', 4326);
91+
$sql = <<<SQL
92+
UPDATE `data_type_geography`
93+
SET `value` = ST_SRID(`value`, $defaultSrid)
94+
WHERE ST_SRID(`value`) != $defaultSrid;
95+
SQL;
96+
$connection->executeStatement($sql);
97+
98+
$message = new Message(
99+
'Datatype names were simplified: "geometry", "geography", "geography:coordinates".' // @translate
100+
);
101+
$messenger->addWarning($message);
102+
$message = new Message(
103+
'Two new datatypes have been added to manage geometries: x/y coordinates ("geometry:coordinates") and position from top left ("geometry:position").' // @translate
104+
);
105+
$messenger->addSuccess($message);
106+
}

0 commit comments

Comments
 (0)