Fixed problem with activivation due to where mysqli_init() was run.
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 11 Sep 2019 20:55:27 +0000 (16:55 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 11 Sep 2019 20:55:27 +0000 (16:55 -0400)
index.php

index 4ba66b6..b3ceb5d 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -41,7 +41,7 @@ require_once 'defines.php';
 require_once GLM_SERVERSTATS_PLUGIN_LIB_PATH.'/smartyTemplateSupport.php';
 
 // Connect to bandwidth database and get all settings for this site
-$bwdb = mysqli_init();
+$bwdb = false;
 $websiteSettings = bandwidthDataConnect(GLM_SERVERSTATS_PLUGIN_HOSTNAME);
 if (!$websiteSettings) {
     wp_die('FAILURE: Unable to connect to GLM Bandwidth database. Please check connection settings in defines.php of this plugin.');
@@ -409,7 +409,9 @@ if (apply_filters('glm-serverstats-is-provider', false) || true) {
  */
 function bandwidthDataConnect($website = false)
 {
+    // Moved msqli_init() to here to be compatible with activation
     global $bwdb;
+    $bwdb = mysqli_init();
 
     $settings = false;