[Mapbender-commits] r9987 - trunk/mapbender/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Nov 2 02:06:19 PDT 2018
Author: armin11
Date: 2018-11-02 02:06:19 -0700 (Fri, 02 Nov 2018)
New Revision: 9987
Modified:
trunk/mapbender/http/classes/class_iso19139.php
Log:
Option to allow the bulk update of external metadata records without changing their owner and organization
Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php 2018-10-29 15:36:38 UTC (rev 9986)
+++ trunk/mapbender/http/classes/class_iso19139.php 2018-11-02 09:06:19 UTC (rev 9987)
@@ -2264,19 +2264,20 @@
return $dlArray;
}
- public function updateMetadataById($metadataId) {
+ public function updateMetadataById($metadataId, $changeAuthorization=true) {
$e = new mb_notice("update metadata id: ".$metadataId);
//check if the timestamp of an existing metadata element is not newer than the timestamp of the current metadata object!!!!
//TODO
//problem: <<<SQL have a limited number of chars!
- $sql = "UPDATE mb_metadata SET link = $1, origin = $18, md_format = $2, data = $3, ";
- $sql .= "linktype = $4, uuid = $5, title = $6, createdate = $7, changedate = $8, lastchanged = now(), ";
- $sql .= "abstract = $9, searchtext = $10, type = $11, tmp_reference_1 = $12, tmp_reference_2 = $13, export2csw = $14, datasetid = $15, ";
- $sql .= "datasetid_codespace = $16, randomid = $17, harvestresult = $20, harvestexception = $21, lineage = $22, inspire_top_consistence = $23, ";
- $sql .= "spatial_res_type = $24, spatial_res_value = $25, update_frequency = $26, format = $27, inspire_charset = $28, ref_system = $29, the_geom = $30, datalinks = $31, inspire_whole_area = $32, inspire_actual_coverage = $33, inspire_download = $34, bounding_geom = $35, transfer_size = $36, fees = $37, md_license_source_note = $38, constraints = $39, responsible_party_name = $40, responsible_party_email = $41, preview_image = $42, fkey_mb_group_id = $43, md_proxy = $44, inspire_interoperability = $45, searchable = $46 WHERE metadata_id = $19";
- //$e= new mb_exception("class_iso19139.php: downloadLinks json".$this->jsonEncodeDownloadLinks($this->downloadLinks));
- //$e= new mb_exception("class_iso19139.php: downloadLinks[0]".$this->downloadLinks[0]);
- $v = array(
+ if ($changeAuthorization == true) {
+ $sql = "UPDATE mb_metadata SET link = $1, origin = $18, md_format = $2, data = $3, ";
+ $sql .= "linktype = $4, uuid = $5, title = $6, createdate = $7, changedate = $8, lastchanged = now(), ";
+ $sql .= "abstract = $9, searchtext = $10, type = $11, tmp_reference_1 = $12, tmp_reference_2 = $13, export2csw = $14, datasetid = $15, ";
+ $sql .= "datasetid_codespace = $16, randomid = $17, harvestresult = $20, harvestexception = $21, lineage = $22, inspire_top_consistence = $23, ";
+ $sql .= "spatial_res_type = $24, spatial_res_value = $25, update_frequency = $26, format = $27, inspire_charset = $28, ref_system = $29, the_geom = $30, datalinks = $31, inspire_whole_area = $32, inspire_actual_coverage = $33, inspire_download = $34, bounding_geom = $35, transfer_size = $36, fees = $37, md_license_source_note = $38, constraints = $39, responsible_party_name = $40, responsible_party_email = $41, preview_image = $42, fkey_mb_group_id = $43, md_proxy = $44, inspire_interoperability = $45, searchable = $46 WHERE metadata_id = $19";
+ //$e= new mb_exception("class_iso19139.php: downloadLinks json".$this->jsonEncodeDownloadLinks($this->downloadLinks));
+ //$e= new mb_exception("class_iso19139.php: downloadLinks[0]".$this->downloadLinks[0]);
+ $v = array(
$this->href,
$this->format,
$this->metadata,
@@ -2324,10 +2325,70 @@
$this->mdProxy,
$this->inspireInteroperability,
$this->searchable
- );
- //$e = new mb_exception("class_iso19139: ".$this->createWktBboxFromArray($this->wgs84Bbox));
- $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d','s','s','s','s','s','s','i','b','b','b');
- $res = db_prep_query($sql,$v,$t);
+ );
+ //$e = new mb_exception("class_iso19139: ".$this->createWktBboxFromArray($this->wgs84Bbox));
+ $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d','s','s','s','s','s','s','i','b','b','b');
+ $res = db_prep_query($sql,$v,$t);
+ } else { //do the update without changing owner and fkey_mb_group_id!
+ $sql = "UPDATE mb_metadata SET link = $1, origin = $18, md_format = $2, data = $3, ";
+ $sql .= "linktype = $4, uuid = $5, title = $6, createdate = $7, changedate = $8, lastchanged = now(), ";
+ $sql .= "abstract = $9, searchtext = $10, type = $11, tmp_reference_1 = $12, tmp_reference_2 = $13, export2csw = $14, datasetid = $15, ";
+ $sql .= "datasetid_codespace = $16, randomid = $17, harvestresult = $20, harvestexception = $21, lineage = $22, inspire_top_consistence = $23, ";
+ $sql .= "spatial_res_type = $24, spatial_res_value = $25, update_frequency = $26, format = $27, inspire_charset = $28, ref_system = $29, the_geom = $30, datalinks = $31, inspire_whole_area = $32, inspire_actual_coverage = $33, inspire_download = $34, bounding_geom = $35, transfer_size = $36, fees = $37, md_license_source_note = $38, constraints = $39, responsible_party_name = $40, responsible_party_email = $41, preview_image = $42, md_proxy = $43, inspire_interoperability = $44, searchable = $45 WHERE metadata_id = $19";
+ //$e= new mb_exception("class_iso19139.php: downloadLinks json".$this->jsonEncodeDownloadLinks($this->downloadLinks));
+ //$e= new mb_exception("class_iso19139.php: downloadLinks[0]".$this->downloadLinks[0]);
+ $v = array(
+ $this->href,
+ $this->format,
+ $this->metadata,
+ $this->type,
+ $this->fileIdentifier, // is the old one! or not?
+ $this->title,
+ $this->createDate,
+ $this->changeDate,
+ $this->abstract,
+ $this->keywords[0],
+ $this->hierachyLevel,
+ $this->tmpExtentBegin,
+ $this->tmpExtentEnd,
+ $this->export2Csw,
+ $this->datasetId,
+ $this->datasetIdCodeSpace,
+ $this->randomId,
+ $this->origin,
+ //$this->owner, //owner is the old one - maybe here we have something TODO!
+ $metadataId, //The first metadataId which was found will be selected!
+ $this->harvestResult,
+ $this->harvestException,
+ $this->lineage,
+ $this->inspireTopConsistence,
+ $this->spatialResType,
+ $this->spatialResValue,
+ $this->updateFrequency,
+ $this->dataFormat,
+ $this->inspireCharset,
+ $this->refSystem,
+ $this->createWktBboxFromArray($this->wgs84Bbox),
+ $this->jsonEncodeDownloadLinks($this->downloadLinks),
+ $this->inspireWholeArea,
+ $this->inspireActualCoverage,
+ $this->inspireDownload,
+ $this->createWktPolygonFromPointArray($this->polygonalExtentExterior),
+ $this->transferSize,
+ $this->fees,
+ $this->licenseSourceNote,
+ $this->accessConstraints,
+ $this->resourceResponsibleParty,
+ $this->resourceContactEmail,
+ $this->previewImage,
+ $this->mdProxy,
+ $this->inspireInteroperability,
+ $this->searchable
+ );
+ //$e = new mb_exception("class_iso19139: ".$this->createWktBboxFromArray($this->wgs84Bbox));
+ $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d','s','s','s','s','s','s','b','b','b');
+ $res = db_prep_query($sql,$v,$t);
+ }
return $res;
}
More information about the Mapbender_commits
mailing list