mirror of https://github.com/BOINC/boinc.git
Drupal: Return database queries to use boinc_rw datbase for any query not from tables: result, workunit, app, etc., tables associated with boincwork.
This commit is contained in:
parent
a45c1808a7
commit
a57384a27c
drupal/sites/default/boinc/modules
boinccore
boincimport
boincteam
boincuser
contrib/privatemsg
|
@ -896,7 +896,7 @@ function boinccore_am_set_info() {
|
|||
if (isset($xml['am_set_info_reply']['success'])) {
|
||||
// Find the account in Drupal
|
||||
$boinc_auth = !empty($_POST['account_key']) ? $_POST['account_key'] : $_GET['account_key'];
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$boinc_id = db_result(db_query("
|
||||
SELECT id
|
||||
FROM {user}
|
||||
|
@ -1137,7 +1137,7 @@ function boinccore_team_email_list() {
|
|||
|
||||
if ($boincteam_id && is_numeric($boincteam_id)) {
|
||||
if ($credit_only) {
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$result = db_query("
|
||||
SELECT
|
||||
u.id, u.name, u.cross_project_id, u.email_addr, u.total_credit, u.expavg_credit, u.expavg_time
|
||||
|
@ -1162,7 +1162,7 @@ function boinccore_team_email_list() {
|
|||
}
|
||||
else {
|
||||
// Query BOINC database user table
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$result = db_query("
|
||||
SELECT
|
||||
u.id, u.name, u.cross_project_id, u.create_time, u.email_addr, u.total_credit, u.expavg_credit, u.expavg_time
|
||||
|
|
|
@ -469,7 +469,7 @@ function boincimport_users() {
|
|||
$import_lurkers = variable_get('boincimport_import_lurkers', 1);
|
||||
|
||||
// Determine which users need to be processed
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
if ($import_lurkers) {
|
||||
// Import all users, even those who have no community participation; other
|
||||
// users will be imported when they first try to log into the drupal site
|
||||
|
@ -739,7 +739,7 @@ function boincimport_teams() {
|
|||
$pre = variable_get('boincimport_table_prefix', '');
|
||||
|
||||
// Get the list of teams to import
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$boinc_teams = db_query('
|
||||
SELECT id, name, description, userid, create_time
|
||||
FROM %steam',
|
||||
|
@ -908,7 +908,7 @@ function boincimport_friends() {
|
|||
$pre = variable_get('boincimport_table_prefix', '');
|
||||
|
||||
// Get stuff to import
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$friendships = db_query('
|
||||
SELECT
|
||||
f1.user_src,
|
||||
|
@ -1086,7 +1086,7 @@ function boincimport_preferences() {
|
|||
// to the Drupal ignore users module
|
||||
|
||||
// Find users who are involved in quarrels
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$quarrelers = db_query("
|
||||
SELECT userid, ignorelist
|
||||
FROM %sforum_preferences
|
||||
|
@ -1268,7 +1268,7 @@ function boincimport_private_msgs() {
|
|||
$pre = variable_get('boincimport_table_prefix', '');
|
||||
|
||||
// Get stuff to import
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$boinc_private_msgs = db_query('
|
||||
SELECT id, subject, content, userid, senderid, date, opened
|
||||
FROM %sprivate_messages',
|
||||
|
@ -1464,7 +1464,7 @@ function boincimport_forum_categories() {
|
|||
}
|
||||
|
||||
// Get both categories and forums from BOINC
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$boinc_forum_categories = db_query('
|
||||
SELECT id, name
|
||||
FROM %scategory
|
||||
|
@ -1643,7 +1643,7 @@ function boincimport_forum_categories_op($category, $forum_vid, $pre, $create_hi
|
|||
}
|
||||
else {
|
||||
// If this container is empty, put it into the hidden container
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$forums_contained = db_result(db_query('
|
||||
SELECT count(*) FROM %sforum
|
||||
WHERE parent_type = 0
|
||||
|
@ -1930,7 +1930,7 @@ function boincimport_forum_topics() {
|
|||
$pre = variable_get('boincimport_table_prefix', '');
|
||||
|
||||
// Get the count of non-team topics to import
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$topic_count = db_result(db_query('
|
||||
SELECT COUNT(DISTINCT t.id)
|
||||
FROM %sthread t
|
||||
|
@ -2003,7 +2003,7 @@ function boincimport_topics_op($offset, $batch_size, $pre = '', &$context) {
|
|||
$news_forum_id = variable_get('boincimport_news_forum_id', 0);
|
||||
|
||||
// Get the topic to import
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$topics = db_query('
|
||||
SELECT DISTINCT t.id, t.title, t.owner, t.forum, t.locked, t.hidden,
|
||||
t.sticky, t.timestamp, t.create_time
|
||||
|
@ -2021,7 +2021,7 @@ function boincimport_topics_op($offset, $batch_size, $pre = '', &$context) {
|
|||
|
||||
$error_detail = '';
|
||||
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
|
||||
// Get the content of the post that started the topic
|
||||
$post = db_fetch_object(db_query('
|
||||
|
@ -2233,7 +2233,7 @@ function boincimport_forum_posts() {
|
|||
$pre = variable_get('boincimport_table_prefix', '');
|
||||
|
||||
// Get the BOINC threads and get a count of posts to import
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$topic_count = db_result(db_query("
|
||||
SELECT COUNT(DISTINCT t.id) FROM %sthread t
|
||||
JOIN %sforum f ON f.id = t.forum
|
||||
|
@ -2314,7 +2314,7 @@ function boincimport_posts_op($offset, $batch_size, &$context) {
|
|||
$input_format = variable_get('boincimport_input_format', 0);
|
||||
|
||||
// Get the topics with posts to import
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$boinc_topic_ids = db_query('
|
||||
SELECT DISTINCT t.id FROM %sthread t
|
||||
JOIN %sforum f ON f.id = t.forum
|
||||
|
@ -2328,7 +2328,7 @@ function boincimport_posts_op($offset, $batch_size, &$context) {
|
|||
|
||||
while ($boinc_topic = db_fetch_object($boinc_topic_ids)) {
|
||||
// Get the posts in this topic
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$boinc_posts = db_query('
|
||||
SELECT id, user, thread, timestamp, content, parent_post, hidden
|
||||
FROM %spost WHERE thread = %d ORDER BY id ASC', $pre, $boinc_topic->id);
|
||||
|
@ -2564,7 +2564,7 @@ function boincimport_team_forums() {
|
|||
$pre = variable_get('boincimport_table_prefix', '');
|
||||
|
||||
// Get team forums from BOINC database
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$boincteam_forums = db_query('
|
||||
SELECT id, title, description, category, timestamp, post_min_interval,
|
||||
post_min_total_credit, post_min_expavg_credit
|
||||
|
@ -2761,7 +2761,7 @@ function boincimport_team_forum_topics() {
|
|||
$pre = variable_get('boincimport_table_prefix', '');
|
||||
|
||||
// Get all team topics to import from BOINC
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$boincteam_topics = db_query('
|
||||
SELECT DISTINCT t.id, t.title, t.owner, t.forum, t.locked, t.hidden,
|
||||
t.sticky, t.timestamp, t.create_time
|
||||
|
@ -2867,7 +2867,7 @@ function boincimport_team_topics_op($topic, &$context) {
|
|||
}
|
||||
else {
|
||||
// Get the content of the post that started the topic
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$query = db_query('
|
||||
SELECT id, content
|
||||
FROM %spost
|
||||
|
@ -3033,7 +3033,7 @@ function boincimport_team_forum_posts() {
|
|||
$pre = variable_get('boincimport_table_prefix', '');
|
||||
|
||||
// Get the BOINC threads and get a count of team posts to import
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$team_topic_ids = db_query('
|
||||
SELECT DISTINCT t.id FROM %sthread t
|
||||
JOIN %sforum f ON f.id = t.forum
|
||||
|
@ -3089,7 +3089,7 @@ function boincimport_team_forum_posts() {
|
|||
// Create batches to process
|
||||
while ($boincteam_topic = db_fetch_object($team_topic_ids)) {
|
||||
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$boincteam_posts = db_query('
|
||||
SELECT id, user, thread, timestamp, content, parent_post, hidden
|
||||
FROM %spost
|
||||
|
@ -3312,7 +3312,7 @@ function boincimport_subscriptions() {
|
|||
$pre = variable_get('boincimport_table_prefix', '');
|
||||
|
||||
// Get users with subscriptions to import
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$users_with_subscriptions = db_query('
|
||||
SELECT DISTINCT userid
|
||||
FROM %ssubscriptions
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
$total_count = 0;
|
||||
|
||||
// Get the users with subscriptions to import
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$subscribed_boinc_users = db_query("
|
||||
SELECT DISTINCT userid FROM {subscriptions}
|
||||
ORDER BY userid ASC %s", $limit
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
$count = 0;
|
||||
|
||||
// Get teams from BOINC
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$boincteam = db_fetch_object(db_query('SELECT * FROM team WHERE id=%d', array($team_id)));
|
||||
$boincteam_members = db_query('SELECT id FROM user WHERE teamid=%d', array($team_id));
|
||||
$boincteam_admin = (int) db_result(db_query('SELECT userid FROM team_admin WHERE teamid=%d', array($team_id)));
|
||||
|
@ -75,7 +75,7 @@
|
|||
}
|
||||
|
||||
// Determine team membership
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$boincteam_member_ids = array();
|
||||
while ($boincuser = db_fetch_object($boincteam_members)) $boincteam_member_ids[] = $boincuser->id;
|
||||
db_set_active('default');
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
$count = 0;
|
||||
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
if ($import_lurkers) {
|
||||
$boinc_accounts = db_query('SELECT id FROM user ORDER BY id %s', $limit);
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ function boincteam_get_member_join_date($boincteam_id, $boincuser_id = NULL) {
|
|||
$account = user_load($user->uid);
|
||||
$boincuser_id = $account->boincuser_id;
|
||||
}
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$timestamp = db_result(db_query("
|
||||
SELECT timestamp FROM {team_delta} WHERE
|
||||
userid = %d AND teamid = %d AND joining = 1
|
||||
|
@ -292,7 +292,7 @@ function boincteam_history_xml($team_id) {
|
|||
),
|
||||
);
|
||||
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$result = db_query("
|
||||
SELECT
|
||||
td.userid AS id,
|
||||
|
@ -485,7 +485,7 @@ function boincteam_members_email_list($team_id) {
|
|||
$boincteam_id = boincteam_lookup_id($team_id);
|
||||
$output = '';
|
||||
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$result = db_query("
|
||||
SELECT
|
||||
u.name, u.email_addr
|
||||
|
|
|
@ -23,7 +23,7 @@ function boincteam_views_data() {
|
|||
'field' => 'id',
|
||||
'title' => t('BOINC team'),
|
||||
'help' => t('BOINC data for a team'),
|
||||
'database' => 'boinc_ro'
|
||||
'database' => 'boinc_rw'
|
||||
);
|
||||
|
||||
// This table references the {user} table.
|
||||
|
@ -223,7 +223,7 @@ function boincteam_views_data() {
|
|||
'field' => 'id',
|
||||
'title' => t('BOINC team admins'),
|
||||
'help' => t('BOINC admins for a team'),
|
||||
'database' => 'boinc_ro'
|
||||
'database' => 'boinc_rw'
|
||||
);
|
||||
|
||||
// This table references the {team} table.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
function boincteam_sync() {
|
||||
|
||||
// Get the list of teams to import
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$boinc_teams = db_query('
|
||||
SELECT id, name, description, userid, create_time, seti_id
|
||||
FROM team
|
||||
|
|
|
@ -233,7 +233,7 @@ function boincuser_user($op, &$edit, &$account, $category = NULL) {
|
|||
));
|
||||
$account->boincuser_id = $drupal_user->boinc_id;
|
||||
$account->boincuser_penalty_expiration = $drupal_user->penalty_expiration;
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$boinc_user = db_fetch_object(db_query("
|
||||
SELECT
|
||||
name,
|
||||
|
|
|
@ -23,7 +23,7 @@ function boincuser_views_data() {
|
|||
'field' => 'id',
|
||||
'title' => t('BOINC user'),
|
||||
'help' => t('BOINC account data for a user'),
|
||||
'database' => 'boinc_ro'
|
||||
'database' => 'boinc_rw'
|
||||
);
|
||||
|
||||
// Describe each of the individual fields in this table to Views. For
|
||||
|
|
|
@ -308,7 +308,7 @@ function boincuser_pull_subscriptions($account = NULL) {
|
|||
}
|
||||
|
||||
// Get any subscriptions for this user
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$subscriptions = db_query('
|
||||
SELECT threadid FROM {subscriptions}
|
||||
WHERE userid = %d', $account->boincuser_id);
|
||||
|
|
|
@ -132,7 +132,7 @@ function boincuser_get_first_unread_comment_id($nid, $uid = NULL) {
|
|||
*/
|
||||
function boincuser_select_user_of_the_day() {
|
||||
// First get a list of users with recent credit
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$users_with_credit = db_query("
|
||||
SELECT
|
||||
id
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
%<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
|
@ -1431,7 +1431,7 @@ function privatemsg_user_name_autocomplete($string) {
|
|||
$matches = array();
|
||||
if (!empty($fragment)) {
|
||||
$query = _privatemsg_assemble_query('autocomplete', $fragment, $names);
|
||||
db_set_active('boinc_ro');
|
||||
db_set_active('boinc_rw');
|
||||
$result = db_query_range($query['query'], $fragment, 0, 10);
|
||||
db_set_active('default');
|
||||
$prefix = count($names) ? implode(', ', $names) . ', ' : '';
|
||||
|
|
Loading…
Reference in New Issue