Fixed a couple glitches with the PHPGraphLib.
Updated some of the bandwidth graphics.
'type' => 'text',
'required' => true,
'use' => 'a'
+ ),
+
+ // Target Bandwidth in Megabytes
+ 'target' => array (
+ 'field' => 'target',
+ 'type' => 'integer',
+ 'required' => true,
+ 'use' => 'a'
)
);
}
-
}
?>
\ No newline at end of file
}
/*
- * Get bandwidth graph data for Today, This month, Two years
+ * Get bandwidth graph data for Today, Last two months, Last two years
*/
public function bandwidthGetGraphData($graphType = false)
{
FROM rollup
WHERE websitefk = ".$this->siteId."
AND date BETWEEN '$firstMonth' AND '$lastMonth'
- GROUP BY MONTH(date)
+ GROUP BY YEAR(date), MONTH(date)
ORDER BY date ASC
;";
$twoYearData = $this->bwdb->query($sql);
* version from this plugin.
*/
define('GLM_MEMBERS_SERVERSTATS_PLUGIN_VERSION', '0.0.1');
-define('GLM_MEMBERS_SERVERSTATS_PLUGIN_DB_VERSION', '0.0.1');
+define('GLM_MEMBERS_SERVERSTATS_PLUGIN_DB_VERSION', '1.0.0');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
-define('GLM_MEMBERS_SERVERSTATS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.5.0');
+define('GLM_MEMBERS_SERVERSTATS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.5.1');
// Check if plugin version is not current in WordPress option and if needed updated it
if (GLM_MEMBERS_SERVERSTATS_PLUGIN_VERSION != get_option('glmMembersDatabaseServerStatsPluginVersion')) {
* @access public
*/
public $config;
+ /**
+ * Target Monthly Bandwidth
+ *
+ * @var $target
+ * @access public
+ */
+ public $target;
/*
* Constructor
$dbData['website']
);
+ $this->target = $dbData['target'];
+
}
/*
$graphType = $_REQUEST['graphType'];
$interval = 1;
+ $useTarget = false;
switch($graphType) {
case 'twoDay':
$interval = 8;
break;
case 'twoYear':
$interval = 1;
+ $useTarget = true;
break;
default:
die("Invalid bandwidth graph type: $graphType");
// Load PHPGraphLib
require_once(GLM_MEMBERS_PLUGIN_LIB_PATH.'/phpgraphlib-master/phpgraphlib.php');
- // Create graph object
+ // Create graph object and set parameters
$graph = new PHPGraphLib(1200,300);
$graph->setXValues(true);
$graph->setYValues(true);
$graph->addData($data['data_in']);
$graph->addData($data['data_out']);
+ // Set target bandwidth line. Must be set after data sets
+ if ($useTarget) {
+ $graph->setGoalLine(($this->target/1000), "black", "dashed");
+ }
+
// $graph->setTitle($graphTitle); - In this case the graph title is on the pop-up dialog box.
$graph->createGraph();
db_user TINYTEXT NULL, -- User name for database
db_pass TINYTEXT NULL, -- Password for access to database
website TINYTEXT NULL, -- Website name as used in database
+ target INT NULL, -- Target Bandwidth per Month in Megabytes
PRIMARY KEY (id)
);
INSERT INTO {prefix}management
( id, enabled, db_name, db_host, db_user, db_pass, website )
VALUES
- ( 1, true, 'bandwidth', 'angelia.gaslightmedia.com', 'bandwidthRO', ',Wv4W*~^bL_vF3F4PbGsS', '' )
+ ( 1, true, 'bandwidth', 'angelia.gaslightmedia.com', 'bandwidthRO', ',Wv4W*~^bL_vF3F4PbGsS', '', '500' )
;
$glmMembersServerStatsDbVersions = array(
'0.0.1' => array('version' => '0.0.1', 'tables' => 1, 'date' => '8/19/16'),
+ '1.0.0' => array('version' => '1.0.0', 'tables' => 1, 'date' => '8/22/16')
);
--- /dev/null
+-- Gaslight Media Members Database
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 1.1.5
+-- Database Deletion Script
+-- Note: Tables with DELETE CASCADE must appear before referenced table
+--
+-- Multiple tables may be separated by ",".
+
+DROP TABLE IF EXISTS
+ {prefix}management
+;
+
--- /dev/null
+-- Gaslight Media Members Database
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.0.2
+-- Database Update From Previous Version Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashses
+
+-- Add target bandwidth for bandwidth reports
+ALTER TABLE {prefix}management ADD COLUMN target INT;
<center><h3>{$glmSiteTitle}</h3></center>
<p>
<span class="glm-right">{$thisDate}</span>
- <span class="glm-left">Server Bandwidth Stats for Today - Megabytes</span>
+ <span class="glm-left">Server Bandwidth Stats for Today by 10 Min Intervals - Megabytes</span>
</p>
<img src="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=serverBandwidthGraphs&graphType=twoDay">
<p>
<span class="glm-right">{$thisDate}</span>
- <span class="glm-left">Server Bandwidth Stats for this Month - Gigabytes</span>
+ <span class="glm-left">Server Bandwidth Stats for last 2 Months by Day - Gigabytes</span>
</p>
<img src="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=serverBandwidthGraphs&graphType=twoMonth">
<p>
<span class="glm-right">{$thisDate}</span>
- <span class="glm-left">Server Bandwidth Stats for 2 Years - Gigabytes</span>
+ <span class="glm-left">Server Bandwidth Stats for last 2 Years by Month - Gigabytes</span>
</p>
<img src="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=serverBandwidthGraphs&graphType=twoYear">
<center>Color Key: <span style="color: red;">Incoming</span>, <span style="color: green;">Outgoing</span>, <span style="color: blue;">Total</span></center>
{if $serverStatsSettings.fieldFail.website}<p>{$serverStatsSettings.fieldFail.website}</p>{/if}
</td>
</tr>
+ <tr>
+ <th {if $serverStatsSettings.fieldRequired.target}class="glm-required"{/if}>Monthly Target Bandwidth:</th>
+ <td {if $serverStatsSettings.fieldFail.target}class="glm-form-bad-input glm-form-bad-input-misc"{/if}>
+ <input type="text" name="target" value="{$serverStatsSettings.fieldData.target}" class="glm-form-text-input-medium">
+ <br>Monthly target bandwidth is entered in Megabytes without any fractions.
+ {if $serverStatsSettings.fieldFail.target}<p>{$serverStatsSettings.fieldFail.target}</p>{/if}
+ </td>
+ </tr>
</table>
<input type="submit" value="Update Settings" class="button-primary">
</form>