Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -11,7 +11,7 @@
|
||||
namespace IPS;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -155,9 +155,11 @@ class _Developer
|
||||
$localQueries = json_decode( static::$lastUpdates[ $this->app->directory ]['ran'], TRUE );
|
||||
foreach ( $queries as $q )
|
||||
{
|
||||
if ( is_array( $localQueries ) AND !in_array( $q, $localQueries ) )
|
||||
if ( \is_array( $localQueries ) AND !\in_array( $q, $localQueries ) )
|
||||
{
|
||||
call_user_func_array( array( \IPS\Db::i(), $q['method'] ), $q['params'] );
|
||||
$method = $q['method'];
|
||||
$params = $q['params'];
|
||||
\IPS\Db::i()->$method( ...$params );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,12 +173,14 @@ class _Developer
|
||||
{
|
||||
try
|
||||
{
|
||||
call_user_func_array( array( \IPS\Db::i(), $q['method'] ), $q['params'] );
|
||||
$method = $q['method'];
|
||||
$params = $q['params'];
|
||||
\IPS\Db::i()->$method( ...$params );
|
||||
}
|
||||
catch( \IPS\Db\Exception $e )
|
||||
{
|
||||
/* If the issue is with a create table other than exists, we should just throw it */
|
||||
if ( $q['method'] == 'createTable' and ! in_array( $e->getCode(), array( 1007, 1050 ) ) )
|
||||
if ( $q['method'] == 'createTable' and ! \in_array( $e->getCode(), array( 1007, 1050 ) ) )
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
@@ -222,7 +226,7 @@ class _Developer
|
||||
throw $e;
|
||||
}
|
||||
/* If the error isn't important we should ignore it */
|
||||
else if( !in_array( $e->getCode(), array( 1007, 1008, 1050, 1060, 1061, 1062, 1091 ) ) )
|
||||
else if( !\in_array( $e->getCode(), array( 1007, 1008, 1050, 1060, 1061, 1062, 1091 ) ) )
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
@@ -240,11 +244,11 @@ class _Developer
|
||||
$queries = json_decode( file_get_contents( \IPS\ROOT_PATH . "/applications/{$this->app->directory}/setup/upg_{$latestVersion}/queries.json" ), TRUE );
|
||||
$localQueries = json_decode( static::$lastUpdates[ $this->app->directory ]['ran'], TRUE );
|
||||
|
||||
if( is_array($queries) )
|
||||
if( \is_array($queries) )
|
||||
{
|
||||
foreach ( $queries as $q )
|
||||
{
|
||||
if ( !is_array($localQueries) OR !in_array( $q, $localQueries ) )
|
||||
if ( !\is_array($localQueries) OR !\in_array( $q, $localQueries ) )
|
||||
{
|
||||
/* Check if the table exists, as it may be an import */
|
||||
if ( $q['method'] === 'renameTable' and \IPS\Db::i()->checkForTable( $q['params'][0] ) === FALSE )
|
||||
@@ -263,7 +267,9 @@ class _Developer
|
||||
{
|
||||
try
|
||||
{
|
||||
call_user_func_array( array( \IPS\Db::i(), $q['method'] ), $q['params'] );
|
||||
$method = $q['method'];
|
||||
$params = $q['params'];
|
||||
\IPS\Db::i()->$method( ...$params );
|
||||
}
|
||||
catch ( \IPS\Db\Exception $e ) { }
|
||||
}
|
||||
@@ -277,6 +283,43 @@ class _Developer
|
||||
{
|
||||
$queries = json_decode( file_get_contents( \IPS\ROOT_PATH . "/applications/{$this->app->directory}/setup/upg_{$latestVersion}/queries.json" ), TRUE );
|
||||
}
|
||||
|
||||
/* Sync latest features */
|
||||
if ( \file_exists( \IPS\ROOT_PATH . "/applications/{$this->app->directory}/setup/upg_{$latestVersion}/whatsnew.json" ) )
|
||||
{
|
||||
$data = json_decode( \file_get_contents( \IPS\ROOT_PATH . "/applications/{$this->app->directory}/setup/upg_{$latestVersion}/whatsnew.json" ), TRUE );
|
||||
if ( \count( $data ) )
|
||||
{
|
||||
foreach( $data AS $uid => $row )
|
||||
{
|
||||
try
|
||||
{
|
||||
$feature = \IPS\Application\Feature::load( $uid, 'feature_unique_key' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$feature = new \IPS\Application\Feature;
|
||||
}
|
||||
|
||||
$feature->title = $row['feature_title'];
|
||||
$feature->text = $row['feature_text'];
|
||||
$feature->image = $row['feature_image'];
|
||||
$feature->url = $row['feature_url'];
|
||||
$feature->version_added = $row['feature_version_added'];
|
||||
$feature->app = $row['feature_app'];
|
||||
$feature->unique_key = $row['feature_unique_key'];
|
||||
$feature->save();
|
||||
|
||||
\IPS\Application\Feature::markRead( \IPS\Member::loggedIn(), $feature );
|
||||
|
||||
$filename = explode( '/', $row['feature_image'] );
|
||||
$filename = array_pop( $filename );
|
||||
\IPS\File::create( 'core_Feature', $filename, base64_decode( $row['_image_data'] ), 'features', TRUE, NULL, FALSE );
|
||||
}
|
||||
|
||||
$updated = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for missing tables or columns */
|
||||
@@ -419,7 +462,7 @@ class _Developer
|
||||
/* Remove items not in the JSON file */
|
||||
foreach( $currentSettings as $key => $data )
|
||||
{
|
||||
if ( ! in_array( $data['sc_key'], $jsonKeys ) )
|
||||
if ( ! \in_array( $data['sc_key'], $jsonKeys ) )
|
||||
{
|
||||
\IPS\Db::i()->delete( 'core_theme_settings_fields', array( 'sc_set_id=? AND sc_key=? AND sc_app=?', \IPS\DEFAULT_THEME_ID, $data['sc_key'], $this->app->directory ) );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user