本文整理汇总了PHP中Sqlite::getTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Sqlite::getTable方法的具体用法?PHP Sqlite::getTable怎么用?PHP Sqlite::getTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sqlite
的用法示例。
在下文中一共展示了Sqlite::getTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createExtraVariables
function createExtraVariables()
{
global $gbl, $sgbl, $login, $ghtml;
$revc = $login->getObject('general')->reversedns_b;
if (!$revc->dns_slave_list) {
throw new lxexception("dns_params_not_configured", '', "");
}
$this->syncserver = implode(",", $revc->dns_slave_list);
$rdrlist = $this->getList('rdnsrange');
$rdrange = null;
foreach ($rdrlist as $k => $v) {
list($base, $first) = self::getBaseEnd($v->firstip);
list($base, $last) = self::getBaseEnd($v->lastip);
$rdrange[] = array($base, $first, $last);
}
$this->__var_rdnsrange = $rdrange;
dprintr($this->__var_rdnsrange);
$sq = new Sqlite(null, 'reversedns');
$res = $sq->getTable();
foreach ($res as $r) {
list($base, $last) = self::getBaseEnd($r['nname'], $this->__var_rdnsrange);
$total[$base][] = array('nname' => $r['nname'], 'end' => $last, 'reversename' => $r['reversename']);
}
$this->__var_revdns1 = $revc->primarydns;
$this->__var_revdns2 = $revc->secondarydns;
$this->__var_reverse_list = $total;
}
示例2: createExtraVariables
function createExtraVariables()
{
// Not here. Two different extra variables are needed, so they are created in synctosystem.
// Brought back here, since the secondary server concept has been abolished in favor of multiple primary servers.
global $gbl, $sgbl, $login, $ghtml;
if ($sgbl->isHyperVm()) {
$this->createExtraVariablesHyperVM();
return;
}
$db = new Sqlite($this->__masterserver, "dns");
$gen = $login->getObject('general')->generalmisc_b;
$serverlist = explode(",", $this->syncserver);
$list = null;
foreach ($serverlist as $server) {
$string = "syncserver LIKE '%{$server}%'";
$nlist = $db->getRowsWhere($string, array('nname'));
$dlistv = "__var_domainlist_{$server}";
$this->{$dlistv} = $nlist;
}
//FIXME: We should only get the addon domains for the domains configured on that particular server. IN the case of single server system, it is not a problem, since that means we will have to get all the domains. but in the case of distributed setup, we need to properly get only the add domains under the domains loaded above.
$dbaddon = new Sqlite(null, "addondomain");
$addr = $dbaddon->getTable(array('nname'));
foreach ($serverlist as $server) {
$dlistv = "__var_domainlist_{$server}";
$this->{$dlistv} = lx_array_merge(array($this->{$dlistv}, $addr));
}
$this->fixDateSerial();
$this->__var_addonlist = $this->getParentO()->getList('addondomain');
$mydb = new Sqlite(null, "ipaddress");
$string = "syncserver = '{$this->syncserver}'";
$this->__var_ipssllist = $mydb->getRowsWhere($string, array('ipaddr', 'nname'));
}
示例3: loaddriverappInfo
function loaddriverappInfo($master)
{
$db = new Sqlite($master, 'driver');
$res = $db->getTable();
// Doing the setFromArray stuff here itself. Since that is the place from where we are called, and if we call setfromarray here, naturally it results in a loop.
$__t_ob = null;
foreach ((array) $res as $row) {
$nname = $row['nname'];
$obj = new driver($master, null, $nname);
foreach ($row as $key => $value) {
if (csb($key, "ser_")) {
$key = strfrom($key, "ser_");
$value = unserialize(base64_decode($value));
}
if (cse($key, "_b") && !is_object($value)) {
$value = new $key(null, null, $nname);
}
if (is_numeric($key)) {
continue;
}
$obj->{$key} = $value;
}
$__t_ob[$nname] = $obj;
}
if (!isset($this->driver)) {
$this->driver = array();
}
$this->driver[$master] = $__t_ob;
//dprintr($this->driver);
}
示例4: initThisList
static function initThisList($parent, $class)
{
$db = new Sqlite($parent->__masterserver, "ipaddress");
if ($parent->isAdmin()) {
$result = $db->getTable();
} else {
$result = $db->getRowsWhere("clientname = '" . $parent->nname . "'");
}
return $result;
}
示例5: getDnsTemplateList
static function getDnsTemplateList($parent)
{
$res = $parent->dnstemplate_list;
dprintr($res);
if (!$res) {
$sq = new Sqlite(null, "dnstemplate");
$res = $sq->getTable();
$res = get_namelist_from_arraylist($res);
}
if (!$res) {
throw new lxException("err_no_dns_template", '', '');
}
return $res;
}
示例6: update_all_slave
function update_all_slave()
{
$db = new Sqlite(null, "pserver");
$list = $db->getTable(array("nname"));
foreach ($list as $l) {
if ($l['nname'] === 'localhost') {
continue;
}
try {
print "Upgrading Slave {$l['nname']}...\n";
rl_exec_get(null, $l['nname'], 'remotetestfunc', null);
} catch (exception $e) {
print $e->getMessage();
print "\n";
}
}
}
示例7: updateform
function updateform($subaction, $param)
{
if ($subaction === 'update') {
$vlist['devname'] = array("M", $this->devname);
$vlist['ipaddr'] = array('M', $this->ipaddr);
$vlist['netmask'] = array('M', $this->netmask);
$vlist['gateway'] = array('M', $this->gateway);
$vlist['__v_button'] = "";
} else {
if ($subaction === "exclusive") {
$db = new Sqlite($this->__masterserver, "client");
$list = $db->getTable(array("nname"));
$list = get_namelist_from_arraylist($list);
$list = lx_merge_good('__unassigned__', $list);
$vlist['clientname'] = array('s', $list);
}
}
return $vlist;
}
示例8: fixDatabaseServers
function fixDatabaseServers()
{
$db = new Sqlite($this->__masterserver, "pserver");
$list = $db->getTable(array('nname'));
foreach ($list as $l) {
if ($this->isDeleted() && $l['nname'] === $this->nname) {
continue;
}
$nlist[] = $l['nname'];
}
if ($this->dbaction === 'add') {
$nlist[] = $this->nname;
}
sort($nlist);
rl_exec_get($this->__masterserver, null, array('pserver', 'localfixDatabaseServers'), array($nlist));
}
示例9: Sqlite
<?php
include_once "htmllib/lib/include.php";
initProgram('admin');
$list = $login->getList('ippool');
$sq = new Sqlite(null, 'tmpipassign');
$res = $sq->getTable();
foreach ($res as $r) {
if (!ippool::checkIfAlreadyAssigned('vps', $r['nname'])) {
$sq->rawQuery("delete from tmpipassign where nname = '{$r['nname']}';");
continue;
}
if (time() - $r['ddate'] > 40) {
$sq->rawQuery("delete from tmpipassign where nname = '{$r['nname']}';");
}
}
foreach ($list as $l) {
$l->freeflag = 'on';
$fip = $l->getFreeIp(10000);
if ($fip) {
$l->freeflag = 'on';
} else {
$l->freeflag = 'dull';
}
$l->setUpdateSubaction();
$l->write();
}
示例10: add_vps_backup_dir
function add_vps_backup_dir()
{
$sq = new Sqlite(null, 'vps');
$res = $sq->getTable(array('nname'));
if (isset($res)) {
foreach ($res as $r) {
if (!lxfile_exists("__path_program_home/vps/{$r['nname']}/__backup")) {
lxfile_mkdir("__path_program_home/vps/{$r['nname']}/__backup");
$vpsbackupdirname = $r['nname'];
print "- Backup dir created for {$vpsbackupdirname} \n";
}
}
return true;
}
return false;
}
示例11: backup_main
function backup_main()
{
global $argc, $argv;
global $gbl, $login, $ghtml;
$gbl->__restore_flag = true;
if ($argc === 1) {
print "Usage: {$argv['0']} --restore/--list --accounts='domain-<domain1.com>,client-<client1>,domain-<domain2.com>' <backup-file> [--switchserverlist='oldserver1:newserver1,oldserver2:newserver2']\n Use --accounts=all to restore everything.\n";
exit;
}
initProgram("admin");
$object = $login;
$opt = parse_opt($argv);
if (isset($opt['class']) && isset($opt['name'])) {
$object = new $opt['class'](null, null, $opt['name']);
$object->get();
if ($object->dbaction === 'add') {
log_error("{$opt['class']} doesnt exist");
print "{$opt['class']} doesnt exist\n";
exit;
}
}
$class = $opt['class'];
$name = $opt['name'];
if (lx_core_lock("{$class}-{$name}.restore")) {
print "Another Restore for the same class is happening..\n";
exit;
}
$backup = $object->getObject('lxbackup');
if (isset($opt['switchserverlist'])) {
$sq = new Sqlite(null, "pserver");
$serverlist = $sq->getTable();
$serverlist = get_namelist_from_arraylist($serverlist);
$server = $opt['switchserverlist'];
$list = explode(",", $server);
foreach ($list as $l) {
if (!$l) {
continue;
}
$q = explode(":", $l);
$rlist[$q[0]] = $q[1];
if (!array_search_bool($q[1], $serverlist)) {
print "The server {$q[1]} doesn't exist in the server system here\n";
exit;
}
}
$param['switchserverlist'] = $rlist;
dprint("\n");
} else {
$param['switchserverlist'] = null;
}
/*
if (!testAllServersWithMessage()) {
$backup->restorestage = "Failed due to: could not connect to slave servers";
clearLxbackup($backup);
exit;
}
*/
$file = $opt['final'];
//$param = get_variable($opt);
if (isset($opt['list'])) {
$gbl->__var_list_flag = true;
$param['_accountselect'] = null;
} else {
if (isset($opt['restore'])) {
$gbl->__var_list_flag = false;
if (!isset($opt['accounts'])) {
print "Restore option needs accounts that are to be restored. --accounts='domain-domain.com,client:clientname'... Use --list to find out all the domain/clients in the backup archive.\n";
clearLxbackup($backup);
exit;
}
$account = $opt['accounts'];
//$account = str_replace(":", "_s_vv_p_", $account);
$account = str_replace(":", "-", $account);
$accountlist = explode(",", $account);
$param['_accountselect'] = $accountlist;
} else {
print "Usage: {$argv['0']} <--list/--restore --accounts=> <filename>\n";
clearLxbackup($backup);
exit;
}
}
if (isset($opt['priority']) && $opt['priority'] === 'low') {
sleep(20);
}
dprintr($param);
//dprint($file);
try {
$backup->doUpdateRestore($file, $param);
$backup->restorestage = 'done';
} catch (exception $e) {
log_error("Restore Failed. Reason: {$e->__full_message} \n");
print "Restore Failed. Reason: {$e->__full_message} \n";
$mess = $e->__full_message;
mail($object->contactemail, "Restore Failed..", "Restore Failed for {$object->nname} with the Message {$mess}");
$backup->restorestage = "Restore failed due to {$mess}";
}
clearLxbackup($backup);
}
示例12: getIpaddressList
static function getIpaddressList($parent)
{
$db = new Sqlite($parent->__masterserver, 'ipaddress');
$res = $db->getTable(array('ipaddr'));
$res = get_namelist_from_arraylist($res, 'ipaddr');
return $res;
}
示例13: Sqlite
<?php
include "htmllib/lib/include.php";
$db = new Sqlite(null, $argv[1]);
$res = $db->getTable();
$class = $argv[1];
foreach ($res as $r) {
if (isset($stored[$r['nname']])) {
print "duplicate found {$r['nname']}\n";
$db->rawQuery("delete from {$class} where nname = '{$r['nname']}'");
$ob = new $class(null, null, $r['nname']);
$ob->create($r);
$ob->write();
continue;
}
$stored[$r['nname']] = $r;
}
示例14: add_vps_backup_dir
function add_vps_backup_dir()
{
if (lxfile_exists("__path_program_home/vps")) {
print "VPS backupdir already exist...\n";
return;
}
$sq = new Sqlite(null, 'vps');
$res = $sq->getTable(array('nname'));
foreach ($res as $r) {
lxfile_mkdir("__path_program_home/vps/{$r['nname']}/__backup");
$vpsbackupdirname = $r['nname'];
print "Backup dir created for {$vpsbackupdirname} \n";
}
}
示例15: updateform
//.........这里部分代码省略.........
$vlist['__m_message_pre'] = 'xen_restart_message';
}
$vlist['rootpassword'] = null;
return $vlist;
//ONly for Template...
//ONly for Template...
case "description":
$vlist['description'] = null;
//$vlist['share_status'] = null;
if (!$this->isRightParent()) {
$this->convertToUnmodifiable($vlist);
}
return $vlist;
case "timezone":
$vlist['timezone'] = array('s', pserver::getTimeZoneList());
return $vlist;
case "information":
$vlist['nname'] = array('M', $this->nname);
$vlist['corerootdir'] = array('M', $this->corerootdir);
$vlist['ddate'] = array('M', @date('d-m-Y', $this->ddate));
// $vlist['kloxo_flag'] = null;
if ($login->isAdmin() && $this->isXen()) {
$vlist['nosaveconfig_flag'] = null;
}
if (!$this->isXen()) {
$vlist['vpsid'] = array('M', $this->vpsid);
}
if ($this->isXen() && $login->isAdmin()) {
$vlist['vcpu_number'] = array('s', range(1, 10));
}
if ($login->isAdmin()) {
$use_slaves = "__use-slaves-backup-server__";
if (!$this->centralbackup_server) {
$this->centralbackup_server = $use_slaves;
}
$sq = new Sqlite(null, "centralbackupserver");
$list = get_namelist_from_arraylist($sq->getTable(array('nname')));
$list = lx_merge_good(array($use_slaves), $list);
//$vlist['centralbackup_flag'] = null;
$vlist['centralbackup_server'] = array('s', $list);
}
$vlist['ostemplate'] = array('M', null);
$vlist['parent_name_f'] = array('M', $this->getParentName());
//$vlist['dbtype_list'] = array('M', $this->listpriv->dbtype_list);
$vlist['contactemail'] = "";
if (!$this->isLogin()) {
$vlist['text_comment'] = null;
}
return $vlist;
// Only for template. For the main guy, it comes as 'rebuild'
// Only for template. For the main guy, it comes as 'rebuild'
case "network":
if ($this->isXen()) {
$vlist['__m_message_pre'] = 'xen_restart_message';
}
if (!$this->isLogin() || !$gen->isOn('disable_hostname_change')) {
$vlist['hostname'] = null;
}
if ($this->isXen()) {
if (!$this->networknetmask) {
$this->networknetmask = "255.255.255.0";
}
$vlist['networkgateway'] = null;
$vlist['networknetmask'] = null;
if ($login->priv->isOn('ip_manage_flag') || $login->isAdmin()) {
$vlist['networkbridge'] = array('s', array("__automatic__", "xenbr0", "xenbr1", "xenbr2", "xenbr3", "xenbr4"));
}
}
$iplist = $this->vmipaddress_a;
$iplist = implode(", ", get_namelist_from_objectlist($iplist, 'nname'));
$vlist['one_ipaddress_f'] = array('M', $iplist);
$vlist['nameserver'] = null;
return $vlist;
case "ostemplate":
$driverapp = $gbl->getSyncClass($this->__masterserver, $this->listpriv->vpspserver_sing, 'vps');
$ostlist = rl_exec_get(null, $this->listpriv->vpspserver_sing, array("vps__{$driverapp}", "getOsTemplatelist"));
$ostlist = lx_merge_good(array('--defer-osimage--' => '--defer-osimage--'), $ostlist);
$vlist['ostemplate'] = array('A', $ostlist);
return $vlist;
case "changesyncserver":
$sq = new Sqlite(null, 'pserver');
$list = $sq->getTable(array('nname'));
$list = get_namelist_from_arraylist($list);
$vlist['syncserver'] = array('s', $list);
$gbl->__ajax_refresh = true;
return $vlist;
// Only for template...
// Only for template...
case "vpspserver_s":
$listpriv = $parent->listpriv;
$vlist['server_detail_f'] = array('M', pserver::createServerInfo($listpriv->vpspserver_list, "vps"));
$parent = $this->getParentO();
$vlist['vpspserver_sing'] = null;
if (!$this->isRightParent()) {
$this->convertToUnmodifiable($vlist);
}
return $vlist;
}
return parent::updateform($subaction, $param);
}