2010-07-01 08:48:35 +00:00
|
|
|
<?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->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;
|
|
|
|
}
|
2010-07-01 11:34:16 +00:00
|
|
|
|
|
|
|
//检查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++;
|
2010-07-01 11:36:34 +00:00
|
|
|
$doi[]=$rows[$k-1];
|
2010-07-01 11:34:16 +00:00
|
|
|
$doi[]=$row;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->view->doi=$doi;
|
|
|
|
}
|
|
|
|
}
|
2010-07-01 08:48:35 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|