add glaicer sync option
This commit is contained in:
parent
9b73a2f6a3
commit
a92edd3c0d
|
@ -67,6 +67,26 @@ class Admin_DataController extends Zend_Controller_Action
|
||||||
$this->db->query("update metadata set source=? where uuid=?",array($gmd->source,$gmd->uuid));
|
$this->db->query("update metadata set source=? where uuid=?",array($gmd->source,$gmd->uuid));
|
||||||
}
|
}
|
||||||
$this->view->msg='成功同步黑河遥感综合实验元数据!';
|
$this->view->msg='成功同步黑河遥感综合实验元数据!';
|
||||||
|
}elseif ($source=="glacier" && empty($uuid) ) {
|
||||||
|
//首先删除所有的对应专题数据
|
||||||
|
$sql="delete from metadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier')";
|
||||||
|
$this->db->query($sql);
|
||||||
|
$sql="delete from responsible where id not in (select distinct(resid) from role)";
|
||||||
|
$this->db->query($sql);
|
||||||
|
//对所有的新数据增加评审状态
|
||||||
|
/*$sql="insert into mdstatus (uuid,status,ts_accepted,userid) select uuid,1,now(),?
|
||||||
|
from watergn where uuid not in (select uuid from mdstatus)";
|
||||||
|
$userid = Zend_Auth::getInstance()->getIdentity()->id;
|
||||||
|
$this->db->query($sql,array($userid));*/
|
||||||
|
//同步专题元数据
|
||||||
|
$sql="select uuid,data,source from geonetworkmetadata where schemaid='iso19115' and uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='glacier')";
|
||||||
|
$rs=$this->db->fetchAll($sql);
|
||||||
|
foreach($rs as $gmd) {
|
||||||
|
$this->import($gmd->data);
|
||||||
|
//source in unused now.
|
||||||
|
//$this->db->query("update metadata set source=? where uuid=?",array($gmd->source,$gmd->uuid));
|
||||||
|
}
|
||||||
|
$this->view->msg='成功同步专题元数据!';
|
||||||
} elseif ($source=="westdc" && empty($uuid) ) {
|
} elseif ($source=="westdc" && empty($uuid) ) {
|
||||||
//从westdc向geonetwork同步
|
//从westdc向geonetwork同步
|
||||||
$sql="select m.uuid,m.source,x.data from metadata m left join xml x on m.id=x.id where m.uuid not in (select uuid from geonetworkmetadata)";
|
$sql="select m.uuid,m.source,x.data from metadata m left join xml x on m.id=x.id where m.uuid not in (select uuid from geonetworkmetadata)";
|
||||||
|
@ -965,13 +985,13 @@ class Admin_DataController extends Zend_Controller_Action
|
||||||
$link=$this->db->quote($link);
|
$link=$this->db->quote($link);
|
||||||
$sql="insert into reference (reference,link) values(?,".$link.")";
|
$sql="insert into reference (reference,link) values(?,".$link.")";
|
||||||
try {
|
try {
|
||||||
$this->db->exec($this->db->quoteInto($sql,$data[1]));
|
$this->db->exec($this->db->quoteInto($sql,trim($data[1])));
|
||||||
} catch (Exception $e) {}
|
} catch (Exception $e) {}
|
||||||
$sql="select id from reference where reference=?";
|
$sql="select id from reference where reference=?";
|
||||||
$row=$this->db->fetchRow($this->db->quoteInto($sql,$data[1]));
|
$row=$this->db->fetchRow($this->db->quoteInto($sql,trim($data[1])));
|
||||||
$sql="insert into mdref (uuid,refid) values(?,".$row['id'].")";
|
$sql="insert into mdref (uuid,refid) values(?,".$row['id'].")";
|
||||||
try {
|
try {
|
||||||
$this->db->exec($this->db->quoteInto($sql,$data[0]));
|
$this->db->exec($this->db->quoteInto($sql,trim($data[0])));
|
||||||
} catch (Exception $e) {}
|
} catch (Exception $e) {}
|
||||||
}
|
}
|
||||||
}//end if
|
}//end if
|
||||||
|
|
Loading…
Reference in New Issue