Version 4.7.0

This commit is contained in:
Neo committed 2025-12-19 16:00:35 -08:00
1 parent 517a5e1f70
commit 8ba7d43898
1933 files changed
+65613 -11332

No files matched your search

@@ -109,7 +109,7 @@ class _upgrade extends \IPS\Dispatcher\Controller
$coreApp->save();
/* Check if we should allow the upgrade to proceed */
if( \IPS\CIC AND \IPS\Cicloud\isManaged() AND isset( $response['blockms'] ) AND $response['blockms'] )
if( \IPS\CIC AND \IPS\IPS::isManaged() )
{
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('system')->upgradeManagedContactUs( \IPS\Cicloud\managedSupportEmail() );
\IPS\Dispatcher::i()->finish();
@@ -187,6 +187,34 @@ class _upgrade extends \IPS\Dispatcher\Controller
/* Do a database check */
if( !\IPS\IPS_ALPHA_BUILD )
{
$md5CheckVersion = NULL;
/* If the files on disk are already newer, set version for MD5 check (i.e. if the files were already applied, but the upgrade hasn't happened) */
if( (int) \IPS\Application::getAvailableVersion('core') > \IPS\Application::load('core')->long_version )
{
$md5CheckVersion = (int) \IPS\Application::getAvailableVersion('core');
}
/* Check our files aren't modified */
if ( !\IPS\Request::i()->skip_md5_check )
{
try
{
$files = \IPS\Application::md5Check( $md5CheckVersion );
if ( \count( $files ) )
{
return \IPS\Theme::i()->getTemplate('system')->upgradeDeltaMd5( $values['version'], $files );
}
}
catch ( \Exception $e ) {}
}
/* If we set a custom md5 check version and it passed, proceed to full upgrader */
if( $md5CheckVersion )
{
\IPS\Output::i()->redirect( 'upgrade/?autologin=1' );
}
/* Run the database check for each IPS app */
foreach ( \IPS\Application::enabledApplications() as $app )
{
if( \in_array( $app->directory, \IPS\IPS::$ipsApps ) )
@@ -197,24 +225,10 @@ class _upgrade extends \IPS\Dispatcher\Controller
}
}
}
/* Check our files aren't modified */
if ( !\IPS\Request::i()->skip_md5_check )
{
try
{
$files = \IPS\Application::md5Check();
if ( \count( $files ) )
{
return \IPS\Theme::i()->getTemplate('system')->upgradeDeltaMd5( $values['version'], $files );
}
}
catch ( \Exception $e ) {}
}
}
/* Get details */
$data = array( 'version' => $values['version'], 'oldVersion' => \intval( \IPS\Application::getAvailableVersion('core') ), 'changes' => array() );
$data = array( 'version' => $values['version'], 'oldVersion' => \IPS\Application::load('core')->long_version, 'changes' => array() );
$data['info'] = $this->_changeDetails( $data['oldVersion'], $values['version'] );
foreach ( $data['info']['steps'] as $k => $v )
{
@@ -236,9 +250,12 @@ class _upgrade extends \IPS\Dispatcher\Controller
foreach ( \IPS\Db::i()->select( array( 'template_id', 'template_set_id', 'template_app', 'template_location', 'template_group', 'template_name' ), 'core_theme_templates', array( 'template_set_id>0' ) ) as $modifiedTemplate )
{
$templateKey = "{$modifiedTemplate['template_location']}/{$modifiedTemplate['template_group']}/{$modifiedTemplate['template_name']}";
if ( \in_array( $modifiedTemplate['template_set_id'], $validThemeIds ) and \in_array( $templateKey, $data['changes']['theme'][ $modifiedTemplate['template_app'] ]['html']['edited'] ) )
if ( isset( $data['changes']['theme'][ $modifiedTemplate['template_app'] ] ) )
{
$conflicts[ $modifiedTemplate['template_set_id'] ]['html'][ $modifiedTemplate['template_app'] . '/' . $templateKey ] = $modifiedTemplate['template_id'];
if ( \in_array( $modifiedTemplate['template_set_id'], $validThemeIds ) and \in_array( $templateKey, $data['changes']['theme'][ $modifiedTemplate['template_app'] ]['html']['edited'] ) )
{
$conflicts[ $modifiedTemplate['template_set_id'] ]['html'][ $modifiedTemplate['template_app'] . '/' . $templateKey ] = $modifiedTemplate['template_id'];
}
}
}
@@ -246,9 +263,12 @@ class _upgrade extends \IPS\Dispatcher\Controller
foreach ( \IPS\Db::i()->select( array( 'css_id', 'css_set_id', 'css_app', 'css_location', 'css_path', 'css_name' ), 'core_theme_css', array( 'css_set_id>0' ) ) as $modifiedCss )
{
$cssKey = "{$modifiedCss['css_location']}/" . ( $modifiedCss['css_path'] ? "{$modifiedCss['css_path']}/" : '' ) . $modifiedCss['css_name'];
if ( \in_array( $modifiedCss['css_set_id'], $validThemeIds ) and \in_array( $cssKey, $data['changes']['theme'][ $modifiedCss['css_app'] ]['css']['edited'] ) )
if ( isset( $data['changes']['theme'][ $modifiedCss['css_app'] ] ) )
{
$conflicts[ $modifiedCss['css_set_id'] ]['css'][ $modifiedCss['css_app'] . '/' . $cssKey ] = $modifiedCss['css_set_id'];
if ( \in_array( $modifiedCss['css_set_id'], $validThemeIds ) and \in_array( $cssKey, $data['changes']['theme'][ $modifiedCss['css_app'] ]['css']['edited'] ) )
{
$conflicts[ $modifiedCss['css_set_id'] ]['css'][ $modifiedCss['css_app'] . '/' . $cssKey ] = $modifiedCss['css_set_id'];
}
}
}
@@ -469,6 +489,16 @@ class _upgrade extends \IPS\Dispatcher\Controller
$form->add( new \IPS\Helpers\Form\Email( 'ips_email_address', NULL ) );
$form->add( new \IPS\Helpers\Form\Password( 'ips_password', NULL ) );
if ( !\IPS\CIC )
{
$form->add( new \IPS\Helpers\Form\YesNo( 'upgrade_confirm_backup', FALSE, TRUE, array(), function( $val ) {
if ( !$val )
{
throw new \DomainException( 'form_required' );
}
} ) );
}
/* Handle submissions */
if ( $values = $form->values() )
{
@@ -656,7 +686,7 @@ class _upgrade extends \IPS\Dispatcher\Controller
\IPS\Settings::i()->changeValues( array( 'upgrade_ftp_details' => $encrypted->tag() ) );
}
$data['ftpDetails'] = $values['delta_upgrade_ftp_details'];
$data['ftpDetails'] = 1;
return $data;
}
@@ -773,6 +803,7 @@ class _upgrade extends \IPS\Dispatcher\Controller
elseif ( $response->httpResponseCode == 206 )
{
$totalFileSize = \intval( mb_substr( $response->httpHeaders['Content-Range'], mb_strpos( $response->httpHeaders['Content-Range'], '/' ) + 1 ) );
$fh = \fopen( $mrData['tmpFileName'], 'a' );
\fwrite( $fh, (string) $response );
\fclose( $fh );
@@ -903,12 +934,12 @@ class _upgrade extends \IPS\Dispatcher\Controller
return;
}
}
}
$perStepPercentage = ( 100 / \count( $steps ) );
}
if ( array_key_exists( $mrData['step'], $steps ) )
if ( \count( $steps ) AND array_key_exists( $mrData['step'], $steps ) )
{
$perStepPercentage = ( 100 / \count( $steps ) );
$step = $steps[ $mrData['step'] ];
$percentage = $perStepPercentage * \intval( $mrData['step'] );
$stepData = isset( $mrData[ $step ] ) ? $mrData[ $step ] : array();