change version control to en schema.

This commit is contained in:
wlx 2014-05-10 06:15:08 +00:00
parent 56f501da6c
commit 6786e739b0
2 changed files with 19 additions and 19 deletions

View File

@ -2322,7 +2322,7 @@ class Admin_DataController extends Zend_Controller_Action
if (!empty($uuid) && empty($ac)) if (!empty($uuid) && empty($ac))
{ {
//view the versions of the data //view the versions of the data
$sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname,g.id as gid FROM mdversion v $sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname,g.id as gid FROM en.mdversion v
LEFT JOIN en.metadata md ON md.uuid=v.uuid LEFT JOIN en.metadata md ON md.uuid=v.uuid
left join users u on v.userid=u.id left join users u on v.userid=u.id
left join en.geonetworkmetadata g on md.uuid=g.uuid left join en.geonetworkmetadata g on md.uuid=g.uuid
@ -2345,7 +2345,7 @@ class Admin_DataController extends Zend_Controller_Action
//查看所有版本列表 //查看所有版本列表
else if((empty($ac) && empty($uuid))|| $ac=='list') else if((empty($ac) && empty($uuid))|| $ac=='list')
{ {
$sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname FROM mdversion v $sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname FROM en.mdversion v
LEFT JOIN en.metadata md ON md.uuid=v.uuid LEFT JOIN en.metadata md ON md.uuid=v.uuid
left join users u on v.userid=u.id left join users u on v.userid=u.id
WHERE md.title IS NOT NULL WHERE md.title IS NOT NULL
@ -2369,7 +2369,7 @@ class Admin_DataController extends Zend_Controller_Action
$keywords = $this->_request->getParam('q'); $keywords = $this->_request->getParam('q');
if(!empty($keywords)) if(!empty($keywords))
$this->view->q = $keywords; $this->view->q = $keywords;
$sql = "SELECT md.title,md.uuid,count(v.id) as c FROM mdversion v $sql = "SELECT md.title,md.uuid,count(v.id) as c FROM en.mdversion v
LEFT JOIN en.metadata md ON md.uuid=v.uuid LEFT JOIN en.metadata md ON md.uuid=v.uuid
WHERE md.title IS NOT NULL"; WHERE md.title IS NOT NULL";
if(!empty($keywords)) if(!empty($keywords))
@ -2412,7 +2412,7 @@ class Admin_DataController extends Zend_Controller_Action
return true; return true;
} }
$sql = "DELETE FROM mdversion WHERE id=?"; $sql = "DELETE FROM en.mdversion WHERE id=?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$ex = $sth -> execute(array($id)); $ex = $sth -> execute(array($id));
@ -2453,7 +2453,7 @@ class Admin_DataController extends Zend_Controller_Action
} }
$this->wdb=Zend_Db::factory($this->view->config->geonetwork); $this->wdb=Zend_Db::factory($this->view->config->geonetwork);
$sql = "SELECT v.xml,v.uuid FROM mdversion v $sql = "SELECT v.xml,v.uuid FROM en.mdversion v
WHERE v.id=?"; WHERE v.id=?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth ->execute(array($id)); $sth ->execute(array($id));
@ -2521,17 +2521,17 @@ class Admin_DataController extends Zend_Controller_Action
// 1. 权限认定 --skip // 1. 权限认定 --skip
// 2. 保存变化记录 save changelog & userid // 2. 保存变化记录 save changelog & userid
$sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id=?"; $sql = "UPDATE en.mdversion SET changelog=?,userid=? WHERE id=?";
$this->db->query($sql,array($changelog,$u_id,$id)); $this->db->query($sql,array($changelog,$u_id,$id));
// 3. 获取数据评审状态 // 3. 获取数据评审状态
$sql = "SELECT s.*,v.xml,m.title FROM mdstatus s left join mdversion v on s.uuid=v.uuid $sql = "SELECT s.*,v.xml,m.title FROM en.mdstatus s left join en.mdversion v on s.uuid=v.uuid
left join en.metadata m on s.uuid=m.uuid WHERE v.id=?"; left join en.metadata m on s.uuid=m.uuid WHERE v.id=?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($id)); $sth->execute(array($id));
$row = $sth->fetch(); $row = $sth->fetch();
$sql="select * from xunsearch where uuid=?"; $sql="select * from en.xunsearch where uuid=?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($row['uuid'])); $sth->execute(array($row['uuid']));
$data_search = $sth->fetch(); $data_search = $sth->fetch();
@ -2540,7 +2540,7 @@ class Admin_DataController extends Zend_Controller_Action
if (empty($row)) //无对应记录 if (empty($row)) //无对应记录
{ {
$sql="select m.id from en.metadata m left join mdversion v on m.uuid=v.uuid where v.id=?"; $sql="select m.id from en.metadata m left join en.mdversion v on m.uuid=v.uuid where v.id=?";
$sth=$this->db->prepare($sql); $sth=$this->db->prepare($sql);
$sth->execute(array($id)); $sth->execute(array($id));
$mrow=$sth->fetch(); $mrow=$sth->fetch();
@ -2550,7 +2550,7 @@ class Admin_DataController extends Zend_Controller_Action
$iso=new ISO19115(); $iso=new ISO19115();
$iso->saveDB($this->db,$row['xml']); $iso->saveDB($this->db,$row['xml']);
//进入评审库 //进入评审库
$sql="insert into mdstatus (uuid,status,userid) select uuid,0,? from mdversion where id=?"; $sql="insert into en.mdstatus (uuid,status,userid) select uuid,0,? from en.mdversion where id=?";
$this->db->query($sql,array($u_id,$id)); $this->db->query($sql,array($u_id,$id));
//email to admin //email to admin
@ -2604,10 +2604,10 @@ class Admin_DataController extends Zend_Controller_Action
$iso=new ISO19115(); $iso=new ISO19115();
$iso->saveDB($this->db,$row['xml']); $iso->saveDB($this->db,$row['xml']);
//移除中间版本 //移除中间版本
$sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null"; $sql="delete from en.mdversion where uuid in (select uuid from en.mdversion where id=?) and changelog is null";
$this->db->query($sql,array($id)); $this->db->query($sql,array($id));
//修改评审状态为发布,且由其提交的用户进行管理 //修改评审状态为发布,且由其提交的用户进行管理
$sql="insert into mdstatus (uuid,status,userid) select uuid,6,? from mdversion where id=?"; $sql="insert into en.mdstatus (uuid,status,userid) select uuid,6,? from en.mdversion where id=?";
$this->db->query($sql,array($u_id,$id)); $this->db->query($sql,array($u_id,$id));
//email to admin & author //email to admin & author
@ -2782,7 +2782,7 @@ class Admin_DataController extends Zend_Controller_Action
$iso=new ISO19115(); $iso=new ISO19115();
$iso->saveDB($this->db,$row['xml']); $iso->saveDB($this->db,$row['xml']);
//移除中间版本 //移除中间版本
$sql="delete from mdversion where uuid in (select uuid from mdversion where id=?) and changelog is null"; $sql="delete from en.mdversion where uuid in (select uuid from en.mdversion where id=?) and changelog is null";
$this->db->query($sql,array($id)); $this->db->query($sql,array($id));
//email to admin & author //email to admin & author
@ -2833,7 +2833,7 @@ class Admin_DataController extends Zend_Controller_Action
return true; return true;
} }
$sql = "SELECT v.uuid,md.title FROM mdversion v $sql = "SELECT v.uuid,md.title FROM en.mdversion v
LEFT JOIN en.metadata md ON v.uuid=md.uuid LEFT JOIN en.metadata md ON v.uuid=md.uuid
WHERE v.id=?"; WHERE v.id=?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
@ -2842,15 +2842,15 @@ class Admin_DataController extends Zend_Controller_Action
$row = $sth->fetch(); $row = $sth->fetch();
if ($ac=='diff') if ($ac=='diff')
{ {
$sql = "SELECT v.* FROM mdversion v $sql = "SELECT v.* FROM en.mdversion v
WHERE v.uuid=? and v.ts_created<=(select ts_created from mdversion where id=?) WHERE v.uuid=? and v.ts_created<=(select ts_created from en.mdversion where id=?)
ORDER BY v.ts_created DESC ORDER BY v.ts_created DESC
LIMIT ?"; LIMIT ?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth -> execute(array($row['uuid'],$id,2)); $sth -> execute(array($row['uuid'],$id,2));
} else { } else {
$sql = "SELECT v.* FROM mdversion v $sql = "SELECT v.* FROM en.mdversion v
WHERE v.uuid=? and (v.id=? or (v.ts_created<(select ts_created from mdversion where id=?) and changelog is not null)) WHERE v.uuid=? and (v.id=? or (v.ts_created<(select ts_created from en.mdversion where id=?) and changelog is not null))
ORDER BY v.ts_created DESC ORDER BY v.ts_created DESC
LIMIT ?"; LIMIT ?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);

View File

@ -760,7 +760,7 @@ class Admin_ReviewController extends Zend_Controller_Action
//仅对单条数据发送email信息 //仅对单条数据发送email信息
if (is_numeric($ids)) if (is_numeric($ids))
{ {
$sql="select distinct u.email,m.title,m.uuid from mdstatus s left join en.metadata m on s.uuid=m.uuid $sql="select distinct u.email,m.title,m.uuid from en.mdstatus s left join en.metadata m on s.uuid=m.uuid
right join mdauthor a on s.uuid=a.uuid left join users u on a.userid=u.id where s.id=? order by u.email"; right join mdauthor a on s.uuid=a.uuid left join users u on a.userid=u.id where s.id=? order by u.email";
$rs=$this->db->query($sql,array($ids)); $rs=$this->db->query($sql,array($ids));
$rows=$rs->fetchAll(); $rows=$rs->fetchAll();