Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drupal: PHP7 fixes for boinc modules #2982

Merged
merged 5 commits into from
Jan 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions drupal/sites/default/boinc/modules/boincimport/boincimport.module
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,11 @@ function boincimport_process_form() {
//ini_set('display_errors', TRUE);

// Adjust how long you want the script to run...
if (!ini_get('safe_mode')) {
set_time_limit(variable_get('boincimport_time_limit', 0));
}

 if (!ini_get('safe_mode')) {
// This will always be set on PHP7, but not on PHP5 with safe mode
 set_time_limit(variable_get('boincimport_time_limit', 0));
 }

// Check for a lock on the import process
if (variable_get('boincimport_process_locked', 0)) {
drupal_set_message(t('The import process is locked. If you are sure that
Expand Down Expand Up @@ -477,7 +478,7 @@ function boincimport_users() {
SELECT id FROM {user}
ORDER BY id ASC'
);
$user_count = mysql_num_rows($boinc_accounts);
$user_count = mysqli_num_rows($boinc_accounts);
}
else {
// Need to import any user who is currently ignored in order to keep them
Expand Down Expand Up @@ -508,7 +509,7 @@ function boincimport_users() {
) AS usersToImport",
implode(',', $ignored_user_list)
);
$user_count = mysql_num_rows($boinc_accounts);
$user_count = mysqli_num_rows($boinc_accounts);
}
db_set_active('default');

Expand Down Expand Up @@ -745,7 +746,7 @@ function boincimport_teams() {
FROM %steam',
$pre
);
$team_count = mysql_num_rows($boinc_teams);
$team_count = mysqli_num_rows($boinc_teams);
db_set_active('default');

if (!$team_count) {
Expand Down Expand Up @@ -924,7 +925,7 @@ function boincimport_friends() {
ORDER BY create_time',
$pre, $pre
);
$friendship_count = mysql_num_rows($friendships);
$friendship_count = mysqli_num_rows($friendships);
db_set_active('default');

if (!$friendship_count) {
Expand Down Expand Up @@ -1093,7 +1094,7 @@ function boincimport_preferences() {
WHERE ignorelist <> ''",
$pre
);
$quarreler_count = mysql_num_rows($quarrelers);
$quarreler_count = mysqli_num_rows($quarrelers);
db_set_active('default');

if (!$quarreler_count) {
Expand Down Expand Up @@ -1274,7 +1275,7 @@ function boincimport_private_msgs() {
FROM %sprivate_messages',
$pre
);
$private_msg_count = mysql_num_rows($boinc_private_msgs);
$private_msg_count = mysqli_num_rows($boinc_private_msgs);
db_set_active('default');

if (!$private_msg_count) {
Expand Down Expand Up @@ -1471,15 +1472,15 @@ function boincimport_forum_categories() {
ORDER BY orderID',
$pre
);
$forum_category_count = mysql_num_rows($boinc_forum_categories);
$forum_category_count = mysqli_num_rows($boinc_forum_categories);
$boinc_forums = db_query('
SELECT id, category, title, description, orderID
FROM %sforum
WHERE parent_type = 0
ORDER BY category',
$pre
);
$forum_count = mysql_num_rows($boinc_forums);
$forum_count = mysqli_num_rows($boinc_forums);
db_set_active('default');

if (!$forum_category_count) {
Expand Down Expand Up @@ -2573,7 +2574,7 @@ function boincimport_team_forums() {
ORDER BY id ASC',
$pre
);
$team_forum_count = mysql_num_rows($boincteam_forums);
$team_forum_count = mysqli_num_rows($boincteam_forums);
db_set_active('default');

if (!$team_forum_count) {
Expand Down Expand Up @@ -2772,7 +2773,7 @@ function boincimport_team_forum_topics() {
ORDER BY id',
$pre, $pre, $pre
);
$boincteam_topic_count = mysql_num_rows($boincteam_topics);
$boincteam_topic_count = mysqli_num_rows($boincteam_topics);
$total_team_topic_count = db_result(db_query('
SELECT COUNT(*) FROM %sthread t
JOIN %sforum f ON f.id = t.forum
Expand Down Expand Up @@ -3319,7 +3320,7 @@ function boincimport_subscriptions() {
ORDER BY userid ASC',
$pre
);
$user_count = mysql_num_rows($users_with_subscriptions);
$user_count = mysqli_num_rows($users_with_subscriptions);
db_set_active('default');

if (!$user_count) {
Expand Down Expand Up @@ -3997,7 +3998,7 @@ class BoincImportUrlTransformer {
/**
* Constructor
*/
function BoincImportUrlTransformer() {
function __construct() {
global $base_url;
global $base_path;
$boinc_base_urls = variable_get('boincimport_base_url_boinc', '');
Expand All @@ -4017,6 +4018,11 @@ class BoincImportUrlTransformer {
array(), WATCHDOG_WARNING);
}
}

// old-style constructor for backwards compatibility
function BoincImportUrlTransformer() {
self::__construct();
}

/**
* Get what the new base URL should be (needed for every transformation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ function boincwork_generalprefs_form_submit($form, &$form_state) {
$result = boincwork_save_prefs($prefs, 'general', $venue);

if (!$result) {
watchdog('boincwork', 'Error updating global prefs for user @id: @message', array('@id' => $account->id, '@message' => mysql_error()), WATCHDOG_ERROR);
watchdog('boincwork', 'Error updating global prefs for user @id: @message', array('@id' => $account->id, '@message' => mysqli_error()), WATCHDOG_ERROR);
drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error');
}
elseif (!drupal_get_messages('status', FALSE)) {
Expand Down Expand Up @@ -1363,7 +1363,7 @@ function boincwork_projectprefs_form_submit($form, &$form_state) {
}

if (!$result) {
watchdog('boincwork', 'Error updating project prefs for user @id: @message', array('@id' => $user->id, '@message' => mysql_error()), WATCHDOG_ERROR);
watchdog('boincwork', 'Error updating project prefs for user @id: @message', array('@id' => $user->id, '@message' => mysqli_error()), WATCHDOG_ERROR);
drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error');
}
elseif (!drupal_get_messages('status', FALSE)) {
Expand Down