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

@@ -191,7 +191,6 @@
"app=core&module=promotion&controller=sharelinks",
"app=core&module=settings&controller=advanced&do=tasks",
"app=core&module=settings&controller=advanced&searchResult=form_auto_polling_enabled",
"app=core&module=settings&controller=advanced&searchResult=form_lazy_load_enabled",
"app=core&module=settings&controller=advanced&tab=datastore",
"app=core&module=settings&controller=advanced&tab=datastore&searchResult=cache_guest_page",
"app=core&module=settings&controller=advanced&tab=datastore&searchResult=cache_method",
+29 -21
View File
@@ -8,25 +8,35 @@
* @since 16 Jul 2019
*/
use IPS\Application;
use IPS\Content\Search\Elastic\Index;
use IPS\Db;
use IPS\Helpers\Form\CheckboxSet;
use IPS\Helpers\Form\Custom;
use IPS\Helpers\Form\Radio;
use IPS\Http\Url;
use IPS\Settings;
use const IPS\CIC;
$options = array();
require "../upgrade/lang.php";
/* Are we using elasticsearch? Make sure it is 6.0.0 or greater, and warn that it will be disabled if not. */
if( \IPS\Settings::i()->search_method == 'elastic' AND \IPS\Settings::i()->search_elastic_server )
if( Settings::i()->search_method == 'elastic' AND Settings::i()->search_elastic_server )
{
try
{
$response = \IPS\Http\Url::external( rtrim( \IPS\Settings::i()->search_elastic_server, '/' ) )->request()->get()->decodeJson();
$response = Url::external( rtrim( Settings::i()->search_elastic_server, '/' ) )->request()->get()->decodeJson();
}
catch ( \Exception $e )
catch (Exception $e )
{
/* If there's an exception, the server may be down temporarily or something - let's not disable in that case */
}
if ( isset( $response ) AND ( !isset( $response['version']['number'] ) OR version_compare( $response['version']['number'], \IPS\Content\Search\Elastic\Index::MINIMUM_VERSION, '<' ) ) )
if ( isset( $response ) AND ( !isset( $response['version']['number'] ) OR version_compare( $response['version']['number'], Index::MINIMUM_VERSION, '<' ) ) )
{
$options[] = new \IPS\Helpers\Form\Custom( '105000_es_version', null, FALSE, array( 'getHtml' => function( $element ) use ( $response ){
$minimumVersion = \IPS\Content\Search\Elastic\Index::MINIMUM_VERSION;
$options[] = new Custom( '105000_es_version', null, FALSE, array( 'getHtml' => function( $element ) use ( $response ){
$minimumVersion = Index::MINIMUM_VERSION;
$yourVersion = $response['version']['number'];
return "The new minimum supported version of Elasticsearch is {$minimumVersion}, however your server is currently running {$yourVersion}. By continuing, your search engine will revert back to MySQL searching.";
@@ -37,27 +47,25 @@ if( \IPS\Settings::i()->search_method == 'elastic' AND \IPS\Settings::i()->searc
/* Try/catch because this table won't be present yet if coming from 3.x */
try
{
$emailCount = \IPS\Db::i()->select( 'COUNT(*)', 'core_email_templates', array( "template_app=? AND template_name=? AND template_edited=?", 'core', 'admin_reg', 1 ) )->first();
$emailCount = Db::i()->select( 'COUNT(*)', 'core_email_templates', array( "template_app=? AND template_name=? AND template_edited=?", 'core', 'admin_reg', 1 ) )->first();
if ( $emailCount )
{
$options[] = new \IPS\Helpers\Form\Custom( '105000_admin_reg_customized', NULL, FALSE, array( 'getHtml' => function( $element ) {
$options[] = new Custom( '105000_admin_reg_customized', NULL, FALSE, array( 'getHtml' => function( $element ) {
return "Customizations to the 'Admin notification of registration pending approval' email template will be reverted.";
}, 'formatValue' => function( $element ) { return TRUE; } ), function( $val ) { return TRUE; }, NULL, NULL, '105000_admin_reg_customized' );
}
}
catch( \Exception $e ){}
catch(Exception $e ){}
/* Keep bbcode enabled, or disable it? */
$options[] = new \IPS\Helpers\Form\Radio( '105000_enable_bbcode', 'disable', TRUE, array( 'options' => array( 'disable' => '105000_bbcode_disable', 'enable' => '105000_bbcode_enable' ) ) );
/* Combined notifications - again wrapped in a try/catch for 3.4.x upgrades where the table won't exist */
$notificationOptions = array();
try
{
$existingDefaults = iterator_to_array( \IPS\Db::i()->select( '*', 'core_notification_defaults' )->setKeyField('notification_key') );
$existingDefaults = iterator_to_array( Db::i()->select( '*', 'core_notification_defaults' )->setKeyField('notification_key') );
$newDefaults = array();
$extensions = \IPS\Application::allExtensions( 'core', 'Notifications' );
$extensions = Application::allExtensions( 'core', 'Notifications' );
foreach ( $extensions as $group => $extension )
{
try
@@ -85,7 +93,7 @@ try
{
if ( !isset( $notificationOptions["105000_notifications_editable_{$optionKey}"] ) and $newDefaults[$optionKey]['editable'] != $existingDefaults[$type]['editable'] )
{
$notificationOptions["105000_notifications_editable_{$optionKey}"] = new \IPS\Helpers\Form\Radio( "105000_notifications_editable_{$optionKey}", TRUE, FALSE, array('options' => array(
$notificationOptions["105000_notifications_editable_{$optionKey}"] = new Radio( "105000_notifications_editable_{$optionKey}", TRUE, FALSE, array('options' => array(
1 => 'notification_editable_yes',
0 => 'notification_editable_no'
)) );
@@ -94,7 +102,7 @@ try
}
if ( !isset( $notificationOptions["105000_notifications_default_{$optionKey}"] ) and $newDefaults[$optionKey]['default'] != $existingDefaults[$type]['default'] )
{
$notificationOptions["105000_notifications_default_{$optionKey}"] = new \IPS\Helpers\Form\CheckboxSet( "105000_notifications_default_{$optionKey}", $option['default'], FALSE, array('options' => array(
$notificationOptions["105000_notifications_default_{$optionKey}"] = new CheckboxSet( "105000_notifications_default_{$optionKey}", $option['default'], FALSE, array('options' => array(
'inline' => 'notification_method_inline',
'email' => 'notification_method_email'
)) );
@@ -103,7 +111,7 @@ try
}
if ( !isset( $notificationOptions["105000_notifications_disabled_{$optionKey}"] ) and $newDefaults[$optionKey]['disabled'] != $existingDefaults[$type]['disabled'] )
{
$notificationOptions["105000_notifications_disabled_{$optionKey}"] = new \IPS\Helpers\Form\CheckboxSet( "105000_notifications_disabled_{$optionKey}", $option['disabled'], FALSE, array('options' => array(
$notificationOptions["105000_notifications_disabled_{$optionKey}"] = new CheckboxSet( "105000_notifications_disabled_{$optionKey}", $option['disabled'], FALSE, array('options' => array(
'inline' => 'notification_method_inline',
'email' => 'notification_method_email'
)) );
@@ -117,21 +125,21 @@ try
}
}
}
catch( \Exception $e ){}
catch(Exception $e ){}
}
}
catch( \Exception $e ){}
catch(Exception $e ){}
if( !\IPS\CIC )
if( !CIC )
{
/* Use new default pruning preferences? */
$options[] = new \IPS\Helpers\Form\Radio( '105000_prune', 'enable', TRUE, array( 'options' => array( 'disable' => '105000_prune_disable', 'enable' => '105000_prune_enable' ) ) );
$options[] = new Radio( '105000_prune', 'enable', TRUE, array( 'options' => array( 'disable' => '105000_prune_disable', 'enable' => '105000_prune_enable' ) ) );
}
if ( $notificationOptions )
{
$options[] = new \IPS\Helpers\Form\Custom( '105000_notifications', null, FALSE, array( 'getHtml' => function( $element ) use ( $members ){
$options[] = new Custom( '105000_notifications', null, FALSE, array( 'getHtml' => function( $element ) use ( $members ){
return "Some notifications options have been combined to allow members to manage their notification preferences more easily. Some of your default values for the combined options do not match. Please choose how you would like them to be combined:";
} ), function( $val ) {}, NULL, NULL, '105000_notifications' );
$options += $notificationOptions;
+92 -88
View File
@@ -11,16 +11,39 @@
namespace IPS\core\setup\upg_105013;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use DateInterval;
use Exception;
use IPS\Application;
use IPS\Content;
use IPS\Content\Search\Index;
use IPS\core\Setup\Upgrade as UpgradeClass;
use IPS\Data\Store;
use IPS\DateTime;
use IPS\Db;
use IPS\Http\Url;
use IPS\IPS;
use IPS\Request;
use IPS\Settings;
use IPS\Task;
use IPS\Theme;
use OutOfRangeException;
use function count;
use function defined;
use function in_array;
use function intval;
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
{
/**
* Update group anonymous options
@@ -29,9 +52,9 @@ class _Upgrade
*/
public function step1()
{
if ( \IPS\Settings::i()->disable_anonymous )
if ( Settings::i()->disable_anonymous )
{
\IPS\Db::i()->update( 'core_groups', array( "g_hide_online_list" => 2 ), array( "g_hide_online_list!=?", 1 ) );
Db::i()->update( 'core_groups', array( "g_hide_online_list" => 2 ), array( "g_hide_online_list!=?", 1 ) );
}
return TRUE;
@@ -54,10 +77,10 @@ class _Upgrade
*/
public function step2()
{
$existingDefaults = iterator_to_array( \IPS\Db::i()->select( '*', 'core_notification_defaults' )->setKeyField('notification_key') );
$existingDefaults = iterator_to_array( Db::i()->select( '*', 'core_notification_defaults' )->setKeyField('notification_key') );
$newDefaults = array();
$extensions = \IPS\Application::allExtensions( 'core', 'Notifications' );
$extensions = Application::allExtensions( 'core', 'Notifications' );
foreach ( $extensions as $group => $extension )
{
try
@@ -123,11 +146,11 @@ class _Upgrade
}
}
catch( \Exception $e ){}
catch( Exception $e ){}
}
\IPS\Db::i()->delete( 'core_notification_defaults' );
\IPS\Db::i()->insert( 'core_notification_defaults', $newDefaults );
Db::i()->delete( 'core_notification_defaults' );
Db::i()->insert( 'core_notification_defaults', $newDefaults );
return TRUE;
}
@@ -151,17 +174,17 @@ class _Upgrade
{
try
{
if( \IPS\Db::i()->checkForTable('nexus_referrals' ) )
if( Db::i()->checkForTable('nexus_referrals' ) )
{
\IPS\Db::i()->insert( 'core_referrals', \IPS\Db::i()->select( 'member_id, referred_by, amount', 'nexus_referrals' ), FALSE, TRUE );
Db::i()->insert( 'core_referrals', Db::i()->select( 'member_id, referred_by, amount', 'nexus_referrals' ), FALSE, TRUE );
}
if( \IPS\Db::i()->checkForTable('nexus_referral_banners' ) )
if( Db::i()->checkForTable('nexus_referral_banners' ) )
{
\IPS\Db::i()->insert( 'core_referral_banners', \IPS\Db::i()->select( 'rb_id, rb_url, rb_upload, rb_order', 'nexus_referral_banners' ), FALSE, TRUE );
Db::i()->insert( 'core_referral_banners', Db::i()->select( 'rb_id, rb_url, rb_upload, rb_order', 'nexus_referral_banners' ), FALSE, TRUE );
}
}
catch ( \Exception $e ) {}
catch ( Exception $e ) {}
return TRUE;
}
@@ -183,17 +206,17 @@ class _Upgrade
*/
public function step4()
{
if( \IPS\CIC )
if( CIC )
{
/* Reset notification pruning back to default */
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => NULL ), array( \IPS\Db::i()->in( 'conf_key', array( 'prune_member_history', 'prune_notifications' ) ) ) );
Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => NULL ), array( Db::i()->in( 'conf_key', array( 'prune_member_history', 'prune_notifications' ) ) ) );
/* If we are not using the default member history prune preference, initiate the BG task to reset it */
if( !\IPS\Settings::i()->prune_member_history OR \IPS\Settings::i()->prune_member_history != 365 )
if( !Settings::i()->prune_member_history OR Settings::i()->prune_member_history != 365 )
{
\IPS\Task::queue( 'core', 'PruneLargeTable', array(
Task::queue( 'core', 'PruneLargeTable', array(
'table' => 'core_member_history',
'where' => array( 'log_date < ? and log_app != ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P365D' ) )->getTimestamp(), 'nexus' ),
'where' => array( 'log_date < ?', DateTime::create()->sub( new DateInterval( 'P365D' ) )->getTimestamp() ),
'setting' => 'prune_member_history',
), 4 );
}
@@ -201,76 +224,76 @@ class _Upgrade
else
{
/* If this is less than the new minimum, update the setting */
if( \IPS\Settings::i()->prune_notifications > 0 AND \IPS\Settings::i()->prune_notifications < 7 )
if( Settings::i()->prune_notifications > 0 AND Settings::i()->prune_notifications < 7 )
{
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => NULL ), array( 'conf_key=?', 'prune_notifications' ) );
Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => NULL ), array( 'conf_key=?', 'prune_notifications' ) );
}
}
/* Do the initial prune on the potentially large tables */
if ( \IPS\CIC OR ( isset( $_SESSION['upgrade_options']['core']['105000']['prune'] ) AND $_SESSION['upgrade_options']['core']['105000']['prune'] == 'enable' ) )
if ( CIC OR ( isset( $_SESSION['upgrade_options']['core']['105000']['prune'] ) AND $_SESSION['upgrade_options']['core']['105000']['prune'] == 'enable' ) )
{
\IPS\Task::queue( 'core', 'PruneLargeTable', array(
Task::queue( 'core', 'PruneLargeTable', array(
'table' => 'core_members_known_ip_addresses',
'where' => array( 'last_seen < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P365D' ) )->getTimestamp() ),
'where' => array( 'last_seen < ?', DateTime::create()->sub( new DateInterval( 'P365D' ) )->getTimestamp() ),
'setting' => 'prune_known_ips',
), 4 );
\IPS\Task::queue( 'core', 'PruneLargeTable', array(
Task::queue( 'core', 'PruneLargeTable', array(
'table' => 'core_members_known_devices',
'where' => array( 'last_seen < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P365D' ) )->getTimestamp() ),
'where' => array( 'last_seen < ?', DateTime::create()->sub( new DateInterval( 'P365D' ) )->getTimestamp() ),
'setting' => 'prune_known_devices',
), 4 );
\IPS\Task::queue( 'core', 'PruneLargeTable', array(
Task::queue( 'core', 'PruneLargeTable', array(
'table' => 'core_item_markers',
'where' => array( 'item_member_id IN(?)', \IPS\Db::i()->select( 'member_id', 'core_members', array( 'last_activity < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P60D' ) )->getTimestamp() ) ) ),
'where' => array( 'item_member_id IN(?)', Db::i()->select( 'member_id', 'core_members', array( 'last_activity < ?', DateTime::create()->sub( new DateInterval( 'P60D' ) )->getTimestamp() ) ) ),
'setting' => 'prune_item_markers',
'deleteJoin' => array(
'column' => 'member_id',
'table' => 'core_members',
'where' => array( 'last_activity < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P60D' ) )->getTimestamp() ),
'where' => array( 'last_activity < ?', DateTime::create()->sub( new DateInterval( 'P60D' ) )->getTimestamp() ),
'outerColumn' => 'item_member_id'
)
), 4 );
\IPS\Task::queue( 'core', 'PruneLargeTable', array(
Task::queue( 'core', 'PruneLargeTable', array(
'table' => 'core_follow',
'where' => array( 'follow_app!=? AND follow_area!=? AND follow_member_id IN(?)', 'core', 'member', \IPS\Db::i()->select( 'member_id', 'core_members', array( 'last_activity < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P365D' ) )->getTimestamp() ) ) ),
'where' => array( 'follow_app!=? AND follow_area!=? AND follow_member_id IN(?)', 'core', 'member', Db::i()->select( 'member_id', 'core_members', array( 'last_activity < ?', DateTime::create()->sub( new DateInterval( 'P365D' ) )->getTimestamp() ) ) ),
'setting' => 'prune_follows',
'deleteJoin' => array(
'column' => 'member_id',
'table' => 'core_members',
'where' => array( 'last_activity < ?', \IPS\DateTime::create()->sub( new \DateInterval( 'P365D' ) )->getTimestamp() ),
'where' => array( 'last_activity < ?', DateTime::create()->sub( new DateInterval( 'P365D' ) )->getTimestamp() ),
'outerColumn' => 'follow_member_id'
)
), 4 );
}
elseif( !\IPS\CIC AND isset( $_SESSION['upgrade_options']['core']['105000']['prune'] ) AND $_SESSION['upgrade_options']['core']['105000']['prune'] == 'disable' )
elseif( !CIC AND isset( $_SESSION['upgrade_options']['core']['105000']['prune'] ) AND $_SESSION['upgrade_options']['core']['105000']['prune'] == 'disable' )
{
/* We need to insert the settings with values of 0 so they will remain disabled when we import the settings later */
\IPS\Db::i()->replace( 'core_sys_conf_settings', array(
Db::i()->replace( 'core_sys_conf_settings', array(
'conf_key' => 'prune_item_markers',
'conf_value' => '0',
'conf_default' => '60',
'conf_app' => 'core'
) );
\IPS\Db::i()->replace( 'core_sys_conf_settings', array(
Db::i()->replace( 'core_sys_conf_settings', array(
'conf_key' => 'prune_known_ips',
'conf_value' => '0',
'conf_default' => '365',
'conf_app' => 'core'
) );
\IPS\Db::i()->replace( 'core_sys_conf_settings', array(
Db::i()->replace( 'core_sys_conf_settings', array(
'conf_key' => 'prune_known_devices',
'conf_value' => '0',
'conf_default' => '365',
'conf_app' => 'core'
) );
\IPS\Db::i()->replace( 'core_sys_conf_settings', array(
Db::i()->replace( 'core_sys_conf_settings', array(
'conf_key' => 'prune_follows',
'conf_value' => '0',
'conf_default' => '365',
@@ -279,9 +302,9 @@ class _Upgrade
}
/* If this is less than the new minimum, update the setting */
if( \IPS\Settings::i()->prune_log_system > 0 AND \IPS\Settings::i()->prune_log_system < 7 )
if( Settings::i()->prune_log_system > 0 AND Settings::i()->prune_log_system < 7 )
{
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => NULL ), array( 'conf_key=?', 'prune_log_system' ) );
Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => NULL ), array( 'conf_key=?', 'prune_log_system' ) );
}
return TRUE;
@@ -306,30 +329,30 @@ class _Upgrade
{
$validClasses = array();
foreach( \IPS\Content::routedClasses( FALSE, TRUE, TRUE ) as $class )
foreach( Content::routedClasses( FALSE, TRUE, TRUE ) as $class )
{
if( \in_array( 'IPS\Content\Ratings', class_implements( $class ) ) )
if( IPS::classUsesTrait( $class, 'IPS\Content\Ratings' ) )
{
$validClasses[] = $class;
}
}
if( !\count( $validClasses ) )
if( !count( $validClasses ) )
{
return TRUE;
}
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( array( array(
$toRun = UpgradeClass::runManualQueries( array( array(
'table' => 'core_ratings',
'query' => "DELETE FROM `" . \IPS\Db::i()->prefix . "core_ratings` WHERE " . \IPS\Db::i()->in( 'class', $validClasses, TRUE )
'query' => "DELETE FROM `" . Db::i()->prefix . "core_ratings` WHERE " . Db::i()->in( 'class', $validClasses, TRUE )
) ) );
if ( \count( $toRun ) )
if ( count( $toRun ) )
{
\IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 1 => 'core', 'extra' => array( '_upgradeStep' => 6 ) ) );
UpgradeClass::adjustMultipleRedirect( array( 1 => 'core', 'extra' => array( '_upgradeStep' => 6 ) ) );
/* Queries to run manually */
return array( 'html' => \IPS\Theme::i()->getTemplate( 'forms' )->queries( $toRun, \IPS\Http\Url::internal( 'controller=upgrade' )->setQueryString( array( 'key' => $_SESSION['uniqueKey'], 'mr_continue' => 1, 'mr' => \IPS\Request::i()->mr ) ) ) );
return array( 'html' => Theme::i()->getTemplate( 'forms' )->queries( $toRun, Url::internal( 'controller=upgrade' )->setQueryString( array( 'key' => $_SESSION['uniqueKey'], 'mr_continue' => 1, 'mr' => Request::i()->mr ) ) ) );
}
return TRUE;
@@ -354,12 +377,12 @@ class _Upgrade
{
$perCycle = 250;
$did = 0;
$limit = \intval( \IPS\Request::i()->extra );
$limit = intval( Request::i()->extra );
/* Try to prevent timeouts to the extent possible */
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
$cutOff = UpgradeClass::determineCutoff();
foreach( \IPS\Db::i()->select( '*', 'core_content_meta', array( 'meta_type=?', 'core_ContentMessages' ), 'meta_id', array( $limit, $perCycle ) ) as $i )
foreach( Db::i()->select( '*', 'core_content_meta', array( 'meta_type=?', 'core_ContentMessages' ), 'meta_id', array( $limit, $perCycle ) ) as $i )
{
if( $cutOff !== null AND time() >= $cutOff )
{
@@ -370,7 +393,7 @@ class _Upgrade
$meta = json_decode( $i['meta_data'], TRUE);
$meta['is_public'] = TRUE;
\IPS\Db::i()->update('core_content_meta', array('meta_data' => json_encode($meta)), array('meta_id=?', $i['meta_id'] ));
Db::i()->update('core_content_meta', array('meta_data' => json_encode($meta)), array('meta_id=?', $i['meta_id'] ));
}
if ( $did )
@@ -403,7 +426,7 @@ class _Upgrade
public function finish()
{
/* Delete old language strings (yes, these are in core for some reason ) */
\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(
'rss_import_forum_id',
'rss_import_mid',
'rss_import_mid_desc',
@@ -417,87 +440,68 @@ class _Upgrade
/* Revert back to MySQL search if their Elasticsearch version is outdated */
if ( isset( $_SESSION['upgrade_options']['core']['105000']['es_version'] ) AND $_SESSION['upgrade_options']['core']['105000']['es_version'] )
{
\IPS\Settings::i()->changeValues( array( 'search_method' => 'mysql' ) );
Settings::i()->changeValues( array( 'search_method' => 'mysql' ) );
\IPS\Content\Search\Index::i()->rebuild();
Index::i()->rebuild();
}
/* Update user link preference setting for existing installs */
\IPS\Db::i()->replace( 'core_sys_conf_settings', array(
Db::i()->replace( 'core_sys_conf_settings', array(
'conf_key' => 'link_default',
'conf_value' => 'first',
'conf_default' => 'unread',
'conf_app' => 'core'
) );
/* Enable/disable bbcode appropriately */
if ( isset( $_SESSION['upgrade_options']['core']['105000']['enable_bbcode'] ) AND $_SESSION['upgrade_options']['core']['105000']['enable_bbcode'] == 'enable' )
{
/* The setting won't have been inserted yet */
\IPS\Db::i()->replace( 'core_sys_conf_settings', array(
'conf_key' => 'enable_bbcode',
'conf_value' => 1,
'conf_default' => 0,
'conf_app' => 'core'
) );
}
/* Copy Commerce setting to core. It is removed in Commerce upgrader */
\IPS\Db::i()->replace( 'core_sys_conf_settings', array(
Db::i()->replace( 'core_sys_conf_settings', array(
'conf_key' => 'ref_on',
'conf_value' => \IPS\Settings::i()->cm_ref_on ?: 0,
'conf_value' => Settings::i()->cm_ref_on ?: 0,
'conf_default' => 0,
'conf_app' => 'core'
) );
/* Revert admin_reg email templates */
\IPS\Db::i()->delete( 'core_email_templates', array( "template_app=? AND template_name=? AND template_edited=?", 'core', 'admin_reg', 1 ) );
Db::i()->delete( 'core_email_templates', array( "template_app=? AND template_name=? AND template_edited=?", 'core', 'admin_reg', 1 ) );
/* Initiate image proxy rebuilds to remove image proxy */
unset( \IPS\Data\Store::i()->currentImageProxyRebuild );
unset( Store::i()->currentImageProxyRebuild );
if( \IPS\Db::i()->checkForTable('core_image_proxy') )
if( Db::i()->checkForTable('core_image_proxy') )
{
foreach ( \IPS\Content::routedClasses( FALSE, TRUE ) as $class )
foreach ( Content::routedClasses( FALSE, TRUE ) as $class )
{
if( isset( $class::$databaseColumnMap['content'] ) )
{
try
{
\IPS\Task::queue( 'core', 'RebuildImageProxy', array( 'class' => $class ), 4 );
Task::queue( 'core', 'RebuildImageProxy', array( 'class' => $class ), 4 );
}
catch( \OutOfRangeException $ex ) { }
catch( OutOfRangeException $ex ) { }
}
}
foreach( \IPS\Application::allExtensions( 'core', 'EditorLocations', FALSE, NULL, NULL, TRUE, TRUE ) as $_key => $extension )
foreach( Application::allExtensions( 'core', 'EditorLocations', FALSE, NULL, NULL, TRUE, TRUE ) as $_key => $extension )
{
if( method_exists( $extension, 'rebuildImageProxy' ) )
{
\IPS\Task::queue( 'core', 'RebuildImageProxyNonContent', array( 'extension' => $_key ), 4 );
Task::queue( 'core', 'RebuildImageProxyNonContent', array( 'extension' => $_key ), 4 );
}
}
/* Also initiate the task to delete the files. If we are caching indefinitely, files will be retained but the table still should be dropped. */
\IPS\Task::queue( 'core', 'DeleteImageProxyFiles', array(), 5 );
Task::queue( 'core', 'DeleteImageProxyFiles', array(), 5 );
}
/* Disable third party addons to prevent errors post-upgrade */
foreach( \IPS\Application::enabledApplications() as $app )
foreach( Application::enabledApplications() as $app )
{
if( !\in_array( $app->directory, \IPS\IPS::$ipsApps ) )
if( !in_array( $app->directory, IPS::$ipsApps ) )
{
$app->enabled = false;
$app->save();
}
}
foreach( \IPS\Plugin::enabledPlugins() as $plugin )
{
$plugin->enabled = FALSE;
$plugin->save();
}
return TRUE;
}