Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

+29 -3
View File
@@ -26,6 +26,21 @@ abstract class _Store extends AbstractData
* @brief Instance
*/
protected static $instance;
/**
* Available Data Store Methods
* - MUST always return 'Database' and 'FileSystem' options
*
* @return array
*/
public static function availableMethods(): array
{
return [
'Database' => 'IPS\Data\Store\Database',
'FileSystem' => 'IPS\Data\Store\FileSystem',
'Redis' => 'IPS\Data\Store\Redis',
];
}
/**
* Get instance
@@ -38,7 +53,18 @@ abstract class _Store extends AbstractData
{
try
{
$classname = 'IPS\Data\Store\\' . \IPS\STORE_METHOD;
if( !isset( static::availableMethods()[ \IPS\STORE_METHOD ] ) )
{
throw new \IPS\Data\Store\Exception;
}
$classname = static::availableMethods()[ \IPS\STORE_METHOD ];
if( !$classname::supported() )
{
throw new \IPS\Data\Store\Exception;
}
static::$instance = new $classname( json_decode( \IPS\STORE_CONFIG, TRUE ) );
}
catch( \IPS\Data\Store\Exception $e )
@@ -46,11 +72,11 @@ abstract class _Store extends AbstractData
/* Fall back to MySQL (if not using it currently, and then FileSystem if we are) */
if ( \IPS\STORE_METHOD !== 'Database' )
{
$classname = 'IPS\Data\Store\Database';
$classname = static::availableMethods()['Database'];
}
else
{
$classname = 'IPS\Data\Store\FileSystem';
$classname = static::availableMethods()['FileSystem'];
}
static::$instance = new $classname( json_decode( \IPS\STORE_CONFIG, TRUE ) );