4
0
Эх сурвалжийг харах

Merge branch 'v2-develop' of https://github.com/causefx/Organizr into v2-develop

TehMuffinMoo 4 жил өмнө
parent
commit
c5373b38c2

+ 10 - 173
api/classes/organizr.class.php

@@ -263,12 +263,14 @@ class Organizr
 			$disk = $this->checkDisk($directory);
 			$diskLevels = [
 				'warn' => 1000000000,
-				'error' => 100000000
+				'warn_human_readable' => $this->human_filesize(1000000000, 0),
+				'error' => 100000000,
+				'error_human_readable' => $this->human_filesize(100000000, 0),
 			];
-			if ($disk['free'] <= $diskLevels['error']) {
+			if ($disk['free']['raw'] <= $diskLevels['error']) {
 				die($this->showHTML('Low Disk Space', 'You are dangerously low on disk space.<br/>There is only ' . $disk['free']['human_readable'] . ' remaining.<br/><b>Percent Used = ' . $disk['used']['percent_used'] . '%</b>'));
-			} elseif ($disk['free'] <= $diskLevels['warn']) {
-				$this->warnings[] = 'You are low on disk space.  There is only ' . $disk['free']['human_readable'] . ' remaining.';
+			} elseif ($disk['free']['raw'] <= $diskLevels['warn']) {
+				$this->warnings[] = 'You are low on disk space.  There is only ' . $disk['free']['human_readable'] . ' remaining.  This warning shows up because you are past the warning threshold of ' . $diskLevels['warn_human_readable'];
 			}
 		}
 		return true;
