Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -11,87 +11,116 @@
|
||||
namespace IPS\core\modules\setup\upgrade;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use Exception;
|
||||
use IPS\Application;
|
||||
use IPS\core\Setup\Upgrade;
|
||||
use IPS\Db;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Settings;
|
||||
use IPS\Theme;
|
||||
use UnderflowException;
|
||||
use function count;
|
||||
use function defined;
|
||||
use function is_array;
|
||||
use const IPS\UPGRADE_MD5_CHECK;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrader: System Check
|
||||
*/
|
||||
class _systemcheck extends \IPS\Dispatcher\Controller
|
||||
class systemcheck extends Controller
|
||||
{
|
||||
/**
|
||||
* Show Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function manage()
|
||||
public function manage() : void
|
||||
{
|
||||
/* Do we have an older upgrade session hanging around? */
|
||||
if ( ! isset( \IPS\Request::i()->skippreviousupgrade ) AND \IPS\Db::i()->checkForTable( 'upgrade_temp' ) )
|
||||
if ( ! isset( Request::i()->skippreviousupgrade ) AND Db::i()->checkForTable( 'upgrade_temp' ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$row = \IPS\Db::i()->select( '*', 'upgrade_temp' )->first();
|
||||
$row = Db::i()->select( '*', 'upgrade_temp' )->first();
|
||||
$json = json_decode( $row['upgrade_data'], TRUE );
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
$json = NULL;
|
||||
}
|
||||
|
||||
if ( \is_array( $json ) and isset( $json['session'] ) and isset( $json['data'] ) )
|
||||
if ( is_array( $json ) and isset( $json['session'] ) and isset( $json['data'] ) )
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('unfinished_upgrade');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->unfinishedUpgrade( $json, $row['lastaccess'] );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('unfinished_upgrade');
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global' )->unfinishedUpgrade( $json, $row['lastaccess'] );
|
||||
return;
|
||||
}
|
||||
}
|
||||
elseif( isset( \IPS\Request::i()->skippreviousupgrade ) AND \IPS\Request::i()->skippreviousupgrade )
|
||||
elseif( isset( Request::i()->skippreviousupgrade ) AND Request::i()->skippreviousupgrade )
|
||||
{
|
||||
/* If we skip the previous upgrade remove the temp upgrade data now. That way if we hit utf8 upgrader and come back to upgrader we are
|
||||
not prompted again to continue our upgrade we already elected to start over */
|
||||
\IPS\Db::i()->dropTable( 'upgrade_temp', TRUE );
|
||||
Db::i()->dropTable( 'upgrade_temp', TRUE );
|
||||
}
|
||||
|
||||
/* Do we need to disable designer mode? */
|
||||
if ( isset( \IPS\Request::i()->disableDesignersMode ) )
|
||||
if ( isset( Request::i()->disableDesignersMode ) )
|
||||
{
|
||||
\IPS\Settings::i()->changeValues( array( 'theme_designers_mode' => 0 ) );
|
||||
Settings::i()->changeValues( array( 'theme_designer_mode' => 0 ) );
|
||||
}
|
||||
|
||||
/* Get requirements */
|
||||
$requirements = \IPS\core\Setup\Upgrade::systemRequirements();
|
||||
$designersModeEnabled = ( \IPS\Application::load('core')->long_version >= 40000 and \IPS\Theme::designersModeEnabled() ) ? TRUE : FALSE;
|
||||
|
||||
$requirements = Upgrade::systemRequirements();
|
||||
|
||||
/* Can we just skip this screen? */
|
||||
$canProceed = FALSE;
|
||||
if ( !$designersModeEnabled )
|
||||
$canProceed = !isset( $requirements['advice'] ) or !count( $requirements['advice'] );
|
||||
if ( $canProceed )
|
||||
{
|
||||
$canProceed = !isset( $requirements['advice'] ) or !\count( $requirements['advice'] );
|
||||
if ( $canProceed )
|
||||
foreach ( $requirements['requirements'] as $k => $_requirements )
|
||||
{
|
||||
foreach ( $requirements['requirements'] as $k => $_requirements )
|
||||
foreach ( $_requirements as $item )
|
||||
{
|
||||
foreach ( $_requirements as $item )
|
||||
if ( !$item['success'] )
|
||||
{
|
||||
if ( !$item['success'] )
|
||||
{
|
||||
$canProceed = FALSE;
|
||||
}
|
||||
$canProceed = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check we have the latest version and run an md5 check */
|
||||
$incorrectFiles = array();
|
||||
if ( UPGRADE_MD5_CHECK )
|
||||
{
|
||||
try
|
||||
{
|
||||
$incorrectFiles = Application::md5Check( Application::getAvailableVersion('core') );
|
||||
if ( count( $incorrectFiles ) )
|
||||
{
|
||||
$canProceed = FALSE;
|
||||
}
|
||||
}
|
||||
catch ( Exception $e ) { }
|
||||
}
|
||||
|
||||
/* Display */
|
||||
if ( $canProceed )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal("controller=license&key={$_SESSION['uniqueKey']}") );
|
||||
Output::i()->redirect( Url::internal("controller=license&key={$_SESSION['uniqueKey']}") );
|
||||
}
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('healthcheck');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->healthcheck( $requirements, $designersModeEnabled );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('healthcheck');
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global' )->healthcheck( $requirements, $incorrectFiles );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user