Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

@@ -103,6 +103,14 @@ class _Upgrade
unset( $fields[0] );
}
}
/* Otherwise we need to remove the title field from the fields array */
else
{
if( $titleField = array_search( $db['database_field_title'], $fields ) )
{
unset( $fields[ $titleField ] );
}
}
/* Do we need to reset the content field, i.e. if it was mapped to primary_id_field? */
if( !is_numeric( $db['database_field_content'] ) AND count( $fields ) )
@@ -0,0 +1,242 @@
{
"1": {
"method": "createTable",
"params": [
{
"name": "cms_media",
"columns": {
"media_id": {
"allow_null": false,
"auto_increment": true,
"binary": false,
"comment": "",
"decimals": null,
"default": null,
"length": 10,
"name": "media_id",
"type": "INT",
"unsigned": false,
"values": [],
"zerofill": false
},
"media_parent": {
"allow_null": false,
"auto_increment": false,
"binary": false,
"comment": "",
"decimals": null,
"default": "0",
"length": 10,
"name": "media_parent",
"type": "INT",
"unsigned": false,
"values": [],
"zerofill": false
},
"media_filename": {
"allow_null": false,
"auto_increment": false,
"binary": false,
"comment": "",
"decimals": null,
"default": "",
"length": 255,
"name": "media_filename",
"type": "VARCHAR",
"unsigned": false,
"values": [],
"zerofill": false
},
"media_data": {
"allow_null": true,
"auto_increment": false,
"binary": false,
"comment": "",
"decimals": null,
"default": null,
"length": 0,
"name": "media_data",
"type": "MEDIUMBLOB",
"unsigned": false,
"values": [],
"zerofill": false
},
"media_added": {
"allow_null": false,
"auto_increment": false,
"binary": false,
"comment": "",
"decimals": null,
"default": "0",
"length": 10,
"name": "media_added",
"type": "INT",
"unsigned": false,
"values": [],
"zerofill": false
},
"media_full_path": {
"allow_null": true,
"auto_increment": false,
"binary": false,
"comment": "",
"decimals": null,
"default": null,
"length": 0,
"name": "media_full_path",
"type": "TEXT",
"unsigned": false,
"values": [],
"zerofill": false
},
"media_file_object": {
"name": "media_file_object",
"type": "TEXT",
"length": null,
"decimals": null,
"values": [],
"allow_null": true,
"default": null,
"comment": "",
"unsigned": false,
"zerofill": false,
"auto_increment": false,
"binary": false
},
"media_filename_stored": {
"name": "media_filename_stored",
"type": "TEXT",
"length": null,
"decimals": null,
"values": [],
"allow_null": true,
"default": null,
"comment": "",
"unsigned": false,
"zerofill": false,
"auto_increment": false,
"binary": false
},
"media_is_image": {
"name": "media_is_image",
"type": "TINYINT",
"length": 1,
"decimals": null,
"values": [],
"allow_null": false,
"default": "0",
"comment": "",
"unsigned": true,
"zerofill": false,
"auto_increment": false,
"binary": false
}
},
"indexes": {
"PRIMARY": {
"type": "primary",
"name": "PRIMARY",
"length": [
null
],
"columns": [
"media_id"
]
}
},
"collation": "latin1_swedish_ci",
"engine": "InnoDB"
}
]
},
"2": {
"method": "createTable",
"params": [
{
"name": "cms_media_folders",
"columns": {
"media_folder_id": {
"allow_null": false,
"auto_increment": true,
"binary": false,
"comment": "",
"decimals": null,
"default": null,
"length": 10,
"name": "media_folder_id",
"type": "INT",
"unsigned": false,
"values": [],
"zerofill": false
},
"media_folder_parent": {
"allow_null": false,
"auto_increment": false,
"binary": false,
"comment": "",
"decimals": null,
"default": "0",
"length": 10,
"name": "media_folder_parent",
"type": "INT",
"unsigned": false,
"values": [],
"zerofill": false
},
"media_folder_name": {
"allow_null": false,
"auto_increment": false,
"binary": false,
"comment": "",
"decimals": null,
"default": "",
"length": 255,
"name": "media_folder_name",
"type": "VARCHAR",
"unsigned": false,
"values": [],
"zerofill": false
},
"media_folder_path": {
"allow_null": true,
"auto_increment": false,
"binary": false,
"comment": "",
"decimals": null,
"default": null,
"length": 0,
"name": "media_folder_path",
"type": "TEXT",
"unsigned": false,
"values": [],
"zerofill": false
}
},
"indexes": {
"PRIMARY": {
"type": "primary",
"name": "PRIMARY",
"length": [
null
],
"columns": [
"media_folder_id"
]
},
"media_folder_parent": {
"type": "key",
"name": "media_folder_parent",
"length": [
null
],
"columns": [
"media_folder_parent"
]
}
},
"collation": "latin1_swedish_ci",
"engine": "InnoDB"
}
]
}
}
@@ -8,15 +8,5 @@
"cms"
]
]
},
"2": {
"method": "delete",
"params": [
"cms_url_store",
[
"store_path=?",
""
]
]
}
}
@@ -0,0 +1,236 @@
<?php
/**
* @brief 4.0.13 Upgrade Code
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 30 Jul 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\cms\setup\upg_101000;
/* 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.1.0 Upgrade Code
*/
class _Upgrade
{
/**
* Fix cms_blocks
*
* @return void
*/
public function finish()
{
foreach ( \IPS\Db::i()->select( '*', 'cms_blocks', array( 'block_type=?', 'plugin' ) ) as $block )
{
$config = json_decode( $block['block_plugin_config'], TRUE );
$config = ( is_array( $config ) ) ? $config : array();
$update = FALSE;
if ( $block['block_plugin'] == 'topicFeed' )
{
$update = TRUE;
$newConfig = array();
foreach ( $config as $_k => $_v )
{
if ( $_k === 'widget_feed_status' )
{
if ( in_array( 'open', $_v ) and in_array( 'closed', $_v ) )
{
$newConfig['widget_feed_status_locked'] = 'any';
}
else if ( in_array( 'open', $_v ) )
{
$newConfig['widget_feed_status_locked'] = 'open';
}
else if ( in_array( 'closed', $_v ) )
{
$newConfig['widget_feed_status_locked'] = 'closed';
}
if ( in_array( 'pinned', $_v ) and in_array( 'notpinned', $_v ) )
{
$newConfig['widget_feed_status_pinned'] = 'any';
}
else if ( in_array( 'pinned', $_v ) )
{
$newConfig['widget_feed_status_pinned'] = 'open';
}
else if ( in_array( 'notpinned', $_v ) )
{
$newConfig['widget_feed_status_pinned'] = 'closed';
}
if ( in_array( 'featured', $_v ) and in_array( 'notfeatured', $_v ) )
{
$newConfig['widget_feed_status_pinned'] = 'any';
}
else if ( in_array( 'featured', $_v ) )
{
$newConfig['widget_feed_status_pinned'] = 'featured';
}
else if ( in_array( 'notfeatured', $_v ) )
{
$newConfig['widget_feed_status_pinned'] = 'notfeatured';
}
}
else
{
$newConfig[ $_k ] = $_v;
}
}
}
if ( $block['block_plugin'] == 'postFeed' )
{
$update = TRUE;
$newConfig = array();
foreach ( $config as $_k => $_v )
{
if ( in_array( $_k, array( 'tfb_show', 'tfb_sort_dir', 'tfb_use_perms', 'tfb_topic_status' ) ) )
{
$_k = str_replace( 'tfb_', 'widget_feed', $_k );
}
else
{
$_k = str_replace( 'tfb_', 'widget_feed_item', $_k );
}
if ( $_k == 'widget_feed_topic_status' )
{
if ( in_array( 'open', $_v ) and in_array( 'closed', $_v ) )
{
$newConfig['widget_feed_item_status_locked'] = 'any';
}
else if ( in_array( 'open', $_v ) )
{
$newConfig['widget_feed_item_status_locked'] = 'open';
}
else if ( in_array( 'closed', $_v ) )
{
$newConfig['widget_feed_item_status_locked'] = 'closed';
}
if ( in_array( 'pinned', $_v ) and in_array( 'notpinned', $_v ) )
{
$newConfig['widget_feed_item_status_pinned'] = 'any';
}
else if ( in_array( 'pinned', $_v ) )
{
$newConfig['widget_feed_item_status_pinned'] = 'open';
}
else if ( in_array( 'notpinned', $_v ) )
{
$newConfig['widget_feed_item_status_pinned'] = 'closed';
}
if ( in_array( 'featured', $_v ) and in_array( 'notfeatured', $_v ) )
{
$newConfig['widget_feed_item_status_pinned'] = 'any';
}
else if ( in_array( 'featured', $_v ) )
{
$newConfig['widget_feed_item_status_pinned'] = 'featured';
}
else if ( in_array( 'notfeatured', $_v ) )
{
$newConfig['widget_feed_item_status_pinned'] = 'notfeatured';
}
}
else
{
$newConfig[ $_k ] = $_v;
}
}
}
if ( $block['block_plugin'] == 'RecordFeed' )
{
$update = TRUE;
$newConfig = array();
foreach ( $config as $_k => $_v )
{
if ( $_k !== 'cms_rf_database' )
{
$_k = str_replace( 'cms_rf', 'widget_feed', $_k );
}
if ( $_k == 'widget_feed_record_status' )
{
$_k = 'widget_feed_status';
}
if ( $_k == 'cms_rf_category' )
{
$_k = 'widget_feed_container';
}
if ( $_k === 'widget_feed_status' )
{
if ( in_array( 'open', $_v ) and in_array( 'closed', $_v ) )
{
$newConfig['widget_feed_status_locked'] = 'any';
}
else if ( in_array( 'open', $_v ) )
{
$newConfig['widget_feed_status_locked'] = 'open';
}
else if ( in_array( 'closed', $_v ) )
{
$newConfig['widget_feed_status_locked'] = 'closed';
}
if ( in_array( 'pinned', $_v ) and in_array( 'notpinned', $_v ) )
{
$newConfig['widget_feed_status_pinned'] = 'any';
}
else if ( in_array( 'pinned', $_v ) )
{
$newConfig['widget_feed_status_pinned'] = 'open';
}
else if ( in_array( 'notpinned', $_v ) )
{
$newConfig['widget_feed_status_pinned'] = 'closed';
}
if ( in_array( 'featured', $_v ) and in_array( 'notfeatured', $_v ) )
{
$newConfig['widget_feed_status_pinned'] = 'any';
}
else if ( in_array( 'featured', $_v ) )
{
$newConfig['widget_feed_status_pinned'] = 'featured';
}
else if ( in_array( 'notfeatured', $_v ) )
{
$newConfig['widget_feed_status_pinned'] = 'notfeatured';
}
}
else
{
$newConfig[ $_k ] = $_v;
}
}
}
if ( $update )
{
\IPS\Db::i()->update( 'cms_blocks', array( 'block_plugin_config' => json_encode( $newConfig ) ), array( 'block_id=?', $block['block_id'] ) );
}
}
/* Update template params */
\IPS\Db::i()->update( 'cms_blocks', array( 'block_template_params' => '$records, $title, $orientation=\'vertical\'' ), array( 'block_plugin=?', 'RecordFeed' ) );
return TRUE;
}
}
@@ -13,6 +13,11 @@ $options = array();
foreach( \IPS\Db::i()->select( '*', 'ccs_databases' ) as $database )
{
/* Show warning about inability to convert html */
$options[] = new \IPS\Helpers\Form\Custom( '40000_cms_htmlconversion', null, FALSE, array( 'getHtml' => function( $element ) use ( $members ){
return "HTML in pages, blocks and templates in Pages cannot be converted during the upgrade. While those pages and blocks will continue to work, you may wish to adjust the HTML following the upgrade to integrate the styling used by the Community Suite 4.0.";
} ), function( $val ) {}, NULL, NULL, '40000_cms_htmlconversion' );
$pages = array();
foreach( \IPS\Db::i()->select( '*', 'ccs_pages' ) as $page )
+10 -2
View File
@@ -154,7 +154,7 @@ class _Upgrade
}
else if ( $page['page_type'] == 'html' )
{
$save['page_content'] = str_replace( '{parse articles}', '{database="1"}', $page['page_content'] );
$save['page_content'] = str_replace( '{parse articles', '{database="1"', $page['page_content'] );
$save['page_content'] = str_replace( '{ccs special_tag="navigation"}', '', $save['page_content'] );
$save['page_content'] = preg_replace( '#\{parse database="([^"]+?)"\}#', '{database="\1"}', $save['page_content'] );
$save['page_content'] = preg_replace( '#\{parse block="([^"]+?)"\}#', '{block="\1"}', $save['page_content'] );
@@ -1277,7 +1277,15 @@ class _Upgrade
{
}
\IPS\Task::queue( 'core', 'RebuildPosts', array( 'class' => 'IPS\cms\Records' . $database['database_id'] ), 2 );
/* Some 'content' fields can be select boxes, etc and we don't want to run the text parser on those as it wraps with <p> tags */
$fieldClass = '\IPS\cms\Fields' . $database['database_id'];
$field = $fieldClass::load( $database['database_field_content'] );
if ( $field->type === 'Editor' )
{
\IPS\Task::queue( 'core', 'RebuildPosts', array( 'class' => 'IPS\cms\Records' . $database['database_id'] ), 2 );
}
\IPS\Task::queue( 'core', 'RebuildPosts', array( 'class' => 'IPS\cms\Records\Comment' . $database['database_id'] ), 2 );
\IPS\Task::queue( 'core', 'RebuildPosts', array( 'class' => 'IPS\cms\Records\Review' . $database['database_id'] ), 2 );
}