switch ftp url to ftp.sanjiangyuan.org.cn

This commit is contained in:
wlx 2013-12-14 04:19:58 +00:00
parent 02ae9b9d85
commit 7a6f34efcf
4 changed files with 20 additions and 20 deletions

View File

@ -581,7 +581,7 @@ class Admin_DownController extends Zend_Controller_Action
foreach($rs as $data) { foreach($rs as $data) {
if ($data['host']=='ftp1.westgis.ac.cn') if ($data['host']=='ftp1.westgis.ac.cn')
$has_ftp1=true; $has_ftp1=true;
if ($data['host']=='ftp2.westgis.ac.cn') if ($data['host']=='ftp.sanjiangyuan.org.cn')
$has_ftp2=true; $has_ftp2=true;
// deal with ftp.westgis.ac.cn, use g6 to add path // deal with ftp.westgis.ac.cn, use g6 to add path
@ -594,7 +594,7 @@ class Admin_DownController extends Zend_Controller_Action
if ($has_ftp1) if ($has_ftp1)
{ {
$user=(object)array("id"=>$row['userid'], $user=(object)array("id"=>$row['userid'],
"username"=>"westdc_".$row['userid'], "username"=>"sjy_".$row['userid'],
"password"=>$password, "password"=>$password,
"time"=>date('Y-m-d H:i:s', strtotime('+2 week')), "time"=>date('Y-m-d H:i:s', strtotime('+2 week')),
//"path"=>$path, //"path"=>$path,
@ -621,12 +621,12 @@ class Admin_DownController extends Zend_Controller_Action
if ($has_ftp2) if ($has_ftp2)
{ {
$user=(object)array("id"=>$row['userid'], $user=(object)array("id"=>$row['userid'],
"username"=>"westdc_".$row['userid'], "username"=>"sjy_".$row['userid'],
"password"=>$password, "password"=>$password,
"time"=>date('Y-m-d H:i:s', strtotime('+2 week')), "time"=>date('Y-m-d H:i:s', strtotime('+2 week')),
//"path"=>$path, //"path"=>$path,
"param"=>"offlineappid=".$finish, "param"=>"offlineappid=".$finish,
"host"=>'ftp2.westgis.ac.cn', "host"=>'ftp.sanjiangyuan.org.cn',
"maxdata"=>$this->view->config->download->max, "maxdata"=>$this->view->config->download->max,
"datacount"=>1 //represent one offline application "datacount"=>1 //represent one offline application
); );
@ -649,10 +649,10 @@ class Admin_DownController extends Zend_Controller_Action
$ftphost='ftp://ftp1.westgis.ac.cn'; $ftphost='ftp://ftp1.westgis.ac.cn';
} else if (!$has_ftp1 && $has_ftp2) } else if (!$has_ftp1 && $has_ftp2)
{ {
$ftphost='ftp://ftp2.westgis.ac.cn'; $ftphost='ftp://ftp.sanjiangyuan.org.cn';
} else if ($has_ftp1 && $has_ftp2) } else if ($has_ftp1 && $has_ftp2)
{ {
$ftphost='ftp://ftp1.westgis.ac.cn 以及 ftp://ftp2.westgis.ac.cn'; $ftphost='ftp://ftp1.westgis.ac.cn 以及 ftp://ftp.sanjiangyuan.org.cn';
} }
//发送用户邮件进行信息提示和说明 //发送用户邮件进行信息提示和说明
$mail = new WestdcMailer($this->view->config->smtp); $mail = new WestdcMailer($this->view->config->smtp);

View File

@ -1552,16 +1552,16 @@ class DataController extends Zend_Controller_Action
$this->view->userpass=$proftp->pwd; $this->view->userpass=$proftp->pwd;
$this->view->ftptime=$proftp->time; $this->view->ftptime=$proftp->time;
} }
} elseif ($data['host']=='ftp2.westgis.ac.cn') } elseif ($data['host']=='ftp.sanjiangyuan.org.cn')
{ {
//添加FTP2帐号信息以及时间控制信息 //添加FTP2帐号信息以及时间控制信息
$proftp=new Pureftp(); $proftp=new Pureftp();
$proftp->db=$this->db; $proftp->db=$this->db;
$this->view->username='westdc_'.$userid; $this->view->username='sjy_'.$userid;
$uu=(object)array("id"=>$userid, $uu=(object)array("id"=>$userid,
"username"=>$this->view->username, "username"=>$this->view->username,
"password"=>$this->view->userpass, "password"=>$this->view->userpass,
"host"=>'ftp2.westgis.ac.cn', "host"=>'ftp.sanjiangyuan.org.cn',
"param"=>"onlineappid=".$onlineappid, "param"=>"onlineappid=".$onlineappid,
"maxdata"=>$this->view->config->download->max, "maxdata"=>$this->view->config->download->max,
"time"=>$this->view->ftptime, "time"=>$this->view->ftptime,

View File

@ -96,10 +96,10 @@ function getFtp(uuid){
{ {
if(data.statu > 0) if(data.statu > 0)
{ {
var html = '<p>临时FTP帐号信息<b>(此帐号仅对应当前数据集!)</b></p><p>ftp://ftp2.westgis.ac.cn/</p>'+ var html = '<p>临时FTP帐号信息<b>(此帐号仅对应当前数据集!)</b></p><p>ftp://ftp.sanjiangyuan.org.cn/</p>'+
'<p>用户名:'+data.user+ '<p>用户名:'+data.user+
'</p><p>密码:'+data.passwd+'</p>' '</p><p>密码:'+data.passwd+'</p>'
+'<p><a href="ftp://'+data.user+':'+data.passwd+'@ftp1.westgis.ac.cn/">或直接点击此链接</a></p>'; +'<p><a href="ftp://'+data.user+':'+data.passwd+'@ftp.sanjiangyuan.org.cn/">或直接点击此链接</a></p>';
Alert(html); Alert(html);
} }
} }

View File

@ -1,5 +1,5 @@
<?php <?php
$link = pg_connect("dbname=metadata user=gis password=gispassword host=210.77.68.241"); $link = pg_connect("dbname=metadata user=gis password=gispassword host=192.168.13.142");
if (!$link) if (!$link)
{ {
die("Error in connection: " . pg_last_error()); die("Error in connection: " . pg_last_error());
@ -12,7 +12,7 @@
}else{ }else{
$onlineip=$_SERVER['REMOTE_ADDR']; $onlineip=$_SERVER['REMOTE_ADDR'];
} }
if ($onlineip!='210.77.68.241' && $onlineip!='2001:cc0:f006::9') if ($onlineip!='192.168.13.142' && $onlineip!='223.220.175.142')
die("error! You are not permitted to visit this page.".$onlineip); die("error! You are not permitted to visit this page.".$onlineip);
//文件生成 //文件生成
$onlineappid=(int)@$_GET['onlineappid']; $onlineappid=(int)@$_GET['onlineappid'];
@ -22,7 +22,7 @@
die("Error in parameter."); die("Error in parameter.");
} }
$sql="select dataorder.userid,dataset.path from dataorder left join dataset on dataorder.uuid=dataset.uuid $sql="select dataorder.userid,dataset.path from dataorder left join dataset on dataorder.uuid=dataset.uuid
where dataorder.status in (0,5) and dataset.host='ftp2.westgis.ac.cn' and dataset.path<>'' and dataorder.selection is null"; where dataorder.status in (0,5) and dataset.host='ftp.sanjiangyuan.org.cn' and dataset.path<>'' and dataorder.selection is null";
if ($onlineappid>0) if ($onlineappid>0)
$sql.=" and dataorder.onlineappid=".$onlineappid; $sql.=" and dataorder.onlineappid=".$onlineappid;
else if ($offlineappid>0) else if ($offlineappid>0)
@ -36,24 +36,24 @@
{ {
$row = pg_fetch_array($result, $ri); $row = pg_fetch_array($result, $ri);
$content.='# path: '.$row['path']."\n"; $content.='# path: '.$row['path']."\n";
$content.='mkdir -p "/home/ftp/westdc_'.$row['userid'].'/'.preg_replace('/^.+[\\\\\\/]/', '', rtrim($row['path'],'/')).'"'."\n"; $content.='mkdir -p "/home/ftp/sjy_'.$row['userid'].'/'.preg_replace('/^.+[\\\\\\/]/', '', rtrim($row['path'],'/')).'"'."\n";
$content.='mount --bind "'.$row['path'].'" "/home/ftp/westdc_'.$row['userid'].'/'.preg_replace('/^.+[\\\\\\/]/', '', rtrim($row['path'],'/')).'"'."\n"; $content.='mount --bind "'.$row['path'].'" "/home/ftp/sjy_'.$row['userid'].'/'.preg_replace('/^.+[\\\\\\/]/', '', rtrim($row['path'],'/')).'"'."\n";
} }
$sql="select distinct dataorder.userid,dataset.path,dataservice.uuid from dataorder left join dataset on dataorder.uuid=dataset.uuid left join dataservice on dataorder.uuid=dataservice.uuid $sql="select distinct dataorder.userid,dataset.path,dataservice.uuid from dataorder left join dataset on dataorder.uuid=dataset.uuid left join dataservice on dataorder.uuid=dataservice.uuid
where dataorder.status in (0,5) and dataset.host='ftp2.westgis.ac.cn' and dataset.path<>'' and dataorder.selection is not null and dataservice.service_type in (1,2)"; where dataorder.status in (0,5) and dataset.host='ftp.sanjiangyuan.org.cn' and dataset.path<>'' and dataorder.selection is not null and dataservice.service_type in (1,2)";
if ($onlineappid>0) if ($onlineappid>0)
$sql.=" and dataorder.onlineappid=".$onlineappid; $sql.=" and dataorder.onlineappid=".$onlineappid;
else if ($offlineappid>0) else if ($offlineappid>0)
$sql.=" and dataorder.offlineappid=".$offlineappid; $sql.=" and dataorder.offlineappid=".$offlineappid;
$result = pg_query($link, $sql); $result = pg_query($link, $sql);
$numrows = pg_num_rows($result); $numrows = pg_num_rows($result);
$basepath='/disk1/WestDC/wsndata/'; $basepath='/data/wsndata/';
for($ri = 0; $ri < $numrows; $ri++) for($ri = 0; $ri < $numrows; $ri++)
{ {
$row = pg_fetch_array($result, $ri); $row = pg_fetch_array($result, $ri);
$content.='# path: '.$row['path']."\n"; $content.='# path: '.$row['path']."\n";
$content.='mkdir -p "/home/ftp/westdc_'.$row['userid'].'/wsn_'.$row['userid'].'"'."\n"; $content.='mkdir -p "/home/ftp/sjy_'.$row['userid'].'/wsn_'.$row['userid'].'"'."\n";
$content.='mount --bind "'.$basepath.'wsn_'.$row['userid'].'" "/home/ftp/westdc_'.$row['userid'].'/wsn_'.$row['userid'].'"'."\n"; $content.='mount --bind "'.$basepath.'wsn_'.$row['userid'].'" "/home/ftp/wsjy_'.$row['userid'].'/wsn_'.$row['userid'].'"'."\n";
} }
$filename='./proftp-user.sh'; $filename='./proftp-user.sh';