添加元数据错误检查功能
This commit is contained in:
parent
64504bb861
commit
7e87fc1768
|
@ -1814,7 +1814,14 @@ class AuthorController extends Zend_Controller_Action
|
|||
{
|
||||
//导入元数据
|
||||
$iso=new ISO19115();
|
||||
@$iso->saveDB($this->db,$row['xml']);
|
||||
@$iso->loadXML($row['xml']);
|
||||
if ($iso->validate())
|
||||
{
|
||||
$data=array("error"=>"元数据导入过程中发现错误。<br />".implode("<br />",$iso->error));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
@$iso->saveDB($this->db);
|
||||
//进入评审库
|
||||
$sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from mdversion where id=?";
|
||||
$this->db->query($sql,array($u_id,$id));
|
||||
|
@ -1868,7 +1875,15 @@ class AuthorController extends Zend_Controller_Action
|
|||
} else { //说明是已发布的数据且数据不存在评审信息
|
||||
//同步元数据
|
||||
$iso=new ISO19115();
|
||||
@$iso->saveDB($this->db,$row['xml']);
|
||||
@$iso->loadXML($row['xml']);
|
||||
if ($iso->validate())
|
||||
{
|
||||
$data=array("error"=>"元数据导入过程中发现错误。<br />".implode("<br />",$iso->error));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
@$iso->saveDB($this->db);
|
||||
|
||||
//移除中间版本
|
||||
$sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null";
|
||||
$this->db->query($sql,array($id));
|
||||
|
@ -1907,7 +1922,15 @@ class AuthorController extends Zend_Controller_Action
|
|||
{
|
||||
//同步元数据
|
||||
$iso=new ISO19115();
|
||||
@$iso->saveDB($this->db,$row['xml']);
|
||||
@$iso->loadXML($row['xml']);
|
||||
if ($iso->validate())
|
||||
{
|
||||
$data=array("error"=>"元数据导入过程中发现错误。<br />".implode("<br />",$iso->error));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
@$iso->saveDB($this->db);
|
||||
|
||||
//email to admin
|
||||
$mail=new WestdcMailer($this->view->config->smtp);
|
||||
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
||||
|
@ -2036,7 +2059,15 @@ class AuthorController extends Zend_Controller_Action
|
|||
{
|
||||
//同步元数据
|
||||
$iso=new ISO19115();
|
||||
@$iso->saveDB($this->db,$row['xml']);
|
||||
@$iso->loadXML($row['xml']);
|
||||
if ($iso->validate())
|
||||
{
|
||||
$data=array("error"=>"元数据导入过程中发现错误。<br />".implode("<br />",$iso->error));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
@$iso->saveDB($this->db);
|
||||
|
||||
//移除中间版本
|
||||
$sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null";
|
||||
$this->db->query($sql,array($id));
|
||||
|
@ -2266,6 +2297,16 @@ class AuthorController extends Zend_Controller_Action
|
|||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
//首先检查元数据错误
|
||||
$iso=new ISO19115();
|
||||
@$iso->loadXML($row['data']);
|
||||
if ($iso->validate())
|
||||
{
|
||||
$data=array("error"=>"元数据导入过程中发现错误。<br />".implode("<br />",$iso->error));
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 保存数据作者信息
|
||||
$sql="insert into mdauthor (uuid,userid,ts_activated,status) values(?,?,now(),1)";
|
||||
$this->db->query($sql,array($row['uuid'],$u_id));
|
||||
|
@ -2276,8 +2317,7 @@ class AuthorController extends Zend_Controller_Action
|
|||
file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid='".$row['uuid']."'&filelist=1");
|
||||
// 3. 保存数据评审状态
|
||||
//导入元数据
|
||||
$iso=new ISO19115();
|
||||
@$iso->saveDB($this->db,$row['data']);
|
||||
@$iso->saveDB($this->db);
|
||||
//进入评审库
|
||||
$sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from geonetworkmetadata where id=?";
|
||||
$this->db->query($sql,array($u_id,$id));
|
||||
|
|
Loading…
Reference in New Issue