Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

@@ -12,16 +12,25 @@
namespace IPS\forums\setup\upg_105013;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use Exception;
use IPS\Db;
use IPS\Settings;
use IPS\Task;
use UnderflowException;
use function defined;
use const IPS\CIC;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* 4.5.0 Beta 1 Upgrade Code
*/
class _Upgrade
class Upgrade
{
/**
* ...
@@ -31,15 +40,15 @@ class _Upgrade
public function step1()
{
/* Make sure we have the table first */
if( !\IPS\Db::i()->checkForTable('forums_rss_import') )
if( !Db::i()->checkForTable('forums_rss_import') )
{
return TRUE;
}
/* Move over forums_rss_import to core_rss_import */
foreach( \IPS\Db::i()->select( '*', 'forums_rss_import' ) as $rss )
foreach( Db::i()->select( '*', 'forums_rss_import' ) as $rss )
{
$newImportId = \IPS\Db::i()->insert( 'core_rss_import', array(
$newImportId = Db::i()->insert( 'core_rss_import', array(
'rss_import_enabled' => $rss['rss_import_enabled'],
'rss_import_title' => $rss['rss_import_title'],
'rss_import_url' => $rss['rss_import_url'],
@@ -62,13 +71,13 @@ class _Upgrade
try
{
/* Prevent multiple runs from breaking */
\IPS\Db::i()->delete( 'core_rss_imported', array( 'rss_imported_import_id=?', $newImportId ) );
Db::i()->delete( 'core_rss_imported', array( 'rss_imported_import_id=?', $newImportId ) );
\IPS\Db::i()->query( "INSERT INTO " . \IPS\Db::i()->prefix . "core_rss_imported
Db::i()->query( "INSERT INTO " . Db::i()->prefix . "core_rss_imported
(rss_imported_guid, rss_imported_content_id, rss_imported_import_id )
( SELECT a.rss_imported_guid, a.rss_imported_tid, {$newImportId} FROM " . \IPS\Db::i()->prefix . "forums_rss_imported a WHERE a.rss_imported_impid={$rss['rss_import_id']})" );
( SELECT a.rss_imported_guid, a.rss_imported_tid, {$newImportId} FROM " . Db::i()->prefix . "forums_rss_imported a WHERE a.rss_imported_impid={$rss['rss_import_id']})" );
}
catch( \Exception $e ) { }
catch( Exception $e ) { }
}
return TRUE;
@@ -82,13 +91,13 @@ class _Upgrade
public function finish()
{
/* Delete old tasks */
\IPS\Db::i()->delete( 'core_tasks', array( 'app=? and `key`=?', 'forums', 'rssimport' ) );
Db::i()->delete( 'core_tasks', array( 'app=? and `key`=?', 'forums', 'rssimport' ) );
/* Delete old template */
\IPS\Db::i()->delete( 'core_theme_templates', array( 'template_app=? and template_name=?', 'forums', 'importPreview' ) );
Db::i()->delete( 'core_theme_templates', array( 'template_app=? and template_name=?', 'forums', 'importPreview' ) );
/* Delete old language strings */
\IPS\Db::i()->delete( 'core_sys_lang_words', array( 'word_app=? and ' . \IPS\Db::i()->in( 'word_key', array(
Db::i()->delete( 'core_sys_lang_words', array( 'word_app=? and ' . Db::i()->in( 'word_key', array(
'r__rss',
'r__rss_manage',
'r__rss_add',
@@ -100,35 +109,35 @@ class _Upgrade
) ), 'forums' ) );
/* Delete old RSS Table */
if( \IPS\Db::i()->checkForTable('forums_rss_import') )
if( Db::i()->checkForTable('forums_rss_import') )
{
\IPS\Db::i()->dropTable( array( 'forums_rss_import', 'forums_rss_imported' ) );
Db::i()->dropTable( array( 'forums_rss_import', 'forums_rss_imported' ) );
}
/* Kick off solve index build */
\IPS\Task::queue( 'forums', 'RebuildSolvedIndex', array(), 4 );
Task::queue( 'forums', 'RebuildSolvedIndex', array(), 4 );
/* Insert forums_Cards storage extension */
$settings = json_decode( \IPS\Settings::i()->upload_settings, TRUE );
$settings = json_decode( Settings::i()->upload_settings, TRUE );
try
{
if ( \IPS\CIC )
if ( CIC )
{
$configurationId = \IPS\Db::i()->select( 'id', 'core_file_storage', array( "method=?", 'Amazon' ), "id ASC" )->first();
$configurationId = Db::i()->select( 'id', 'core_file_storage', array( "method=?", 'Amazon' ), "id ASC" )->first();
}
else
{
$configurationId = \IPS\Db::i()->select( 'id', 'core_file_storage', array( "method=?", 'FileSystem' ), "id ASC" )->first();
$configurationId = Db::i()->select( 'id', 'core_file_storage', array( "method=?", 'FileSystem' ), "id ASC" )->first();
}
}
catch( \UnderflowException $e )
catch( UnderflowException $e )
{
$configurationId = \IPS\Db::i()->select( 'id', 'core_file_storage', NULL, "id ASC" )->first();
$configurationId = Db::i()->select( 'id', 'core_file_storage', NULL, "id ASC" )->first();
}
$settings['filestorage__forums_Cards'] = $configurationId;
\IPS\Settings::i()->changeValues( array( 'upload_settings' => json_encode( $settings ) ) );
Settings::i()->changeValues( array( 'upload_settings' => json_encode( $settings ) ) );
return TRUE;
}