@@ -675,12 +677,10 @@ class Organizr
 	{
 		if ($this->hasDB()) {
 			$pluginList = [];
-			foreach ($GLOBALS['plugins'] as $plugin) {
-				foreach ($plugin as $key => $value) {
-					if (strpos($value['license'], $this->config['license']) !== false) {
-						$plugin[$key]['enabled'] = $this->config[$value['configPrefix'] . '-enabled'];
-						$pluginList[$key] = $plugin[$key];
-					}
+			foreach ($GLOBALS['plugins'] as $key => $value) {
+				if (strpos($value['license'], $this->config['license']) !== false) {
+					$GLOBALS['plugins'][$key]['enabled'] = $this->config[$value['configPrefix'] . '-enabled'];
+					$pluginList[$key] = $GLOBALS['plugins'][$key];
 				}
 			}
 			asort($pluginList);
@@ -885,169 +885,6 @@ class Organizr
 		}
 	}
 	
-	public function upgradeCheck()
-	{
-		if ($this->hasDB()) {
-			$tempLock = $this->config['dbLocation'] . 'DBLOCK.txt';
-			$updateComplete = $this->config['dbLocation'] . 'completed.txt';
-			$cleanup = dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'upgrade' . DIRECTORY_SEPARATOR;
-			if (file_exists($updateComplete)) {
-				@unlink($updateComplete);
-				@$this->rrmdir($cleanup);
-			}
-			if (file_exists($tempLock)) {
-				die($this->showHTML('Upgrading', 'Please wait...'));
-			}
-			$updateDB = false;
-			$updateSuccess = true;
-			$compare = new Composer\Semver\Comparator;
-			$oldVer = $this->config['configVersion'];
-			// Upgrade check start for version below
-			$versionCheck = '2.0.0-beta-200';
-			if ($compare->lessThan($oldVer, $versionCheck)) {
-				$updateDB = true;
-				$oldVer = $versionCheck;
-			}
-			// End Upgrade check start for version above
-			// Upgrade check start for version below
-			$versionCheck = '2.0.0-beta-500';
-			if ($compare->lessThan($oldVer, $versionCheck)) {
-				$updateDB = true;
-				$oldVer = $versionCheck;
-			}
-			// End Upgrade check start for version above
-			// Upgrade check start for version below
-			$versionCheck = '2.0.0-beta-800';
-			if ($compare->lessThan($oldVer, $versionCheck)) {
-				$updateDB = true;
-				$oldVer = $versionCheck;
-			}
-			// End Upgrade check start for version above
-			// Upgrade check start for version below
-			$versionCheck = '2.1.0';
-			if ($compare->lessThan($oldVer, $versionCheck)) {
-				$updateDB = false;
-				$oldVer = $versionCheck;
-				$this->upgradeToVersion($versionCheck);
-			}
-			// End Upgrade check start for version above
-			// Upgrade check start for version below
-			$versionCheck = '2.1.400';
-			if ($compare->lessThan($oldVer, $versionCheck)) {
-				$updateDB = false;
-				$oldVer = $versionCheck;
-				$this->upgradeToVersion($versionCheck);
-			}
-			// End Upgrade check start for version above
-			// Upgrade check start for version below
-			$versionCheck = '2.1.525';
-			if ($compare->lessThan($oldVer, $versionCheck)) {
-				$updateDB = false;
-				$oldVer = $versionCheck;
-				$this->upgradeToVersion($versionCheck);
-			}
-			// End Upgrade check start for version above
-			if ($updateDB == true) {
-				//return 'Upgraded Needed - Current Version '.$oldVer.' - New Version: '.$versionCheck;
-				// Upgrade database to latest version
-				$updateSuccess = $this->updateDB($oldVer);
-			}
-			// Update config.php version if different to the installed version
-			if ($updateSuccess && $this->version !== $this->config['configVersion']) {
-				$this->updateConfig(array('apply_CONFIG_VERSION' => $this->version));
-				$this->setLoggerChannel('Update');
-				$this->debug('Updated config version to ' . $this->version);
-			}
-			if ($updateSuccess == false) {
-				die($this->showHTML('Database update failed', 'Please manually check logs and fix - Then reload this page'));
-			}
-			return true;
-		}
-	}
-	
-	public function updateDB($oldVerNum = false)
-	{
-		$tempLock = $this->config['dbLocation'] . 'DBLOCK.txt';
-		if (!file_exists($tempLock)) {
-			touch($tempLock);
-			$migrationDB = 'tempMigration.db';
-			$pathDigest = pathinfo($this->config['dbLocation'] . $this->config['dbName']);
-			if (file_exists($this->config['dbLocation'] . $migrationDB)) {
-				unlink($this->config['dbLocation'] . $migrationDB);
-			}
-			// Create Temp DB First
-			$this->connectOtherDB();
-			$backupDB = $pathDigest['dirname'] . '/' . $pathDigest['filename'] . '[' . date('Y-m-d_H-i-s') . ']' . ($oldVerNum ? '[' . $oldVerNum . ']' : '') . '.bak.db';
-			copy($this->config['dbLocation'] . $this->config['dbName'], $backupDB);
-			$success = $this->createDB($this->config['dbLocation'], true);
-			if ($success) {
-				$response = [
-					array(
-						'function' => 'fetchAll',
-						'query' => array(
-							'SELECT name FROM sqlite_master WHERE type="table"'
-						)
-					),
-				];
-				$tables = $this->processQueries($response);
-				foreach ($tables as $table) {
-					$response = [
-						array(
-							'function' => 'fetchAll',
-							'query' => array(
-								'SELECT * FROM ' . $table['name']
-							)
-						),
-					];
-					$data = $this->processQueries($response);
-					$this->writeLog('success', 'Update Function -  Grabbed Table data for Table: ' . $table['name'], 'Database');
-					foreach ($data as $row) {
-						$response = [
-							array(
-								'function' => 'query',
-								'query' => array(
-									'INSERT into ' . $table['name'],
-									$row
-								)
-							),
-						];
-						$this->processQueries($response, true);
-					}
-					$this->writeLog('success', 'Update Function -  Wrote Table data for Table: ' . $table['name'], 'Database');
-				}
-				$this->writeLog('success', 'Update Function -  All Table data converted - Starting Movement', 'Database');
-				$this->db->disconnect();
-				$this->otherDb->disconnect();
-				// Remove Current Database
-				if (file_exists($this->config['dbLocation'] . $migrationDB)) {
-					$oldFileSize = filesize($this->config['dbLocation'] . $this->config['dbName']);
-					$newFileSize = filesize($this->config['dbLocation'] . $migrationDB);
-					if ($newFileSize > 0) {
-						$this->writeLog('success', 'Update Function -  Table Size of new DB ok..', 'Database');
-						@unlink($this->config['dbLocation'] . $this->config['dbName']);
-						copy($this->config['dbLocation'] . $migrationDB, $this->config['dbLocation'] . $this->config['dbName']);
-						@unlink($this->config['dbLocation'] . $migrationDB);
-						$this->writeLog('success', 'Update Function -  Migrated Old Info to new Database', 'Database');
-						@unlink($tempLock);
-						return true;
-					} else {
-						$this->writeLog('error', 'Update Function -  Filesize is zero', 'Database');
-					}
-				} else {
-					$this->writeLog('error', 'Update Function -  Migration DB does not exist', 'Database');
-				}
-				@unlink($tempLock);
-				return false;
-				
-			} else {
-				$this->writeLog('error', 'Update Function -  Could not create migration DB', 'Database');
-			}
-			@unlink($tempLock);
-			return false;
-		}
-		return false;
-	}
-	
 	// Create config file in the return syntax
 	public function createConfig($array, $path = null, $nest = 0)
 	{

+ 7 - 2
api/functions/log-functions.php

@@ -259,6 +259,7 @@ trait LogFunctions
 					$this->logger = $loggerBuilder->build();
 				} catch (Exception $e) {
 					// nothing so far
+					$this->logger = null;
 				}
 				/* setup:
 				set the log channel before you send log (You can set an optional Username (2nd Variable) | If user is logged already logged in, it will use their username):
@@ -270,7 +271,11 @@ trait LogFunctions
 				exception:
 				$this->critical($exception, $context);
 				*/
+			} else {
+				$this->logger = null;
 			}
+		} else {
+			$this->logger = null;
 		}
 	}
 	
