实现了列出多余元数据的功能;

实现了删除多余元数据的功能(包括WATER)
This commit is contained in:
wlx 2010-06-22 03:37:08 +00:00
parent 5fd5098d67
commit e467fe5225
2 changed files with 20 additions and 3 deletions

View File

@ -21,12 +21,13 @@ class Admin_DataController extends Zend_Controller_Action
//提供双向同步功能但只处理ISO 19115格式的元数据 //提供双向同步功能但只处理ISO 19115格式的元数据
function syncAction() function syncAction()
{ {
$sql="select * from (select count(*) as westdccount from metadata) as t1,(select count(uuid) as gncount from geonetworkmetadata where schemaid='iso19115') as t2"; $sql="select * from (select count(*) as westdccount from metadata) as t1,(select count(uuid) as gncount from geonetworkmetadata where schemaid='iso19115') as t2,(select count(uuid) as watergncount from watergn where schemaid='iso19115') as t3";
$this->db->setFetchMode(Zend_Db::FETCH_OBJ); $this->db->setFetchMode(Zend_Db::FETCH_OBJ);
$this->view->mdcount=$this->db->fetchRow($sql); $this->view->mdcount=$this->db->fetchRow($sql);
$source=$this->_request->getParam('source'); $source=$this->_request->getParam('source');
$delete=$this->_request->getParam('delete'); $delete=$this->_request->getParam('delete');
$thumb=$this->_request->getParam('thumb'); $thumb=$this->_request->getParam('thumb');
$list=$this->_request->getParam('list');
$adminuser=$this->_request->getParam('adminuser'); $adminuser=$this->_request->getParam('adminuser');
$uuid=$this->_request->getParam('uuid'); $uuid=$this->_request->getParam('uuid');
if ($this->_request->isPost()) $uuid=$this->_request->getPost('uuid'); if ($this->_request->isPost()) $uuid=$this->_request->getPost('uuid');
@ -54,10 +55,17 @@ class Admin_DataController extends Zend_Controller_Action
$this->import($rs->data); $this->import($rs->data);
$this->view->msg='成功同步元数据:'.$uuid; $this->view->msg='成功同步元数据:'.$uuid;
} else $this->view->msg='不存在此元数据:'.$uuid; } else $this->view->msg='不存在此元数据:'.$uuid;
} elseif ($list=='water') {
$sql="select uuid,title from metadata where uuid not in (select uuid from watergn where schemaid='iso19115') and uuid not in (select uuid from geonetworkmetadata where schemaid='iso19115')";
$this->view->metadata=$this->db->query($sql);
} elseif ($delete=='westdc') { } elseif ($delete=='westdc') {
$sql="delete from metadata where uuid not in (select uuid from geonetworkmetadata where schemaid='iso19115')"; $sql="delete from metadata where uuid not in (select uuid from geonetworkmetadata where schemaid='iso19115')";
$this->db->query($sql); $this->db->query($sql);
$this->view->msg='已删除WESTDC中多出的元数据'; $this->view->msg='已删除WESTDC中多出的元数据';
} elseif ($delete=='water') {
$sql="delete from metadata where uuid not in (select uuid from watergn where schemaid='iso19115') and uuid not in (select uuid from geonetworkmetadata where schemaid='iso19115')";
$this->db->query($sql);
$this->view->msg='已删除WESTDC中多出的元数据';
} elseif ($thumb=='geonetwork') { } elseif ($thumb=='geonetwork') {
$sql="select g.id as gid,m.uuid,t.* from thumbnail t left join metadata m on t.id=m.id left join geonetworkmetadata g on m.uuid=g.uuid where t.filetype is not null and t.filename is not null"; $sql="select g.id as gid,m.uuid,t.* from thumbnail t left join metadata m on t.id=m.id left join geonetworkmetadata g on m.uuid=g.uuid where t.filetype is not null and t.filename is not null";
$rows=$this->db->fetchAll($sql); $rows=$this->db->fetchAll($sql);

View File

@ -23,10 +23,12 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
<p>WESTDC有元数据<?php echo $this->mdcount->westdccount; ?>GEONETWORK有元数据<?php echo $this->mdcount->gncount; ?>条。</p> <p>WESTDC有元数据<?php echo $this->mdcount->westdccount; ?>GEONETWORK有元数据<?php echo $this->mdcount->gncount; ?>WATER中元数据<?php echo $this->mdcount->watergncount; ?></p>
<p><a href="/admin/data/sync/source/geonetwork">开始同步从GEONETWORK同步到WESTDC若有冲突以GEONETWORK为准</a> </p> <p><a href="/admin/data/sync/source/geonetwork">开始同步从GEONETWORK同步到WESTDC若有冲突以GEONETWORK为准</a> </p>
<p><a href="/admin/data/sync/source/watergn">开始同步从water同步到WESTDC若有冲突以water为准</a> </p> <p><a href="/admin/data/sync/source/watergn">开始同步从water同步到WESTDC若有冲突以water为准</a> </p>
<p><a href="/admin/data/sync/list/water">列出WESTDC中多出的WATER元数据</a></p>
<p><a href="/admin/data/sync/delete/westdc">删除WESTDC中多出的元数据</a></p> <p><a href="/admin/data/sync/delete/westdc">删除WESTDC中多出的元数据</a></p>
<p><a href="/admin/data/sync/delete/water">删除WESTDC中多出的WATER元数据</a></p>
<p><a href="/admin/data/sync/thumb/geonetwork">同步GEONETWORK中的缩略图</a></p> <p><a href="/admin/data/sync/thumb/geonetwork">同步GEONETWORK中的缩略图</a></p>
<p><a href="/admin/data/sync/thumb/water">同步WATER中的缩略图</a></p> <p><a href="/admin/data/sync/thumb/water">同步WATER中的缩略图</a></p>
<p><a href="/admin/data/sync/adminuser/geonetwork">同步管理员帐号到GEONETWORK</a></p> <p><a href="/admin/data/sync/adminuser/geonetwork">同步管理员帐号到GEONETWORK</a></p>
@ -34,4 +36,11 @@
<p>指定元数据UUID: <input type="text" name="uuid"></p> <p>指定元数据UUID: <input type="text" name="uuid"></p>
<input type="submit" value="同步此元数据" /> <input type="submit" value="同步此元数据" />
</form> </form>
<?php if ($this->metadata) : ?>
<ul>
<?php foreach ($this->metadata as $md) :?>
<li><a href="/data/<?php echo $md->uuid; ?>"><?php echo $md->title;?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div> </div>