Version 4.7.6
This commit is contained in:
1 parent
8ba7d43898
commit
7b7404e741
1085 files changed
+30590
-7837
No files matched your search
@@ -7,7 +7,7 @@
|
||||
* @package Invision Community
|
||||
* @since 20 May 2014
|
||||
*/
|
||||
|
||||
|
||||
namespace IPS\core\modules\setup\upgrade;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
@@ -25,14 +25,12 @@ class _applications extends \IPS\Dispatcher\Controller
|
||||
/**
|
||||
* Show Form
|
||||
*
|
||||
* @todo [Upgrade] This may not accurately detect older versions - need to test and adjust
|
||||
* @return void
|
||||
*/
|
||||
public function manage()
|
||||
{
|
||||
$apps = array();
|
||||
$defaultTicks = array();
|
||||
|
||||
|
||||
/* Update old app keys or everything gets confused */
|
||||
\IPS\Db::i()->update( 'core_applications', array( 'app_directory' => 'cms' ), array( 'app_directory=?', 'ccs' ) );
|
||||
\IPS\Db::i()->update( 'core_applications', array( 'app_directory' => 'chat' ), array( 'app_directory=?', 'ipchat' ) );
|
||||
@@ -53,13 +51,11 @@ class _applications extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
unset( \IPS\Data\Store::i()->modules );
|
||||
}
|
||||
|
||||
$haltUpgrade = FALSE;
|
||||
|
||||
foreach( \IPS\Application::applications() as $app => $data )
|
||||
{
|
||||
$path = \IPS\Application::getRootPath( $app ) . '/applications/' . $app;
|
||||
|
||||
|
||||
if ( $app == 'chat' )
|
||||
{
|
||||
continue;
|
||||
@@ -70,10 +66,10 @@ class _applications extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* See if there are any errors */
|
||||
$errors = array();
|
||||
|
||||
|
||||
if ( file_exists( $path . '/setup/requirements.php' ) )
|
||||
{
|
||||
require $path . '/setup/requirements.php';
|
||||
@@ -83,19 +79,14 @@ class _applications extends \IPS\Dispatcher\Controller
|
||||
$currentVersion = \IPS\Application::load( $app )->long_version;
|
||||
$availableVersion = \IPS\Application::getAvailableVersion( $app );
|
||||
|
||||
if ( empty( $errors ) AND $availableVersion > $currentVersion )
|
||||
{
|
||||
$defaultTicks[] = $app;
|
||||
}
|
||||
|
||||
$name = $data->_title;
|
||||
|
||||
|
||||
/* Get app name */
|
||||
if ( file_exists( $path . '/data/lang.xml' ) )
|
||||
{
|
||||
$xml = \IPS\Xml\XMLReader::safeOpen( $path . '/data/lang.xml' );
|
||||
$xml->read();
|
||||
|
||||
|
||||
$xml->read();
|
||||
while ( $xml->read() )
|
||||
{
|
||||
@@ -107,110 +98,53 @@ class _applications extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
if( \count( $errors ) )
|
||||
if( $availableVersion > $currentVersion )
|
||||
{
|
||||
$haltUpgrade = TRUE;
|
||||
$apps[ $app ] = array(
|
||||
'name' => $name,
|
||||
'disabled' => ( !empty( $errors ) OR $availableVersion <= $currentVersion ),
|
||||
'errors' => $errors,
|
||||
'current' => \IPS\Application::load( $app )->version,
|
||||
'available' => \IPS\Application::getAvailableVersion( $app, TRUE )
|
||||
);
|
||||
}
|
||||
|
||||
$apps[ $app ] = array(
|
||||
'name' => $name,
|
||||
'disabled' => ( !empty( $errors ) OR $availableVersion <= $currentVersion ),
|
||||
'errors' => $errors,
|
||||
'current' => \IPS\Application::load( $app )->version,
|
||||
'available' => \IPS\Application::getAvailableVersion( $app, TRUE ),
|
||||
'force' => ( ( $app === 'core' or $app === 'cloud' ) and $availableVersion > $currentVersion )
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/* Bring core app to top */
|
||||
$system['core'] = $apps['core'];
|
||||
unset( $apps['core'] );
|
||||
if ( isset( $apps['cloud'] ) )
|
||||
if( \count( $apps ) )
|
||||
{
|
||||
$system['cloud'] = $apps['cloud'];
|
||||
unset( $apps['cloud'] );
|
||||
}
|
||||
$apps = array_merge( $system, $apps );
|
||||
if( \count( $defaultTicks ) )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'applications', 'continue' );
|
||||
$form->add( new \IPS\Helpers\Form\Custom( 'apps', $defaultTicks, TRUE, array(
|
||||
'getHtml' => function( $element ) use ( $apps )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'forms' )->apps( $apps, $element->value );
|
||||
},
|
||||
'validate' => function( $element ) use ( $defaultTicks )
|
||||
{
|
||||
$uninstallable = ( $element->value === NULL ) ? NULL : array_diff( array_keys( $element->value ), $defaultTicks );
|
||||
$_SESSION['apps'] = $apps;
|
||||
|
||||
if ( !empty( $uninstallable ) )
|
||||
{
|
||||
throw new \DomainException;
|
||||
}
|
||||
}
|
||||
) ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
$warnings = array();
|
||||
$coreVersion = array_key_exists( 'core', $_SESSION['apps'] ) ? \IPS\Application::getAvailableVersion( 'core' ) : \IPS\Application::load( 'core' )->long_version;
|
||||
foreach ( \IPS\IPS::$ipsApps as $key )
|
||||
{
|
||||
$_SESSION['apps'] = array();
|
||||
|
||||
if ( $apps['core']['force'] )
|
||||
if ( $key == 'chat' )
|
||||
{
|
||||
$_SESSION['apps']['core'] = 'core';
|
||||
}
|
||||
|
||||
if ( isset( $apps['cloud'] ) and $apps['cloud']['force'] )
|
||||
{
|
||||
$_SESSION['apps']['cloud'] = 'cloud';
|
||||
continue;
|
||||
}
|
||||
|
||||
if( \count( $values['apps'] ) )
|
||||
try
|
||||
{
|
||||
foreach ( $values['apps'] as $k => $v )
|
||||
$appVersion = array_key_exists( $key, $_SESSION['apps'] ) ? \IPS\Application::getAvailableVersion( $key ) : \IPS\Application::load( $key )->long_version;
|
||||
if ( $appVersion != $coreVersion )
|
||||
{
|
||||
if ( !\is_int( $k ) )
|
||||
{
|
||||
$_SESSION['apps'][$k] = $k;
|
||||
}
|
||||
$warnings[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
$warnings = array();
|
||||
$coreVersion = array_key_exists( 'core', $_SESSION['apps'] ) ? \IPS\Application::getAvailableVersion( 'core' ) : \IPS\Application::load( 'core' )->long_version;
|
||||
foreach ( \IPS\IPS::$ipsApps as $key )
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
if ( $key == 'chat' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$appVersion = array_key_exists( $key, $_SESSION['apps'] ) ? \IPS\Application::getAvailableVersion( $key ) : \IPS\Application::load( $key )->long_version;
|
||||
if ( $appVersion != $coreVersion )
|
||||
{
|
||||
$warnings[] = $key;
|
||||
}
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
/* The application is not installed */
|
||||
continue;
|
||||
}
|
||||
/* The application is not installed */
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( \count( $warnings ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=applications&do=warning" )->setQueryString( array( 'key' => $_SESSION['uniqueKey'], 'warnings' => implode( ',', $warnings ) ) ) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=customoptions" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
|
||||
}
|
||||
|
||||
if( $haltUpgrade )
|
||||
if ( \count( $warnings ) )
|
||||
{
|
||||
$form->actionButtons = array( \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->button( "continue", 'submit', null, 'ipsButton ipsButton_disabled', array( 'disabled' => 'disabled' ) ) );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=applications&do=warning" )->setQueryString( array( 'key' => $_SESSION['uniqueKey'], 'warnings' => implode( ',', $warnings ) ) ) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=customoptions" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -222,7 +156,7 @@ class _applications extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('applications');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'applications', $form );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show Warning
|
||||
*
|
||||
@@ -241,7 +175,7 @@ class _applications extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$xml = \IPS\Xml\XMLReader::safeOpen( $path . '/data/lang.xml' );
|
||||
$xml->read();
|
||||
|
||||
|
||||
$xml->read();
|
||||
while ( $xml->read() )
|
||||
{
|
||||
@@ -256,7 +190,7 @@ class _applications extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
}
|
||||
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('applications');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'applications', \IPS\Theme::i()->getTemplate( 'global' )->appWarnings( $apps ) );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user