@@ -373,10 +378,10 @@ trait LogFunctions
 				foreach ($logs as $k => $log) {
 					$selected = $i == 0 ? 'selected' : '';
 					preg_match('/[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/', $log, $name);
-					$options .= '<option data-id="' . $k . '" value="api/v2/log/' . $k . '" ' . $selected . '>' . $name[0] . '</option>';
+					$options .= '<option data-id="' . $k . '" value="api/v2/log/' . $k . '?filter=NONE&pageSize=1000&offset=0" ' . $selected . '>' . $name[0] . '</option>';
 					$i++;
 				}
-				return '<select class="form-control choose-organizr-log"><option data-id="all" value="api/v2/log/all">All</option>' . $options . '</select>';
+				return '<select class="form-control choose-organizr-log"><option data-id="all" value="api/v2/log/all?filter=NONE&pageSize=1000&offset=0">All</option>' . $options . '</select>';
 			}
 		}
 		return false;

+ 204 - 0
api/functions/upgrade-functions.php

@@ -2,6 +2,210 @@
 
 trait UpgradeFunctions
 {
+	public function upgradeCheck()
+	{
+		if ($this->hasDB()) {
+			$tempLock = $this->config['dbLocation'] . 'DBLOCK.txt';
+			$updateComplete = $this->config['dbLocation'] . 'completed.txt';
+			$cleanup = dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'upgrade' . DIRECTORY_SEPARATOR;
+			if (file_exists($updateComplete)) {
+				@unlink($updateComplete);
+				@$this->rrmdir($cleanup);
+			}
+			if (file_exists($tempLock)) {
+				die($this->showHTML('Upgrading', 'Please wait...'));
+			}
+			$updateDB = false;
+			$updateSuccess = true;
+			$compare = new Composer\Semver\Comparator;
+			$oldVer = $this->config['configVersion'];
+			// Upgrade check start for version below
+			$versionCheck = '2.0.0-beta-200';
+			if ($compare->lessThan($oldVer, $versionCheck)) {
+				$updateDB = true;
+				$oldVer = $versionCheck;
+			}
+			// End Upgrade check start for version above
+			// Upgrade check start for version below
+			$versionCheck = '2.0.0-beta-500';
+			if ($compare->lessThan($oldVer, $versionCheck)) {
+				$updateDB = true;
+				$oldVer = $versionCheck;
+			}
+			// End Upgrade check start for version above
+			// Upgrade check start for version below
+			$versionCheck = '2.0.0-beta-800';
+			if ($compare->lessThan($oldVer, $versionCheck)) {
+				$updateDB = true;
+				$oldVer = $versionCheck;
+			}
+			// End Upgrade check start for version above
+			// Upgrade check start for version below
+			$versionCheck = '2.1.0';
+			if ($compare->lessThan($oldVer, $versionCheck)) {
+				$updateDB = false;
+				$oldVer = $versionCheck;
+				$this->upgradeToVersion($versionCheck);
+			}
+			// End Upgrade check start for version above
+			// Upgrade check start for version below
+			$versionCheck = '2.1.400';
+			if ($compare->lessThan($oldVer, $versionCheck)) {
+				$updateDB = false;
+				$oldVer = $versionCheck;
+				$this->upgradeToVersion($versionCheck);
+			}
+			// End Upgrade check start for version above
+			// Upgrade check start for version below
+			$versionCheck = '2.1.525';
+			if ($compare->lessThan($oldVer, $versionCheck)) {
+				$updateDB = false;
+				$oldVer = $versionCheck;
+				$this->upgradeToVersion($versionCheck);
+			}
+			// End Upgrade check start for version above
+			if ($updateDB == true) {
+				//return 'Upgraded Needed - Current Version '.$oldVer.' - New Version: '.$versionCheck;
+				// Upgrade database to latest version
+				$updateSuccess = $this->updateDB($oldVer);
+			}
+			// Update config.php version if different to the installed version
+			if ($updateSuccess && $this->version !== $this->config['configVersion']) {
+				$this->updateConfig(array('apply_CONFIG_VERSION' => $this->version));
+				$this->setLoggerChannel('Update');
+				$this->debug('Updated config version to ' . $this->version);
+			}
+			if ($updateSuccess == false) {
+				die($this->showHTML('Database update failed', 'Please manually check logs and fix - Then reload this page'));
+			}
+			return true;
+		}
+	}
+	
+	public function addColumnToDatabase($table = '', $columnName = '', $definition = 'TEXT')
+	{
+		if ($table == '' || $columnName == '' || $definition == '') {
+			return false;
+		}
+		if ($this->hasDB()) {
+			$tableInfo = [
+				array(
+					'function' => 'fetchSingle',
+					'query' => array(
+						'SELECT COUNT(*) AS has_column FROM pragma_table_info(?) WHERE name=?',
+						$table,
+						$columnName
+					)
+				)
+			];
+			$query = $this->processQueries($tableInfo);
+			if (!$query) {
+				$columnAlter = [
+					array(
+						'function' => 'query',
+						'query' => ['ALTER TABLE ? ADD ? ' . $definition,
+							$table,
+							$columnName,
+						]
+					)
+				];
+				$AlterQuery = $this->processQueries($columnAlter);
+				if ($AlterQuery) {
+					$query = $this->processQueries($tableInfo);
+					if ($query) {
+						return true;
+					}
+				}
+			} else {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	public function updateDB($oldVerNum = false)
+	{
+		$tempLock = $this->config['dbLocation'] . 'DBLOCK.txt';
+		if (!file_exists($tempLock)) {
+			touch($tempLock);
+			$migrationDB = 'tempMigration.db';
+			$pathDigest = pathinfo($this->config['dbLocation'] . $this->config['dbName']);
+			if (file_exists($this->config['dbLocation'] . $migrationDB)) {
+				unlink($this->config['dbLocation'] . $migrationDB);
+			}
+			// Create Temp DB First
+			$this->connectOtherDB();
+			$backupDB = $pathDigest['dirname'] . '/' . $pathDigest['filename'] . '[' . date('Y-m-d_H-i-s') . ']' . ($oldVerNum ? '[' . $oldVerNum . ']' : '') . '.bak.db';
+			copy($this->config['dbLocation'] . $this->config['dbName'], $backupDB);
+			$success = $this->createDB($this->config['dbLocation'], true);
+			if ($success) {
+				$response = [
+					array(
+						'function' => 'fetchAll',
+						'query' => array(
+							'SELECT name FROM sqlite_master WHERE type="table"'
+						)
+					),
+				];
+				$tables = $this->processQueries($response);
+				foreach ($tables as $table) {
+					$response = [
+						array(
+							'function' => 'fetchAll',
+							'query' => array(
+								'SELECT * FROM ' . $table['name']
+							)
+						),
+					];
+					$data = $this->processQueries($response);
+					$this->writeLog('success', 'Update Function -  Grabbed Table data for Table: ' . $table['name'], 'Database');
+					foreach ($data as $row) {
+						$response = [
+							array(
+								'function' => 'query',
+								'query' => array(
+									'INSERT into ' . $table['name'],
+									$row
+								)
+							),
+						];
+						$this->processQueries($response, true);
+					}
+					$this->writeLog('success', 'Update Function -  Wrote Table data for Table: ' . $table['name'], 'Database');
+				}
+				$this->writeLog('success', 'Update Function -  All Table data converted - Starting Movement', 'Database');
+				$this->db->disconnect();
+				$this->otherDb->disconnect();
+				// Remove Current Database
+				if (file_exists($this->config['dbLocation'] . $migrationDB)) {
+					$oldFileSize = filesize($this->config['dbLocation'] . $this->config['dbName']);
+					$newFileSize = filesize($this->config['dbLocation'] . $migrationDB);
+					if ($newFileSize > 0) {
+						$this->writeLog('success', 'Update Function -  Table Size of new DB ok..', 'Database');
+						@unlink($this->config['dbLocation'] . $this->config['dbName']);
+						copy($this->config['dbLocation'] . $migrationDB, $this->config['dbLocation'] . $this->config['dbName']);
+						@unlink($this->config['dbLocation'] . $migrationDB);
+						$this->writeLog('success', 'Update Function -  Migrated Old Info to new Database', 'Database');
+						@unlink($tempLock);
+						return true;
+					} else {
+						$this->writeLog('error', 'Update Function -  Filesize is zero', 'Database');
+					}
+				} else {
+					$this->writeLog('error', 'Update Function -  Migration DB does not exist', 'Database');
+				}
+				@unlink($tempLock);
+				return false;
+				
+			} else {
+				$this->writeLog('error', 'Update Function -  Could not create migration DB', 'Database');
+			}
+			@unlink($tempLock);
+			return false;
+		}
+		return false;
+	}
+	
 	public function upgradeToVersion($version = '2.1.0')
 	{
 		switch ($version) {

+ 1 - 1
api/pages/settings-settings-logs.php

@@ -48,7 +48,7 @@ function get_page_settings_settings_logs($Organizr)
 	})
 	.DataTable({
 		"ajax": {
-			"url": "api/v2/log/0",
+			"url": "api/v2/log/0?filter=NONE&pageSize=1000&offset=0",
 			"dataSrc": function(json) {
 				return json.response.data.results;
 			}

+ 2 - 2
api/plugins/bookmark/plugin.php

@@ -1,13 +1,13 @@
 <?php
 // PLUGIN INFORMATION
-$GLOBALS['plugins'][]['Bookmark'] = array( // Plugin Name
+$GLOBALS['plugins']['Bookmark'] = array( // Plugin Name
 	'name' => 'Bookmark', // Plugin Name
 	'author' => 'leet1994', // Who wrote the plugin
 	'category' => 'Utilities', // One to Two Word Description
 	'link' => '', // Link to plugin info
 	'license' => 'personal,business', // License Type use , for multiple
 	'idPrefix' => 'BOOKMARK', // html element id prefix
-	'configPrefix' => 'BOOKMARK', // config file prefix for array items without the hypen
+	'configPrefix' => 'BOOKMARK', // config file prefix for array items without the hyphen
 	'dbPrefix' => 'BOOKMARK', // db prefix
 	'version' => '0.1.0', // SemVer of plugin
 	'image' => 'api/plugins/bookmark/logo.png', // 1:1 non transparent image for plugin

+ 2 - 2
api/plugins/chat/plugin.php

@@ -2,14 +2,14 @@
 // PLUGIN INFORMATION
 use Pusher\PusherException;
 
-$GLOBALS['plugins'][]['Chat'] = array( // Plugin Name
+$GLOBALS['plugins']['Chat'] = array( // Plugin Name
 	'name' => 'Chat', // Plugin Name
 	'author' => 'CauseFX', // Who wrote the plugin
 	'category' => 'Utilities', // One to Two Word Description
 	'link' => '', // Link to plugin info
 	'license' => 'personal,business', // License Type use , for multiple
 	'idPrefix' => 'CHAT', // html element id prefix
-	'configPrefix' => 'CHAT', // config file prefix for array items without the hypen
+	'configPrefix' => 'CHAT', // config file prefix for array items without the hyphen
 	'version' => '1.0.0', // SemVer of plugin
 	'image' => 'api/plugins/chat/logo.png', // 1:1 non transparent image for plugin
 	'settings' => true, // does plugin need a settings modal?

+ 1 - 1
api/plugins/healthChecks/plugin.php

@@ -1,6 +1,6 @@
 <?php
 // PLUGIN INFORMATION
-$GLOBALS['plugins'][]['HealthChecks'] = array( // Plugin Name
+$GLOBALS['plugins']['HealthChecks'] = array( // Plugin Name
 	'name' => 'HealthChecks', // Plugin Name
 	'author' => 'CauseFX', // Who wrote the plugin
 	'category' => 'Utilities', // One to Two Word Description

+ 9 - 0
api/plugins/invites/config.php

@@ -1,12 +1,21 @@
 <?php
 return array(
 	'INVITES-enabled' => false,
+<<<<<<< HEAD
 	'INVITES-Auth-include' => '1',
+=======
+	'INVITES-dbVersion' => '1.0.0',
+>>>>>>> f55aabfda5bcf6310a08a759df52827747ae44a9
 	'INVITES-type-include' => 'plex',
 	'INVITES-plexLibraries' => '',
 	'INVITES-EmbyTemplate' => '',
 	'INVITES-plex-tv-labels' => '',
 	'INVITES-plex-music-labels' => '',
+<<<<<<< HEAD
 	'INVITES-plex-movies-labels' => '',
 	'INVITES-db-version' => '1.1'
 );
+=======
+	'INVITES-plex-movies-labels' => ''
+);
+>>>>>>> f55aabfda5bcf6310a08a759df52827747ae44a9

+ 54 - 4
api/plugins/invites/plugin.php

@@ -1,14 +1,14 @@
 <?php
 // PLUGIN INFORMATION
-$GLOBALS['plugins'][]['Invites'] = array( // Plugin Name
+$GLOBALS['plugins']['Invites'] = array( // Plugin Name
 	'name' => 'Invites', // Plugin Name
 	'author' => 'CauseFX', // Who wrote the plugin
 	'category' => 'Management', // One to Two Word Description
 	'link' => '', // Link to plugin info
 	'license' => 'personal', // License Type use , for multiple
 	'idPrefix' => 'INVITES', // html element id prefix
-	'configPrefix' => 'INVITES', // config file prefix for array items without the hypen
-	'version' => '1.0.0', // SemVer of plugin
+	'configPrefix' => 'INVITES', // config file prefix for array items without the hyphen
+	'version' => '1.1.0', // SemVer of plugin
 	'image' => 'api/plugins/invites/logo.png', // 1:1 non transparent image for plugin
 	'settings' => true, // does plugin need a settings modal?
 	'bind' => true, // use default bind to make settings page - true or false
@@ -18,6 +18,56 @@ $GLOBALS['plugins'][]['Invites'] = array( // Plugin Name
 
 class Invites extends Organizr
 {
+	public function __construct()
+	{
+		parent::__construct();
+		$this->_pluginUpgradeCheck();
+	}
+	
+	public function _pluginUpgradeCheck()
+	{
+		if ($this->hasDB()) {
+			$compare = new Composer\Semver\Comparator;
+			$oldVer = $this->config['INVITES-dbVersion'];
+			// Upgrade check start for version below
+			$versionCheck = '1.1.0';
+			if ($compare->lessThan($oldVer, $versionCheck)) {
+				$oldVer = $versionCheck;
+				$this->_pluginUpgradeToVersion($versionCheck);
+			}
+			// End Upgrade check start for version above
+			// Update config.php version if different to the installed version
+			if ($GLOBALS['plugins']['Invites']['version'] !== $this->config['INVITES-dbVersion']) {
+				$this->updateConfig(array('INVITES-dbVersion' => $oldVer));
+				$this->setLoggerChannel('Invites Plugin');
+				$this->debug('Updated INVITES-dbVersion to ' . $oldVer);
+			}
+			return true;
+		}
+	}
+	
+	public function _pluginUpgradeToVersion($version = '1.1.0')
+	{
+		switch ($version) {
+			case '1.1.0':
+				$this->_addInvitedByColumnToDatabase();
+				break;
+		}
+		$this->setResponse(200, 'Ran plugin update function for version: ' . $version);
+		return true;
+	}
+	
+	public function _addInvitedByColumnToDatabase()
+	{
+		$addColumn = $this->addColumnToDatabase('invites', 'invitedby', 'TEXT');
+		$this->setLoggerChannel('Invites Plugin');
+		if ($addColumn) {
+			$this->info('Updated Invites Database');
+		} else {
+			$this->warning('Could not update Invites Database');
+		}
+	}
+	
 	public function _invitesPluginGetCodes()
 	{
 		if ($this->qualifyRequest(1, false)) {
@@ -556,4 +606,4 @@ class Invites extends Organizr
 		}
 	}
 	
-}
+}

+ 1 - 1
api/plugins/php-mailer/plugin.php

@@ -1,6 +1,6 @@
 <?php
 // PLUGIN INFORMATION
-$GLOBALS['plugins'][]['PHP Mailer'] = array( // Plugin Name
+$GLOBALS['plugins']['PHP Mailer'] = array( // Plugin Name
 	'name' => 'PHP Mailer', // Plugin Name
 	'author' => 'PHP Mailer', // Who wrote the plugin
 	'category' => 'Mail', // One to Two Word Description

+ 2 - 2
api/plugins/speedTest/plugin.php

@@ -1,13 +1,13 @@
 <?php
 // PLUGIN INFORMATION
-$GLOBALS['plugins'][]['SpeedTest'] = array( // Plugin Name
+$GLOBALS['plugins']['SpeedTest'] = array( // Plugin Name
 	'name' => 'SpeedTest', // Plugin Name
 	'author' => 'CauseFX', // Who wrote the plugin
 	'category' => 'Utilities', // One to Two Word Description
 	'link' => '', // Link to plugin info
 	'license' => 'personal,business', // License Type use , for multiple
 	'idPrefix' => 'SPEEDTEST', // html element id prefix
-	'configPrefix' => 'SPEEDTEST', // config file prefix for array items without the hypen
+	'configPrefix' => 'SPEEDTEST', // config file prefix for array items without the hyphen
 	'version' => '1.0.0', // SemVer of plugin
 	'image' => 'api/plugins/speedTest/logo.png', // 1:1 non transparent image for plugin
 	'settings' => true, // does plugin need a settings modal?

+ 4 - 1
api/v2/routes/log.php

@@ -4,7 +4,10 @@ $app->get('/log[/{number}]', function ($request, $response, $args) {
 	if ($Organizr->checkRoute($request)) {
 		if ($Organizr->qualifyRequest(1, true)) {
 			$args['number'] = $args['number'] ?? 0;
-			$Organizr->getLog(1000, 0, 'NONE', $args['number']);
+			$_GET['pageSize'] = $_GET['pageSize'] ?? 1000;
+			$_GET['offset'] = $_GET['offset'] ?? 0;
+			$_GET['filter'] = $_GET['filter'] ?? 'NONE';
+			$Organizr->getLog($_GET['pageSize'], $_GET['offset'], $_GET['filter'], $args['number']);
 		}
 	}
 	$response->getBody()->write(jsonE($GLOBALS['api']));