Version 4.3.0

This commit is contained in:
Neo committed 2025-12-19 05:47:12 -08:00
1 parent 96997ddd8e
commit fe1acf984a
1349 files changed
+116159 -67711

No files matched your search

@@ -93,7 +93,7 @@ class _Upgrade
$container->type = 'block';
$container->order = 0;
$container->parent_id = 0;
$container->key = md5( uniqid() );
$container->key = md5( mt_rand() );
$container->save();
\IPS\Db::i()->update( 'cms_blocks', array( 'block_category' => $container->_id ), array( 'block_category=?', 0 ) );
@@ -0,0 +1,105 @@
<?php
/**
* @brief 4.2.6 Beta 1 Upgrade Code
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Pages
* @since 25 Oct 2017
*/
namespace IPS\cms\setup\upg_102030;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* 4.2.6 Beta 1 Upgrade Code
*/
class _Upgrade
{
/**
* Remove orphaned promotions
*
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
*/
public function step1()
{
$classes = array();
/* Get all existing Content Classes */
foreach( \IPS\Application::allExtensions( 'core', 'ContentRouter', FALSE ) AS $contentRouter )
{
foreach ( $contentRouter->classes as $class )
{
$classes[] = $class;
if ( isset( $class::$commentClass ) )
{
$classes[] = $class::$commentClass;
}
if ( isset( $class::$reviewClass ) )
{
$classes[] = $class::$reviewClass;
}
}
if( isset( $contentRouter->ownedNodes ) )
{
foreach( $contentRouter->ownedNodes as $class )
{
$classes[] = $class;
}
}
}
if( count( $classes ) )
{
/* Delete Promoted Content from all not existing content classes */
\IPS\Db::i()->delete( 'core_social_promote', \IPS\Db::i()->in( 'promote_class', $classes, TRUE ) );
}
return TRUE;
}
/**
* Custom title for this step
*
* @return string
*/
public function step1CustomTitle()
{
return "Cleaning up orphaned promotions";
}
/**
* Cleanup Database Record Slugs
*
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
*/
public function step2()
{
foreach( \IPS\Db::i()->select( '*', 'cms_databases' ) AS $db )
{
\IPS\Db::i()->update( "cms_custom_database_{$db['database_id']}", array( 'record_static_furl' => NULL ), array( "record_static_furl=?", '' ) );
}
return TRUE;
}
/**
* Custom title for this step
*
* @return string
*/
public function step2CustomTitle()
{
return "Cleaning up Database Records";
}
}
@@ -0,0 +1,22 @@
{
"1": {
"method": "addColumn",
"params": [
"cms_database_fields_thumbnails",
{
"name": "thumb_record_id",
"type": "INT",
"length": 0,
"decimals": null,
"values": null,
"allow_null": false,
"default": "0",
"comment": "",
"unsigned": true,
"zerofill": false,
"auto_increment": false,
"binary": false
}
]
}
}
@@ -0,0 +1,93 @@
{
"1": {
"method": "addColumn",
"params": [
"cms_database_reviews",
{
"name": "review_author_response",
"type": "MEDIUMTEXT",
"length": null,
"decimals": null,
"values": null,
"allow_null": true,
"default": null,
"comment": "",
"unsigned": false,
"zerofill": false,
"auto_increment": false,
"binary": false
}
]
},
"2": {
"method": "changeIndex",
"params": [
"cms_database_reviews",
"review_author",
{
"type": "key",
"name": "review_author",
"columns": [
"review_author",
"review_date"
],
"length": [
null,
null
]
}
]
},
"3": {
"method": "addIndex",
"params": [
"cms_database_reviews",
{
"type": "key",
"name": "review_item",
"columns": [
"review_item",
"review_author"
],
"length": [
null,
null
]
}
]
},
"4": {
"method": "addIndex",
"params": [
"cms_database_categories",
{
"type": "key",
"name": "category_select",
"columns": [
"category_parent_id",
"category_position"
],
"length": [
null,
null
]
}
]
},
"5": {
"method": "addIndex",
"params": [
"cms_database_comments",
{
"type": "key",
"name": "comment_ip_address",
"columns": [
"comment_ip_address"
],
"length": [
null
]
}
]
}
}
@@ -0,0 +1,160 @@
<?php
/**
* @brief 4.3.0 Beta 1 Upgrade Code
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Pages
* @since 06 Dec 2017
*/
namespace IPS\cms\setup\upg_103000;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* 4.3.0 Beta 1 Upgrade Code
*/
class _Upgrade
{
/**
* Fix any custom database tables that may be missing record_meta_data
*
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
*/
public function step1()
{
$queries = array();
foreach( \IPS\cms\Databases::databases() as $database )
{
if ( \IPS\Db::i()->checkForTable( 'cms_custom_database_' . $database->id ) AND !\IPS\Db::i()->checkForColumn( 'cms_custom_database_' . $database->id, 'record_meta_data' ) )
{
$column = \IPS\Db::i()->compileColumnDefinition( array(
'name' => 'record_meta_data',
'type' => 'BIT',
'length' => 1,
'allow_null' => FALSE,
'default' => 'b\'0\'',
) );
$queries[] = array(
'table' => 'cms_custom_database_' . $database->id,
'query' => "ALTER TABLE `" . \IPS\Db::i()->prefix . "cms_custom_database_" . $database->id . "` ADD COLUMN " . $column
);
}
}
if( count( $queries ) )
{
$toRun = \IPS\core\Setup\Upgrade::runManualQueries( $queries );
if ( count( $toRun ) )
{
\IPS\core\Setup\Upgrade::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 TRUE;
}
/**
* Custom title for this step
*
* @return string
*/
public function step1CustomTitle()
{
return "Fixing custom database table definitions";
}
/**
* Step 1
* Index pages
*
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
*/
public function step2()
{
\IPS\Task::queue( 'core', 'RebuildSearchIndex', array( 'class' => 'IPS\cms\Pages\PageItem' ), 5 );
return TRUE;
}
/**
* Custom title for this step
*
* @return string
*/
public function step2CustomTitle()
{
return 'Adding pages to search index';
}
/**
* Step 3
* Remove announcement widgets
*
* @return bool
*/
public function step3()
{
foreach( \IPS\Db::i()->select( '*', 'cms_page_widget_areas' ) as $area )
{
$update = FALSE;
$widgets = json_decode( $area['area_widgets'], TRUE );
foreach ( $widgets as $widgetKey => $widget )
{
if( isset( $widget['app'] ) AND $widget['app'] == 'core' AND $widget['key'] == 'announcements' )
{
unset( $widgets[ $widgetKey ] );
$update = TRUE;
}
}
if( $update )
{
\IPS\Db::i()->update( 'cms_page_widget_areas', array( 'area_widgets' => json_encode( array_values( $widgets ) ) ), array( 'area_page_id=? AND area_area=?', $area['area_page_id'], $area['area_area'] ) );
}
}
return TRUE;
}
/**
* Custom title for this step
*
* @return string
*/
public function step3CustomTitle()
{
return "Removing announcement widgets";
}
/**
* Finish - This is run after all apps have been upgraded
*
* @return mixed If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
* @note We opted not to let users run this immediately during the upgrade because of potential issues (it taking a long time and users stopping it or getting frustrated) but we can revisit later
*/
public function finish()
{
$ids = array();
foreach ( \IPS\Db::i()->select( 'database_id', 'cms_databases' ) as $id )
{
$ids[] = $id;
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\cms\Records' . $id, 'count' => 0 ), 4, array( 'class' ) );
}
}
}
@@ -0,0 +1,60 @@
<?php
/**
* @brief 4.3.0 Beta 4 Upgrade Code
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage Pages
* @since 06 Apr 2018
*/
namespace IPS\cms\setup\upg_103004;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* 4.3.0 Beta 4 Upgrade Code
*/
class _Upgrade
{
/**
* Fix Record Views Column Type
*
* @return array If returns TRUE, upgrader will proceed to next step. If it returns any other value, it will set this as the value of the 'extra' GET parameter and rerun this step (useful for loops)
*/
public function step1()
{
foreach( \IPS\cms\Databases::databases() as $database )
{
\IPS\Db::i()->changeColumn( 'cms_custom_database_' . $database->id, 'record_views', array(
'name' => 'record_views',
'type' => 'int',
'length' => 10,
'allow_null' => false,
'default' => '0'
) );
}
return TRUE;
}
/**
* Custom title for this step
*
* @return string
*/
public function step1CustomTitle()
{
return "Fixing custom database table definitions";
}
// You can create as many additional methods (step2, step3, etc.) as is necessary.
// Each step will be executed in a new HTTP request
}
+1 -1
View File
@@ -356,7 +356,7 @@ class _Upgrade
\IPS\Lang::saveCustom( 'cms', 'content_field_' . $field['field_id'], $field['field_name'] );
\IPS\Lang::saveCustom( 'cms', 'content_field_' . $field['field_id'] . '_desc', ( isset( $field['field_description'] ) ) ? $field['field_description'] : '' );
$save = array( 'field_type' => ucfirst( $field['field_type'] ) );
$save = array( 'field_type' => mb_ucfirst( $field['field_type'] ) );
if ( $field['field_type'] == 'input' )
{