Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+25 -21
View File
@@ -12,7 +12,7 @@
namespace IPS\cms\setup\upg_40000;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -169,7 +169,7 @@ class _Upgrade
{
$where = array( 'database_id=?', $match[1] );
if ( ! is_numeric( $match[1] ) )
if ( !\is_numeric( $match[1] ) )
{
$where = array( 'database_key=?', $match[1] );
}
@@ -293,9 +293,9 @@ class _Upgrade
\IPS\Db::i()->insert( 'cms_page_menu', array(
'menu_id' => $menu['menu_id'],
'menu_title' => $menu['menu_title'],
'menu_parent_id' => intval( $menu['menu_parent_id'] ),
'menu_parent_id' => \intval( $menu['menu_parent_id'] ),
'menu_content' => $menu['menu_url'],
'menu_position' => intval( $menu['menu_position'] ),
'menu_position' => \intval( $menu['menu_position'] ),
'menu_type' => $type,
'menu_permission' => ( empty( $menu['menu_permissions'] ) ? '*' : $menu['menu_permissions'] )
) );
@@ -386,7 +386,7 @@ class _Upgrade
if ( $field['field_extra'] )
{
$json = array();
if ( in_array( $field['field_type'], array( 'checkbox', 'radio', 'select', 'multiselect' ) ) )
if ( \in_array( $field['field_type'], array( 'checkbox', 'radio', 'select', 'multiselect' ) ) )
{
foreach( explode( "\n", $field['field_extra'] ) as $line )
{
@@ -395,7 +395,7 @@ class _Upgrade
$json[ $key ] = $value;
}
if ( $field['field_type'] == 'checkbox' and count( $json ) )
if ( $field['field_type'] == 'checkbox' and \count( $json ) )
{
$save['field_type'] = 'CheckboxSet';
}
@@ -417,7 +417,7 @@ class _Upgrade
}
}
if ( count( $json ) )
if ( \count( $json ) )
{
$save['field_extra'] = json_encode( $json );
}
@@ -489,9 +489,12 @@ class _Upgrade
{
/* Limit - let's do 1 per cycle */
$perCycle = 1;
$limit = intval( \IPS\Request::i()->extra );
$limit = \intval( \IPS\Request::i()->extra );
$did = false;
/* Make sure our Application.php has been loaded, as it handles the special dynamic CMS database classes */
\IPS\Application::load( 'cms' );
/* Databases */
foreach( \IPS\Db::i()->select( '*', 'cms_databases', null, 'database_id ASC', array( $limit, $perCycle ) ) as $database )
{
@@ -569,7 +572,7 @@ class _Upgrade
}
}
if( count( $change ) )
if( \count( $change ) )
{
try
{
@@ -584,19 +587,19 @@ class _Upgrade
}
}
if ( count( $json ) )
if ( \count( $json ) )
{
$save['database_fixed_field_perms'] = json_encode( $json );
}
if ( count( $drop ) )
if ( \count( $drop ) )
{
\IPS\Db::i()->delete( 'cms_database_fields', array( "field_database_id=? AND field_id IN(" . implode( ",", $drop ) . ")", $database['database_id'] ) );
}
if( count( $remap ) )
if( \count( $remap ) )
{
if( in_array( $database['database_field_sort'], array_keys( $remap ) ) )
if( \in_array( $database['database_field_sort'], array_keys( $remap ) ) )
{
$save['database_field_sort'] = $remap[ $database['database_field_sort'] ];
}
@@ -666,7 +669,7 @@ class _Upgrade
$databasePerms = array( 'perm_id' => 0 );
}
if ( count( $databasePerms ) )
if ( \count( $databasePerms ) )
{
unset( $databasePerms['perm_id'] );
@@ -682,7 +685,8 @@ class _Upgrade
if ( $count )
{
/* Add new default category */
$category = new \IPS\cms\Categories;
$className = "\\IPS\\cms\\Categories{$database['database_id']}";
$category = new $className;
$category->database_id = $database['database_id'];
$catTitle = array();
@@ -774,7 +778,7 @@ class _Upgrade
{
$save['block_type'] = 'plugin';
if ( is_array( $data ) and isset( $data['feed'] ) )
if ( \is_array( $data ) and isset( $data['feed'] ) )
{
if ( $data['feed'] == 'articles' )
{
@@ -864,7 +868,7 @@ class _Upgrade
$status[] = 'visible';
}
if ( count( $status ) )
if ( \count( $status ) )
{
$config['cms_rf_record_status'] = $status;
}
@@ -926,7 +930,7 @@ class _Upgrade
$did++;
$data = unserialize( $row['revision_data'] );
if ( is_array( $data ) )
if ( \is_array( $data ) )
{
\IPS\Db::i()->update( 'cms_database_revisions', array( 'revision_data' => json_encode( $data ) ), array( 'revision_id=?', $row['revision_id'] ) );
}
@@ -1046,7 +1050,7 @@ class _Upgrade
$save['category_full_path'] = trim( implode( '/', $path ), '/' );
}
if ( count( $save ) )
if ( \count( $save ) )
{
\IPS\Db::i()->update( 'cms_database_categories', $save, array( 'category_id=?', $row['category_id'] ) );
}
@@ -1094,7 +1098,7 @@ class _Upgrade
{
$perCycle = 500;
$did = 0;
$limit = intval( \IPS\Request::i()->extra );
$limit = \intval( \IPS\Request::i()->extra );
/* Try to prevent timeouts to the extent possible */
$cutOff = \IPS\core\Setup\Upgrade::determineCutoff();
@@ -1254,7 +1258,7 @@ class _Upgrade
$record = \IPS\Db::i()->select( '*', 'cms_custom_database_' . $row['map_database_id'], array( 'primary_id_field=?', $row['map_record_id'] ) )->first();
/* 3.x kept a simple count of attachments in this field */
if ( is_numeric( $record[ 'field_' . $row['map_field_id'] ] ) )
if ( \is_numeric( $record[ 'field_' . $row['map_field_id'] ] ) )
{
$record[ 'field_' . $row['map_field_id'] ] = '';
}