Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

+59 -13
View File
@@ -1040,6 +1040,11 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
*/
public static function validateUnique( $val, $field, $record )
{
if ( $val === '' )
{
return;
}
$database = \IPS\cms\Databases::load( static::$customDatabaseId );
if( $field->type == 'Member' AND $val instanceof \IPS\Member )
@@ -1311,9 +1316,10 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
*
* @param mixed $value The value
* @param bool $showSensitiveInformation If TRUE, potentially sensitive data (like passwords) will be displayed - otherwise will be blanked out
* @param string $separator Used to separate items when displaying a field with multiple values.
* @return string
*/
public function displayValue( $value=NULL, $showSensitiveInformation=FALSE )
public function displayValue( $value=NULL, $showSensitiveInformation=FALSE, $separator=NULL )
{
$database = \IPS\cms\Databases::load( static::$customDatabaseId );
@@ -2307,8 +2313,17 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
case 'Text':
case 'Url':
case 'Checkbox':
$columnDefinition['type'] = 'VARCHAR';
$columnDefinition['length'] = 255;
if ( !isset( $values['field_max_length'] ) OR !$values['field_max_length'] )
{
$columnDefinition['type'] = 'MEDIUMTEXT';
unset( $columnDefinition['length'] );
}
else
{
$columnDefinition['type'] = 'VARCHAR';
$columnDefinition['length'] = 255;
}
$values['field_extra'] = '';
break;
default:
@@ -2316,9 +2331,21 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
break;
}
if ( ! empty( $values['field_max_length'] ) AND empty( $columnDefinition['length'] ) )
if ( ! empty( $values['field_max_length'] ) )
{
$columnDefinition['length'] = $values['field_max_length'];
if( $values['field_max_length'] > 255 )
{
$columnDefinition['type'] = 'MEDIUMTEXT';
if( isset( $columnDefinition['length'] ) )
{
unset( $columnDefinition['length'] );
}
}
else
{
$columnDefinition['length'] = $values['field_max_length'];
}
}
else if ( empty( $columnDefinition['length'] ) )
{
@@ -2797,7 +2824,7 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
*/
public function delete( $skipDrop=FALSE )
{
static::$contentDatabaseTable = 'cms_custom_database_' . static::$customDatabaseId;
static::$contentDatabaseTable = NULL; // This ensures the parent class doesn't try to drop the column regardless
static::$cache = array();
/* Remove reciprocal map data */
@@ -2810,17 +2837,36 @@ class _Fields extends \IPS\CustomField implements \IPS\Node\Permissions
return;
}
try
if( $this->type == 'Upload' )
{
\IPS\Db::i()->dropIndex( static::$contentDatabaseTable, "field_{$this->id}" );
}
catch ( \IPS\Db\Exception $e ) {}
/* Delete thumbnails */
\IPS\Task::queue( 'core', 'FileCleanup', array(
'table' => 'cms_database_fields_thumbnails',
'column' => 'thumb_location',
'storageExtension' => 'cms_Records',
'where' => array( array( 'thumb_field_id=?', $this->id ) ),
'deleteRows' => TRUE,
), 4 );
try
/* Delete records */
\IPS\Task::queue( 'core', 'FileCleanup', array(
'table' => 'cms_custom_database_' . static::$customDatabaseId,
'column' => 'field_' . $this->id,
'storageExtension' => 'cms_Records',
'primaryId' => 'primary_id_field',
'dropColumn' => 'field_' . $this->id,
'dropColumnTable' => 'cms_custom_database_' . static::$customDatabaseId,
'multipleFiles' => $this->is_multiple
), 4 );
}
else
{
\IPS\Db::i()->dropColumn( static::$contentDatabaseTable, "field_{$this->id}" );
try
{
\IPS\Db::i()->dropColumn( static::$contentDatabaseTable, "field_{$this->id}" );
}
catch( \IPS\Db\Exception $e ) { }
}
catch( \IPS\Db\Exception $e ) { }
}
/**