实现命令行参数控制
This commit is contained in:
parent
c0ebcbfc8f
commit
d38d4d821a
39
vmu.php
39
vmu.php
|
@ -7,17 +7,48 @@
|
||||||
require_once 'Zend/Loader/Autoloader.php';
|
require_once 'Zend/Loader/Autoloader.php';
|
||||||
$loader = Zend_Loader_Autoloader::getInstance();
|
$loader = Zend_Loader_Autoloader::getInstance();
|
||||||
|
|
||||||
|
$shortopts = "u::l::s::";
|
||||||
|
|
||||||
|
$longopts = array(
|
||||||
|
"uuid::", // Optional value
|
||||||
|
"changelog::",
|
||||||
|
"userid::",
|
||||||
|
"sourceid::",
|
||||||
|
"sql::",
|
||||||
|
);
|
||||||
|
$options = getopt($shortopts, $longopts);
|
||||||
|
|
||||||
$c=new Config();
|
$c=new Config();
|
||||||
|
if (isset($options["changelog"]) || isset($options["l"]))
|
||||||
|
$c->changelog=($options["changelog"])?$options["changelog"]:$options["l"];
|
||||||
|
if (isset($options["userid"]))
|
||||||
|
$c->userid=$options["userid"];
|
||||||
|
|
||||||
$v=new Version($c);
|
$v=new Version($c);
|
||||||
//avoid params error
|
//avoid params error
|
||||||
$c->db['username']=$c->db['user'];
|
$c->db['username']=$c->db['user'];
|
||||||
$v->zend_db=Zend_Db::factory('PDO_PGSQL',$c->db);
|
$v->zend_db=Zend_Db::factory('PDO_PGSQL',$c->db);
|
||||||
|
|
||||||
$sourceid=4;//hiwater
|
//执行专题数据的版本更新
|
||||||
|
if (isset($options["sourceid"]) || isset($options["s"]))
|
||||||
|
{
|
||||||
|
//$sourceid=4;//hiwater
|
||||||
|
$sourceid=($options["sourceid"])?$options["sourceid"]:$options["s"];
|
||||||
$v->update_by_source($sourceid);
|
$v->update_by_source($sourceid);
|
||||||
|
}
|
||||||
|
|
||||||
$uuid='d6584b27-1e02-4bc7-90d1-8b360d9c69ab';
|
//执行单条数据的版本更新
|
||||||
// for test
|
if (isset($options["uuid"]) || isset($options["u"]))
|
||||||
//$v->update_by_uuid($uuid);
|
{
|
||||||
|
//$uuid='d6584b27-1e02-4bc7-90d1-8b360d9c69ab';
|
||||||
|
$uuid=($options["uuid"])?$options["uuid"]:$options["u"];
|
||||||
|
$v->update_by_uuid($uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//执行符合SQL条件数据的版本更新
|
||||||
|
if (isset($options["sql"]))
|
||||||
|
{
|
||||||
|
$v->update_by_sql($options["sql"]);
|
||||||
|
}
|
||||||
|
|
||||||
$v->error();
|
$v->error();
|
Loading…
Reference in New Issue