81 lines
2.0 KiB
PHP
81 lines
2.0 KiB
PHP
<?php
|
|
class Admin_TestController extends Zend_Controller_Action
|
|
{
|
|
function preDispatch()
|
|
{
|
|
$this->db=Zend_Registry::get('db');
|
|
$this->view->config = Zend_Registry::get('config');
|
|
$this->messenger=$this->_helper->getHelper('FlashMessenger');
|
|
$this->view->messages = $this->messenger->getMessages();
|
|
$this->_helper->layout->setLayout('administry');
|
|
$this->wdb=Zend_Db::factory('Pdo_Pgsql', array('host'=> '210.77.68.252','username' => 'wlz','password' => 'glacier','dbname'=> 'new_geonetwork'));
|
|
}
|
|
function postDispatch()
|
|
{
|
|
$this->view->messages = $this->messenger->getMessages();
|
|
}
|
|
function indexAction()
|
|
{
|
|
//其他连接
|
|
}
|
|
|
|
|
|
//测试文献的下载链接是否正确
|
|
function reftestAction()
|
|
{
|
|
$sql="select * from reference where link<>''";
|
|
$rows=$this->db->query($sql);
|
|
foreach($rows as $row)
|
|
{
|
|
if (substr($row['link'],0,1)=='/')
|
|
{
|
|
if (!file_exists("http://westdc.westgis.ac.cn".$row['link']))
|
|
{
|
|
$ref[]=$row;
|
|
}
|
|
} elseif (!file_exists($row['link'])) {
|
|
$ref[]=$row;
|
|
}
|
|
}
|
|
$this->view->ref=$ref;
|
|
}
|
|
|
|
//检查DOI是否有重复
|
|
function doiAction()
|
|
{
|
|
$sql="select doi,uuid,title from metadata where doi<>'' order by doi";
|
|
$rows=$this->db->fetchAll($sql);
|
|
$sql="select distinct(doi) from metadata where doi<>'' order by doi";
|
|
$drows=$this->db->fetchAll($sql);
|
|
$c=0;
|
|
if (count($rows)!=count($drows))
|
|
{
|
|
foreach($rows as $k=>$row)
|
|
{
|
|
if ($row['doi']!=$drows[$k-$c]['doi'])
|
|
{
|
|
$c++;
|
|
$doi[]=$rows[$k-1];
|
|
$doi[]=$row;
|
|
}
|
|
}
|
|
$this->view->doi=$doi;
|
|
}
|
|
}
|
|
|
|
//检查DOI是否有重复
|
|
function nodoiwaterAction()
|
|
{
|
|
$sql="select uuid,title from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d' and doi='' order by title";
|
|
$this->view->rows=$this->db->fetchAll($sql);
|
|
}
|
|
|
|
//检查source不符合要求
|
|
function sourceAction()
|
|
{
|
|
$sql="select uuid,title,source from metadata where title ilike '黑河综合遥感联合试验%' and source=''";
|
|
$this->view->rows=$this->db->fetchAll($sql);
|
|
}
|
|
}
|
|
|