2007-10-26 21:14:35 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2007-10-26 21:14:35 +00:00
|
|
|
|
2011-01-29 06:28:10 +00:00
|
|
|
$d = dirname(__FILE__);
|
|
|
|
require_once("$d/db_conn.inc");
|
|
|
|
require_once("$d/util_basic.inc");
|
2007-10-26 21:14:35 +00:00
|
|
|
|
|
|
|
class BoincDb extends DbConn {
|
2007-10-29 04:02:41 +00:00
|
|
|
static $instance;
|
2007-10-26 21:14:35 +00:00
|
|
|
|
2009-04-17 02:08:05 +00:00
|
|
|
// connect to the database (possibly to a read-only replica)
|
2009-05-20 23:29:54 +00:00
|
|
|
// NOTE: choice of replica can be made only at the page level.
|
|
|
|
// If there's a page that's guaranteed to do only reads, put
|
|
|
|
// BoincDb::get(true);
|
|
|
|
// at the top of it.
|
2009-04-17 02:08:05 +00:00
|
|
|
//
|
|
|
|
static function get_aux($readonly) {
|
|
|
|
$config = get_config();
|
|
|
|
$user = parse_config($config, '<db_user>');
|
|
|
|
$passwd = parse_config($config, '<db_passwd>');
|
|
|
|
$host = parse_config($config, '<db_host>');
|
|
|
|
$replica_host = parse_config($config, '<replica_db_host>');
|
|
|
|
$name = parse_config($config, '<db_name>');
|
|
|
|
if ($host == null) {
|
|
|
|
$host = "localhost";
|
|
|
|
}
|
|
|
|
$instance = new DbConn();
|
|
|
|
if ($readonly && $replica_host) {
|
2011-01-28 22:03:46 +00:00
|
|
|
$x = parse_config($config, '<replica_db_user>');
|
|
|
|
if ($x) $user = $x;
|
|
|
|
$x = parse_config($config, '<replica_db_passwd>');
|
|
|
|
if ($x) $passwd = $x;
|
|
|
|
$x = parse_config($config, '<replica_db_name>');
|
|
|
|
if ($x) $name = $x;
|
2009-04-17 02:08:05 +00:00
|
|
|
$retval = $instance->init_conn($user, $passwd, $replica_host, $name);
|
2009-05-20 23:29:54 +00:00
|
|
|
if ($retval) {
|
|
|
|
self::$instance = $instance;
|
|
|
|
return $instance;
|
|
|
|
}
|
2009-04-17 02:08:05 +00:00
|
|
|
}
|
|
|
|
$retval = $instance->init_conn($user, $passwd, $host, $name);
|
|
|
|
if (!$retval) {
|
|
|
|
$instance = null;
|
2009-05-18 04:18:47 +00:00
|
|
|
} else {
|
|
|
|
$instance->do_query("use $name");
|
2009-05-20 23:29:54 +00:00
|
|
|
// needed for places where we do direct queries
|
2009-04-17 02:08:05 +00:00
|
|
|
}
|
|
|
|
self::$instance = $instance;
|
2009-05-18 04:18:47 +00:00
|
|
|
return $instance;
|
2009-04-17 02:08:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// same, but
|
|
|
|
// 1) check for a cached connection
|
|
|
|
// 2) check whether the "stop_web" trigger file is present
|
|
|
|
//
|
2007-10-29 16:38:25 +00:00
|
|
|
static function get($readonly = false) {
|
2009-04-17 02:08:05 +00:00
|
|
|
if (!isset(self::$instance)) {
|
2008-07-08 21:07:33 +00:00
|
|
|
if (web_stopped()) {
|
2009-07-06 16:33:02 +00:00
|
|
|
show_page("Project down for maintenance",
|
2008-07-08 21:07:33 +00:00
|
|
|
"Please check back in a few hours."
|
|
|
|
);
|
|
|
|
exit;
|
|
|
|
}
|
2009-04-17 02:08:05 +00:00
|
|
|
self::get_aux($readonly);
|
2009-07-06 16:33:02 +00:00
|
|
|
if (!self::$instance) {
|
|
|
|
show_page(
|
|
|
|
"Project is down",
|
|
|
|
"The project's database server is down.
|
|
|
|
Please check back in a few hours."
|
|
|
|
);
|
|
|
|
exit;
|
|
|
|
}
|
2007-10-26 21:14:35 +00:00
|
|
|
}
|
2009-04-17 02:08:05 +00:00
|
|
|
return self::$instance;
|
2007-10-26 21:14:35 +00:00
|
|
|
}
|
2009-04-17 02:08:05 +00:00
|
|
|
|
2007-10-27 20:38:12 +00:00
|
|
|
static function escape_string($string) {
|
2009-02-05 22:16:45 +00:00
|
|
|
$db = self::get();
|
2009-01-20 21:31:13 +00:00
|
|
|
return parent::base_escape_string(trim($string));
|
2007-10-27 20:38:12 +00:00
|
|
|
}
|
2007-11-12 22:28:17 +00:00
|
|
|
static function error() {
|
|
|
|
$db = self::get();
|
|
|
|
return $db->base_error();
|
|
|
|
}
|
2007-10-26 21:14:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class BoincUser {
|
2007-11-10 00:32:42 +00:00
|
|
|
static $cache;
|
2007-10-29 16:38:25 +00:00
|
|
|
static function lookup($clause) {
|
2007-10-26 21:14:35 +00:00
|
|
|
$db = BoincDb::get();
|
2007-10-29 16:38:25 +00:00
|
|
|
return $db->lookup('user', 'BoincUser', $clause);
|
2007-10-26 21:14:35 +00:00
|
|
|
}
|
|
|
|
|
2007-11-10 00:32:42 +00:00
|
|
|
static function lookup_id_nocache($id) {
|
2007-10-26 21:14:35 +00:00
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup_id($id, 'user', 'BoincUser');
|
|
|
|
}
|
2007-11-10 00:32:42 +00:00
|
|
|
static function lookup_id($id) {
|
|
|
|
if (!isset(self::$cache[$id])) {
|
|
|
|
self::$cache[$id] = self::lookup_id_nocache($id);
|
|
|
|
}
|
|
|
|
return self::$cache[$id];
|
|
|
|
}
|
2007-10-26 21:14:35 +00:00
|
|
|
static function count($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->count('user', $clause);
|
|
|
|
}
|
|
|
|
function update($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->update($this, 'user', $clause);
|
|
|
|
}
|
2007-11-05 23:55:33 +00:00
|
|
|
static function enum($where_clause, $order_clause=null) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('user', 'BoincUser', $where_clause, $order_clause);
|
|
|
|
}
|
|
|
|
static function enum_fields($fields, $where_clause, $order_clause=null) {
|
2007-10-26 21:14:35 +00:00
|
|
|
$db = BoincDb::get();
|
2007-11-05 23:55:33 +00:00
|
|
|
return $db->enum_fields(
|
|
|
|
'user', 'BoincUser', $fields, $where_clause, $order_clause
|
|
|
|
);
|
2007-10-26 21:14:35 +00:00
|
|
|
}
|
2007-10-28 15:03:14 +00:00
|
|
|
static function insert($clause) {
|
|
|
|
$db = BoincDb::get();
|
2008-06-24 22:20:40 +00:00
|
|
|
$ret = $db->insert('user', $clause);
|
|
|
|
if (!$ret) return 0;
|
|
|
|
return $db->insert_id();
|
2007-10-28 15:03:14 +00:00
|
|
|
}
|
2007-12-07 23:23:25 +00:00
|
|
|
function delete() {
|
|
|
|
$db = BoincDb::get();
|
2008-10-22 15:49:01 +00:00
|
|
|
$db->delete_aux('profile', "userid=$this->id");
|
2007-12-07 23:23:25 +00:00
|
|
|
return $db->delete($this, 'user');
|
|
|
|
}
|
2011-06-21 22:56:15 +00:00
|
|
|
function sum($field) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->sum('user', $field);
|
|
|
|
}
|
2007-10-26 21:14:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class BoincTeam {
|
2007-11-05 23:55:33 +00:00
|
|
|
static $cache;
|
2007-11-01 17:54:44 +00:00
|
|
|
static function insert($clause) {
|
|
|
|
$db = BoincDb::get();
|
2008-06-24 22:20:40 +00:00
|
|
|
$ret = $db->insert('team', $clause);
|
|
|
|
if (!$ret) return 0;
|
|
|
|
return $db->insert_id();
|
2007-11-01 17:54:44 +00:00
|
|
|
}
|
2007-11-15 22:51:05 +00:00
|
|
|
static function lookup_id_nocache($id) {
|
2007-10-26 21:14:35 +00:00
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup_id($id, 'team', 'BoincTeam');
|
|
|
|
}
|
2007-11-15 22:51:05 +00:00
|
|
|
static function lookup_id($id) {
|
|
|
|
if (!isset(self::$cache[$id])) {
|
|
|
|
self::$cache[$id] = self::lookup_id_nocache($id);
|
2007-11-05 23:55:33 +00:00
|
|
|
}
|
2007-11-15 22:51:05 +00:00
|
|
|
return self::$cache[$id];
|
2007-11-05 23:55:33 +00:00
|
|
|
}
|
2007-10-26 21:14:35 +00:00
|
|
|
function update($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->update($this, 'team', $clause);
|
|
|
|
}
|
2007-10-29 16:38:25 +00:00
|
|
|
static function enum($clause, $clause2=null) {
|
2007-10-26 21:14:35 +00:00
|
|
|
$db = BoincDb::get();
|
2007-10-29 16:38:25 +00:00
|
|
|
return $db->enum('team', 'BoincTeam', $clause, $clause2);
|
2007-10-26 21:14:35 +00:00
|
|
|
}
|
2007-11-01 17:54:44 +00:00
|
|
|
static function lookup($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup('team', 'BoincTeam', $clause);
|
|
|
|
}
|
2007-11-07 17:23:29 +00:00
|
|
|
function delete() {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->delete($this, 'team');
|
|
|
|
}
|
2007-10-26 21:14:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class BoincTeamDelta {
|
2007-10-29 16:38:25 +00:00
|
|
|
static function insert($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->insert('team_delta', $clause);
|
|
|
|
}
|
2007-10-26 21:14:35 +00:00
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('team_delta', 'BoincTeamDelta', $clause);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-27 20:38:12 +00:00
|
|
|
class BoincHost {
|
|
|
|
static function lookup_id($id) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup_id($id, 'host', 'BoincHost');
|
|
|
|
}
|
2007-10-28 15:03:14 +00:00
|
|
|
function update($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->update($this, 'host', $clause);
|
|
|
|
}
|
2007-10-27 20:38:12 +00:00
|
|
|
function delete() {
|
2007-11-06 23:21:55 +00:00
|
|
|
$db = BoincDb::get();
|
2007-10-27 20:38:12 +00:00
|
|
|
return $db->delete($this, 'host');
|
|
|
|
}
|
2007-10-28 15:03:14 +00:00
|
|
|
static function enum($clause, $clause2=null) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('host', 'BoincHost', $clause, $clause2);
|
|
|
|
}
|
2007-10-27 20:38:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class BoincResult {
|
|
|
|
static function count($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->count('result', $clause);
|
|
|
|
}
|
2007-10-28 15:03:14 +00:00
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('result', 'BoincResult', $clause);
|
|
|
|
}
|
2011-06-01 04:29:43 +00:00
|
|
|
static function enum_fields($fields, $where_clause, $order_clause) {
|
|
|
|
$db = BoincDb::get();
|
2011-06-01 04:57:04 +00:00
|
|
|
return $db->enum_fields('result', 'BoincResult', $fields, $where_clause, $order_clause);
|
2011-06-01 04:29:43 +00:00
|
|
|
}
|
2007-10-29 04:02:41 +00:00
|
|
|
static function update_aux($clause) {
|
2007-10-28 15:03:14 +00:00
|
|
|
$db = BoincDb::get();
|
2007-10-29 04:02:41 +00:00
|
|
|
return $db->update_aux('result', $clause);
|
2007-10-28 15:03:14 +00:00
|
|
|
}
|
2007-11-12 22:39:56 +00:00
|
|
|
static function lookup_id($id) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup_id($id, 'result', 'BoincResult');
|
|
|
|
}
|
2011-07-25 21:45:53 +00:00
|
|
|
static function lookup_name($name) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup('result', 'BoincResult', "name='$name'");
|
|
|
|
}
|
2010-08-11 18:52:11 +00:00
|
|
|
function delete() {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->delete($this, 'result');
|
|
|
|
}
|
2007-10-28 15:03:14 +00:00
|
|
|
}
|
|
|
|
|
2007-11-12 22:28:17 +00:00
|
|
|
class BoincWorkunit {
|
|
|
|
static function lookup_id($id) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup_id($id, 'workunit', 'BoincWorkunit');
|
|
|
|
}
|
2010-11-10 22:54:56 +00:00
|
|
|
static function lookup($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup('workunit', 'BoincWorkunit', $clause);
|
|
|
|
}
|
2008-03-04 23:50:38 +00:00
|
|
|
static function insert($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
$ret = $db->insert('workunit', $clause);
|
|
|
|
if (!$ret) return $ret;
|
|
|
|
return $db->insert_id();
|
|
|
|
}
|
2008-07-03 18:41:13 +00:00
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('workunit', 'BoincWorkunit', $clause);
|
|
|
|
}
|
|
|
|
function update($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->update($this, 'workunit', $clause);
|
|
|
|
}
|
2007-11-12 22:28:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class BoincApp {
|
|
|
|
static function lookup_id($id) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup_id($id, 'app', 'BoincApp');
|
|
|
|
}
|
2008-03-04 23:50:38 +00:00
|
|
|
static function lookup($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup('app', 'BoincApp', $clause);
|
|
|
|
}
|
2007-11-12 22:28:17 +00:00
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('app', 'BoincApp', $clause);
|
|
|
|
}
|
2008-03-04 23:50:38 +00:00
|
|
|
static function insert($clause) {
|
|
|
|
$db = BoincDb::get();
|
2008-03-05 20:16:10 +00:00
|
|
|
$ret = $db->insert('app', $clause);
|
|
|
|
if (!$ret) return $ret;
|
|
|
|
return $db->insert_id();
|
2008-03-04 23:50:38 +00:00
|
|
|
}
|
2011-07-12 18:03:20 +00:00
|
|
|
function update($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->update($this, 'app', $clause);
|
|
|
|
}
|
2007-11-12 22:28:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class BoincAppVersion {
|
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('app_version', 'BoincAppVersion', $clause);
|
|
|
|
}
|
2008-03-05 20:16:10 +00:00
|
|
|
static function lookup($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup('app_version', 'BoincAppVersion', $clause);
|
|
|
|
}
|
2010-05-07 21:46:04 +00:00
|
|
|
static function lookup_id($id) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup_id($id, 'app_version', 'BoincAppVersion');
|
|
|
|
}
|
2011-05-12 04:11:40 +00:00
|
|
|
static function insert($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
$ret = $db->insert('app_version', $clause);
|
|
|
|
if (!$ret) return $ret;
|
|
|
|
return $db->insert_id();
|
|
|
|
}
|
2011-07-12 18:03:20 +00:00
|
|
|
function update($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->update($this, 'app_version', $clause);
|
|
|
|
}
|
2007-11-12 22:28:17 +00:00
|
|
|
}
|
|
|
|
|
2007-10-29 04:02:41 +00:00
|
|
|
class BoincProfile {
|
2007-12-23 23:09:10 +00:00
|
|
|
static function lookup_fields($fields, $clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup_fields('profile', 'BoincProfile', $fields, $clause);
|
|
|
|
}
|
2007-10-29 04:02:41 +00:00
|
|
|
static function lookup($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup('profile', 'BoincProfile', $clause);
|
|
|
|
}
|
|
|
|
static function update_aux($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->update_aux('profile', $clause);
|
|
|
|
}
|
|
|
|
static function insert($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->insert('profile', $clause);
|
|
|
|
}
|
2007-10-29 16:38:25 +00:00
|
|
|
static function enum($clause, $clause2=null) {
|
2007-10-29 04:02:41 +00:00
|
|
|
$db = BoincDb::get();
|
2007-10-29 16:38:25 +00:00
|
|
|
return $db->enum('profile', 'BoincProfile', $clause, $clause2);
|
2007-10-29 04:02:41 +00:00
|
|
|
}
|
2007-11-20 19:23:26 +00:00
|
|
|
function delete_aux($clause) {
|
2007-11-12 22:28:17 +00:00
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->delete_aux('profile', $clause);
|
|
|
|
}
|
2007-10-29 04:02:41 +00:00
|
|
|
}
|
|
|
|
|
2007-11-07 17:23:29 +00:00
|
|
|
class BoincTeamAdmin {
|
|
|
|
static function insert($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->insert('team_admin', $clause);
|
|
|
|
}
|
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('team_admin', 'BoincTeamAdmin', $clause);
|
|
|
|
}
|
|
|
|
static function delete($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->delete_aux('team_admin', $clause);
|
|
|
|
}
|
|
|
|
static function lookup($teamid, $userid) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup('team_admin', 'BoincTeamAdmin', "teamid=$teamid and userid=$userid");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-12 16:00:37 +00:00
|
|
|
class BoincPrivateMessage {
|
|
|
|
static function lookup_id($id) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup_id($id, 'private_messages', 'BoincPrivateMessage');
|
|
|
|
}
|
|
|
|
function update($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->update($this, 'private_messages', $clause);
|
|
|
|
}
|
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('private_messages', 'BoincPrivateMessage', $clause);
|
|
|
|
}
|
|
|
|
static function insert($clause) {
|
|
|
|
$db = BoincDb::get();
|
2007-12-30 22:02:16 +00:00
|
|
|
$ret = $db->insert('private_messages', $clause);
|
|
|
|
if (!$ret) return $ret;
|
|
|
|
return $db->insert_id();
|
2007-11-12 16:00:37 +00:00
|
|
|
}
|
|
|
|
static function count($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->count('private_messages', $clause);
|
|
|
|
}
|
|
|
|
function delete() {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->delete($this, 'private_messages');
|
|
|
|
}
|
2007-11-12 22:28:17 +00:00
|
|
|
function delete_aux($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->delete_aux('private_messages', $clause);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class BoincPlatform {
|
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('platform', 'BoincPlatform', $clause);
|
|
|
|
}
|
2008-07-03 18:41:13 +00:00
|
|
|
static function lookup_id($id) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup_id($id, 'platform', 'BoincPlatform');
|
|
|
|
}
|
2007-11-12 16:00:37 +00:00
|
|
|
}
|
|
|
|
|
2010-04-07 20:16:43 +00:00
|
|
|
class BoincHostAppVersion {
|
|
|
|
static function enum($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->enum('host_app_version', 'BoincHostAppVersion', $clause);
|
|
|
|
}
|
2010-05-07 21:46:04 +00:00
|
|
|
static function lookup($host_id, $app_version_id) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->lookup(
|
|
|
|
'host_app_version', 'BoincHostAppVersion',
|
|
|
|
"host_id=$host_id and app_version_id=$app_version_id"
|
|
|
|
);
|
|
|
|
}
|
2011-07-12 18:03:20 +00:00
|
|
|
static function update_aux($clause) {
|
|
|
|
$db = BoincDb::get();
|
|
|
|
return $db->update_aux('host_app_version', $clause);
|
|
|
|
}
|
2010-04-07 20:16:43 +00:00
|
|
|
}
|
|
|
|
|
2007-10-26 21:14:35 +00:00
|
|
|
?>
|