修复文件大小问题

This commit is contained in:
wlx 2011-10-20 06:56:01 +00:00
parent 29311fede4
commit 8e7c1b5048
1 changed files with 10 additions and 10 deletions

View File

@ -162,6 +162,9 @@ class Admin_WatermdController extends Zend_Controller_Action
{ {
$sql="select uuid,data from metadata where istemplate = 'n'"; $sql="select uuid,data from metadata where istemplate = 'n'";
$rows=$this->wdb->fetchAll($sql); $rows=$this->wdb->fetchAll($sql);
$this->view->deal=array();
$sql="select update_filesize();";
$this->db->exec($sql);
foreach($rows as $k=>$row) foreach($rows as $k=>$row)
{ {
//do the replace //do the replace
@ -173,21 +176,17 @@ class Admin_WatermdController extends Zend_Controller_Action
$title_key=$xpath->query("//Metadata/dataIdInfo/idCitation/resTitle"); $title_key=$xpath->query("//Metadata/dataIdInfo/idCitation/resTitle");
$title=$title_key->item(0)->nodeValue; $title=$title_key->item(0)->nodeValue;
$transize_path=$xpath->query("//Metadata/distInfo/distTranOps/transSize"); $transize_path=$xpath->query("//Metadata/distInfo/distTranOps/transSize");
$sql="select sum(file_size) as fsize from westdc_fileinfo where meta_uuid = ?"; $sql="select filesize from metadata where uuid = ?";
$this->db->setFetchMode(Zend_Db::FETCH_OBJ); $this->db->setFetchMode(Zend_Db::FETCH_OBJ);
$row=$this->db->fetchRow($sql,array($uuid)); $row=$this->db->fetchRow($sql,array($uuid));
//转换单位为MB $transize_path->item(0)->nodeValue=$row->filesize;
$msize=round($row->fsize/(1024*1024),2); $new_data = $dom->saveXML();
if($msize>10){
$msize=round($size/(1024*1024),1);
}
$transize_path->item(0)->nodeValue=msize;
$new_data = $dom->saveXML($root->item(0));
//防止错误 //防止错误
if (!empty($new_data)) if (!empty($new_data))
{ {
$sql="update metadata set data=? where uuid=?"; $sql="update metadata set data=? where uuid='$uuid'";
$this->wdb->query($sql,array($new_data,$uuid)); if ($this->wdb->exec($this->wdb->quoteInto($sql,$new_data)))
{
$deal['uuid']=$uuid; $deal['uuid']=$uuid;
$deal['title']=$title; $deal['title']=$title;
$this->view->deal[]=$deal; $this->view->deal[]=$deal;
@ -195,6 +194,7 @@ class Admin_WatermdController extends Zend_Controller_Action
} }
} }
} }
}
$this->view->form=$form; $this->view->form=$form;
} }