From d38d4d821a6539b55e46e76c2c15f0777e71dc12 Mon Sep 17 00:00:00 2001 From: wlx Date: Mon, 29 Jun 2015 16:36:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=91=BD=E4=BB=A4=E8=A1=8C?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vmu.php | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/vmu.php b/vmu.php index 7fc799f..8fe4eb7 100644 --- a/vmu.php +++ b/vmu.php @@ -7,17 +7,48 @@ require_once 'Zend/Loader/Autoloader.php'; $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(); + 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); //avoid params error $c->db['username']=$c->db['user']; $v->zend_db=Zend_Db::factory('PDO_PGSQL',$c->db); - $sourceid=4;//hiwater - $v->update_by_source($sourceid); + //执行专题数据的版本更新 + if (isset($options["sourceid"]) || isset($options["s"])) + { + //$sourceid=4;//hiwater + $sourceid=($options["sourceid"])?$options["sourceid"]:$options["s"]; + $v->update_by_source($sourceid); + } + + //执行单条数据的版本更新 + if (isset($options["uuid"]) || isset($options["u"])) + { + //$uuid='d6584b27-1e02-4bc7-90d1-8b360d9c69ab'; + $uuid=($options["uuid"])?$options["uuid"]:$options["u"]; + $v->update_by_uuid($uuid); + } - $uuid='d6584b27-1e02-4bc7-90d1-8b360d9c69ab'; - // for test - //$v->update_by_uuid($uuid); + //执行符合SQL条件数据的版本更新 + if (isset($options["sql"])) + { + $v->update_by_sql($options["sql"]); + } $v->error(); \ No newline at end of file