version-multiple-update/vmu.php

54 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2015-06-18 13:52:24 +00:00
<?php
include_once("config.php");
include_once("version.php");
include_once("ISO19115-en.php");
2015-06-25 03:46:21 +00:00
set_include_path('.' . PATH_SEPARATOR . '/var/www/westdc.westgis.ac.cn/include/'. PATH_SEPARATOR . get_include_path());
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
2015-06-29 08:36:38 +00:00
$shortopts = "u::l::s::";
$longopts = array(
"uuid::", // Optional value
"changelog::",
"userid::",
"sourceid::",
"sql::",
);
$options = getopt($shortopts, $longopts);
2015-06-25 03:46:21 +00:00
$c=new Config();
2015-06-29 08:36:38 +00:00
if (isset($options["changelog"]) || isset($options["l"]))
$c->changelog=($options["changelog"])?$options["changelog"]:$options["l"];
if (isset($options["userid"]))
$c->userid=$options["userid"];
2015-06-25 03:46:21 +00:00
$v=new Version($c);
//avoid params error
$c->db['username']=$c->db['user'];
$v->zend_db=Zend_Db::factory('PDO_PGSQL',$c->db);
2015-06-29 08:36:38 +00:00
//执行专题数据的版本更新
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);
}
2015-06-25 03:46:21 +00:00
2015-06-29 08:36:38 +00:00
//执行符合SQL条件数据的版本更新
if (isset($options["sql"]))
{
$v->update_by_sql($options["sql"]);
}
2015-06-25 03:46:21 +00:00
2015-06-18 13:52:24 +00:00
$v->error();