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,23 +11,37 @@
|
||||
namespace IPS\core\modules\setup\upgrade;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Application;
|
||||
use IPS\Data\Store;
|
||||
use IPS\Db;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Theme;
|
||||
use function count;
|
||||
use function defined;
|
||||
|
||||
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: Custom Upgrade Options
|
||||
*/
|
||||
class _customoptions extends \IPS\Dispatcher\Controller
|
||||
class customoptions extends Controller
|
||||
{
|
||||
/**
|
||||
* Show Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function manage()
|
||||
public function manage() : void
|
||||
{
|
||||
$elements = array();
|
||||
|
||||
@@ -38,7 +52,7 @@ class _customoptions extends \IPS\Dispatcher\Controller
|
||||
At the same time we look for any pre-upgrade checks, which completely halt everything. */
|
||||
foreach( $_SESSION['apps'] as $app => $upgrade )
|
||||
{
|
||||
$application = \IPS\Application::load( $app );
|
||||
$application = Application::load( $app );
|
||||
$steps = $application->getUpgradeSteps( $application->long_version );
|
||||
|
||||
foreach( $steps as $step )
|
||||
@@ -50,8 +64,8 @@ class _customoptions extends \IPS\Dispatcher\Controller
|
||||
|
||||
if( $output !== NULL )
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('admin');
|
||||
\IPS\Output::i()->output = $output;
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('admin');
|
||||
Output::i()->output = $output;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -79,27 +93,27 @@ class _customoptions extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Do we need to disable any apps? */
|
||||
if( isset( \IPS\Request::i()->disable ) )
|
||||
if( isset( Request::i()->disable ) )
|
||||
{
|
||||
foreach( explode( ',', \IPS\Request::i()->disable ) as $app )
|
||||
foreach( explode( ',', Request::i()->disable ) as $app )
|
||||
{
|
||||
\IPS\Db::i()->update( 'core_applications', array( 'app_enabled' => 0 ), array( 'app_directory=?', $app ) );
|
||||
Db::i()->update( 'core_applications', array( 'app_enabled' => 0 ), array( 'app_directory=?', $app ) );
|
||||
}
|
||||
|
||||
if ( isset( \IPS\Data\Store::i()->applications ) )
|
||||
if ( isset( Store::i()->applications ) )
|
||||
{
|
||||
unset( \IPS\Data\Store::i()->applications );
|
||||
unset( Store::i()->applications );
|
||||
}
|
||||
}
|
||||
|
||||
/* If there are no options, no need to show an empty/blank form */
|
||||
if( !\count( $elements ) )
|
||||
if( !count( $elements ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=confirm" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
|
||||
Output::i()->redirect( Url::internal( "controller=confirm" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
|
||||
}
|
||||
|
||||
/* Otherwise, show the form */
|
||||
$form = new \IPS\Helpers\Form( 'options', 'continue' );
|
||||
$form = new Form( 'options', 'continue' );
|
||||
|
||||
foreach( $elements as $element )
|
||||
{
|
||||
@@ -120,10 +134,10 @@ class _customoptions extends \IPS\Dispatcher\Controller
|
||||
$_SESSION['upgrade_options'][ $app ][ $version ][ $key ] = $value;
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "controller=confirm" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
|
||||
Output::i()->redirect( Url::internal( "controller=confirm" )->setQueryString( 'key', $_SESSION['uniqueKey'] ) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('admin');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global' )->block( 'admin', $form );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('admin');
|
||||
Output::i()->output = Theme::i()->getTemplate( 'global' )->block( 'admin', $form );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user