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

+28 -15
View File
@@ -12,16 +12,29 @@
namespace IPS\cms\setup\upg_105013;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\cms\Templates;
use IPS\core\Setup\Upgrade as UpgradeClass;
use IPS\Db;
use IPS\Http\Url;
use IPS\Lang;
use IPS\Patterns\ActiveRecordIterator;
use IPS\Request;
use IPS\Task;
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;
}
/**
* 4.5.0 Beta 1 Upgrade Code
*/
class _Upgrade
class Upgrade
{
/**
* Adjust database indexes
@@ -32,24 +45,24 @@ class _Upgrade
{
$queries = array();
foreach( \IPS\Db::i()->select( 'database_id', 'cms_databases' ) as $database )
foreach( Db::i()->select( 'database_id', 'cms_databases' ) as $database )
{
$queries[] = array(
'table' => 'cms_custom_database_' . $database,
'query' => "ALTER TABLE `" . \IPS\Db::i()->prefix . "cms_custom_database_{$database}` DROP KEY `category_id`, ADD KEY `category_id` (`category_id`,`record_last_comment`), ADD KEY `future_entries` (`record_future_date`,`record_publish_date`)"
'query' => "ALTER TABLE `" . Db::i()->prefix . "cms_custom_database_{$database}` DROP KEY `category_id`, ADD KEY `category_id` (`category_id`,`record_last_comment`), ADD KEY `future_entries` (`record_future_date`,`record_publish_date`)"
);
}
if( \count( $queries ) )
if( count( $queries ) )
{
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( $queries );
$toRun = UpgradeClass::runManualQueries( $queries );
if ( \count( $toRun ) )
if ( count( $toRun ) )
{
\IPS\core\Setup\Upgrade::adjustMultipleRedirect( array( 1 => 'cms', 'extra' => array( '_upgradeStep' => 2 ) ) );
UpgradeClass::adjustMultipleRedirect( array( 1 => 'cms', 'extra' => array( '_upgradeStep' => 2 ) ) );
/* 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 ) ) ) );
}
}
@@ -74,9 +87,9 @@ class _Upgrade
public function step2()
{
/* Update existing template bits */
foreach( \IPS\Db::i()->select( '*', 'cms_templates', array( 'template_master=0 and template_user_created=1 and template_user_edited=1' ) ) as $key => $template )
foreach( Db::i()->select( '*', 'cms_templates', array( 'template_master=0 and template_user_created=1 and template_user_edited=1' ) ) as $key => $template )
{
$obj = \IPS\cms\Templates::constructFromData( $template );
$obj = Templates::constructFromData( $template );
if ( $obj->getMasterOfThis() and ! $obj->isDifferentFromMaster() )
{
@@ -96,14 +109,14 @@ class _Upgrade
*/
public function step3()
{
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'cms_blocks', array( "block_type=?", 'custom' ) ), 'IPS\cms\Blocks\Block' ) AS $block )
foreach( new ActiveRecordIterator( Db::i()->select( '*', 'cms_blocks', array( "block_type=?", 'custom' ) ), 'IPS\cms\Blocks\Block' ) AS $block )
{
if ( $block->getConfig('editor') !== 'editor' )
{
continue;
}
\IPS\Lang::saveCustom( 'cms', "cms_block_content_{$block->id}", $block->content );
Lang::saveCustom( 'cms', "cms_block_content_{$block->id}", $block->content );
$block->content = NULL;
$block->save();
}
@@ -138,7 +151,7 @@ class _Upgrade
*/
public function finish()
{
\IPS\Task::queue( 'cms', 'FixCommentAttachments', array(), 4 );
Task::queue( 'cms', 'FixCommentAttachments', array(), 4 );
return TRUE;
}