Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,10 @@
|
||||
/**
|
||||
* @brief 4.0.0 Alpha 1 Upgrade Code
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Content
|
||||
* @since 20 Jan 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -284,6 +285,11 @@ class _Upgrade
|
||||
$createdParents[ $menu['menu_id'] ] = TRUE;
|
||||
$type = 'folder';
|
||||
}
|
||||
/* Otherwise, we need to make sure the URL is a fully qualified URL, and not a relative one. */
|
||||
else if ( mb_substr( $menu['menu_url'], 0, 4 ) != 'http' )
|
||||
{
|
||||
$menu['menu_url'] = \IPS\Settings::i()->base_url . ltrim( $menu['menu_url'], '/' );
|
||||
}
|
||||
|
||||
\IPS\Db::i()->insert( 'cms_page_menu', array(
|
||||
'menu_id' => $menu['menu_id'],
|
||||
@@ -381,6 +387,11 @@ class _Upgrade
|
||||
$save['field_type'] = 'TextArea';
|
||||
}
|
||||
|
||||
if ( $save['field_type'] == 'Relational' )
|
||||
{
|
||||
$save['field_type'] = 'Item';
|
||||
}
|
||||
|
||||
if ( $field['field_extra'] )
|
||||
{
|
||||
$json = array();
|
||||
@@ -392,19 +403,55 @@ class _Upgrade
|
||||
|
||||
$json[ $key ] = $value;
|
||||
}
|
||||
|
||||
if ( $field['field_type'] == 'checkbox' and count( $json ) )
|
||||
{
|
||||
$field['field_type'] = 'CheckboxSet';
|
||||
}
|
||||
}
|
||||
else if ( $field['field_type'] == 'upload' )
|
||||
{
|
||||
$save['field_extra'] = '';
|
||||
$save['field_allowed_extensions'] = json_encode( explode( ',', $field['field_extra' ] ) );
|
||||
}
|
||||
else if ( $field['field_type'] == 'relational' )
|
||||
{
|
||||
$options = explode( ',', $field['field_extra'] );
|
||||
|
||||
$json = array( 'database' => $options[0] );
|
||||
|
||||
if( $options[2] == 'multiselect' )
|
||||
{
|
||||
$save['field_is_multiple'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $json ) )
|
||||
{
|
||||
$save['field_extra'] = json_encode( $json );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( $field['field_key'] === 'article_homepage' )
|
||||
{
|
||||
/* Convert this to featured */
|
||||
if ( \IPS\Db::i()->checkForTable( 'cms_custom_database_' . $field['field_database_id'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\Db::i()->update( 'cms_custom_database_' . $field['field_database_id'], array( 'record_featured' => 1 ), array( 'field_' . $field['field_id'] . ' =1' ) );
|
||||
\IPS\Db::i()->dropColumn( 'cms_custom_database_' . $field['field_database_id'], 'field_' . $field['field_id'] );
|
||||
}
|
||||
catch( \Exception $e ) { }
|
||||
}
|
||||
|
||||
/* Drop the field */
|
||||
\IPS\Db::i()->delete( 'cms_database_fields', array( 'field_id=?', $field['field_id'] ) );
|
||||
|
||||
/* No need to update anything, just skip to the next field */
|
||||
continue;
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'cms_database_fields', $save, array( 'field_id=?', $field['field_id'] ) );
|
||||
|
||||
/* Update records to use the field default */
|
||||
@@ -498,6 +545,13 @@ class _Upgrade
|
||||
{
|
||||
if ( isset( $fields[ $k ] ) )
|
||||
{
|
||||
/* For an int column, we need to make sure the value is an int before changing the column type or we could get
|
||||
"data truncated" MySQL warnings */
|
||||
if( $k != 'article_image' )
|
||||
{
|
||||
\IPS\Db::i()->update( 'cms_custom_database_' . $database['database_id'], array( 'field_' . $fields[ $k ]['field_id'] => '0' ), array( "field_" . $fields[ $k ]['field_id'] . "='' OR field_" . $fields[ $k ]['field_id'] . " IS NULL" ) );
|
||||
}
|
||||
|
||||
$change[] = "CHANGE field_" . $fields[ $k ]['field_id'] . ' ' . $schema;
|
||||
|
||||
list( $field, ) = explode( ' ', $schema );
|
||||
@@ -528,12 +582,12 @@ class _Upgrade
|
||||
{
|
||||
\IPS\Db::i()->query( 'ALTER TABLE ' . \IPS\Db::i()->prefix . 'cms_custom_database_' . $database['database_id'] . " " . implode( ', ', $change ) );
|
||||
|
||||
\IPS\Log::i( LOG_DEBUG )->write( "Run " . 'ALTER TABLE ' . \IPS\Db::i()->prefix . 'cms_custom_database_' . $database['database_id'] . " " . implode( ', ', $change ), 'upgrade_pages' );
|
||||
\IPS\Log::debug( "Run " . 'ALTER TABLE ' . \IPS\Db::i()->prefix . 'cms_custom_database_' . $database['database_id'] . " " . implode( ', ', $change ), 'upgrade_pages' );
|
||||
}
|
||||
catch ( \IPS\Db\Exception $e )
|
||||
{
|
||||
# Don't care, sync below will add columns
|
||||
\IPS\Log::i( LOG_ERR )->write( $e, 'upgrade_pages' );
|
||||
\IPS\Log::log( $e, 'upgrade_pages' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -938,7 +992,7 @@ class _Upgrade
|
||||
|
||||
if ( ! $row['category_furl_name'] )
|
||||
{
|
||||
$save['category_furl_name'] = \IPS\Http\Url::seoTitle( $row['category_name'] );
|
||||
$save['category_furl_name'] = \IPS\Http\Url\Friendly::seoTitle( $row['category_name'] );
|
||||
$row['category_furl_name'] = $save['category_furl_name'];
|
||||
}
|
||||
else
|
||||
@@ -967,7 +1021,7 @@ class _Upgrade
|
||||
|
||||
if ( ! $parent['category_furl_name'] )
|
||||
{
|
||||
$parent['category_furl_name'] = \IPS\Http\Url::seoTitle( $parent['category_name'] );
|
||||
$parent['category_furl_name'] = \IPS\Http\Url\Friendly::seoTitle( $parent['category_name'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1270,8 +1324,8 @@ class _Upgrade
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\Task::queue( 'cms', 'RebuildRecords' , array( 'class' => 'IPS\cms\Records' . $database['database_id'] ), 3 );
|
||||
\IPS\Task::queue( 'cms', 'RebuildCategories', array( 'class' => 'IPS\cms\Categories' . $database['database_id'] ), 3 );
|
||||
\IPS\Task::queue( 'cms', 'RebuildRecords' , array( 'fixFurls' => true, 'fixHtml' => true, 'fixImage' => true, 'class' => 'IPS\cms\Records' . $database['database_id'] ), 3 );
|
||||
\IPS\Task::queue( 'cms', 'RebuildCategories', array( 'fixHtml' => true, 'fixImage' => true, 'class' => 'IPS\cms\Categories' . $database['database_id'] ), 3 );
|
||||
}
|
||||
catch ( \OutOfRangeException $ex )
|
||||
{
|
||||
@@ -1279,12 +1333,18 @@ class _Upgrade
|
||||
|
||||
/* 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' )
|
||||
|
||||
/* We wrap in a try/catch in case upgraded content field is 'primary_id_field' which won't load, but does not need to be rebuilt anyways */
|
||||
try
|
||||
{
|
||||
\IPS\Task::queue( 'core', 'RebuildPosts', array( 'class' => 'IPS\cms\Records' . $database['database_id'] ), 2 );
|
||||
$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 );
|
||||
}
|
||||
}
|
||||
catch( \Exception $e ){}
|
||||
|
||||
\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 );
|
||||
|
||||
Reference in new issue
Block a user