Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -193,7 +193,7 @@ class _PendingVersion extends \IPS\Content\Item implements \IPS\Content\Hideable
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function saveVersion(): void
|
||||
public function saveVersion()
|
||||
{
|
||||
$this->save_version = 1;
|
||||
}
|
||||
@@ -203,8 +203,26 @@ class _PendingVersion extends \IPS\Content\Item implements \IPS\Content\Hideable
|
||||
*
|
||||
* @param array $values
|
||||
*/
|
||||
public function set_form_values( array $values ): void
|
||||
public function set_form_values( array $values )
|
||||
{
|
||||
foreach( $values as $k => $v )
|
||||
{
|
||||
if( $v instanceof \IPS\File )
|
||||
{
|
||||
$values[ $k ] = (string) $v;
|
||||
}
|
||||
elseif( \is_array( $v ) )
|
||||
{
|
||||
foreach( $v as $_key => $_value )
|
||||
{
|
||||
if( $_value instanceof \IPS\File )
|
||||
{
|
||||
$values[ $k ][ $_key ] = (string) $_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->_formValues = $values;
|
||||
$this->_data['form_values'] = json_encode( $values );
|
||||
}
|
||||
@@ -214,7 +232,7 @@ class _PendingVersion extends \IPS\Content\Item implements \IPS\Content\Hideable
|
||||
*
|
||||
* @param array $ids
|
||||
*/
|
||||
public function set_record_deletions( array $ids ): void
|
||||
public function set_record_deletions( array $ids )
|
||||
{
|
||||
$this->_data['record_deletions'] = json_encode( $ids );
|
||||
}
|
||||
@@ -224,7 +242,7 @@ class _PendingVersion extends \IPS\Content\Item implements \IPS\Content\Hideable
|
||||
*
|
||||
* @param $value New date
|
||||
*/
|
||||
public function set_updated( $value ): void
|
||||
public function set_updated( $value )
|
||||
{
|
||||
$this->date = $value;
|
||||
}
|
||||
@@ -284,7 +302,16 @@ class _PendingVersion extends \IPS\Content\Item implements \IPS\Content\Hideable
|
||||
{
|
||||
case 'upload':
|
||||
case 'ssupload':
|
||||
$this->file()->deleteRecords( $record['record_id'], $record['record_location'], ( $record['record_location'] == 'ssupload' ) ? 'downloads_Screenshots' : 'downloads_Files' );
|
||||
$this->file()->deleteRecords( $record['record_id'], $record['record_location'], ( $record['record_type'] == 'ssupload' ) ? 'downloads_Screenshots' : 'downloads_Files' );
|
||||
|
||||
if( $record['record_type'] == 'ssupload' AND !empty( $record['record_thumb'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\File::get( 'downloads_Screenshots', $record['record_thumb'] )->delete();
|
||||
}
|
||||
catch( \Exception $e ){}
|
||||
}
|
||||
break;
|
||||
case 'link':
|
||||
case 'sslink':
|
||||
@@ -336,6 +363,15 @@ class _PendingVersion extends \IPS\Content\Item implements \IPS\Content\Hideable
|
||||
});
|
||||
$file->deleteRecords( $deletions['links'] );
|
||||
|
||||
foreach( $deletions['thumbs'] as $url )
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\File::get( 'downloads_Screenshots', $url )->delete();
|
||||
}
|
||||
catch( \Exception $e ){}
|
||||
}
|
||||
|
||||
$file->size = \floatval( \IPS\Db::i()->select( 'SUM(record_size)', 'downloads_files_records', array( 'record_file_id=? AND record_type=? AND record_backup=0', $file->id, 'upload' ), NULL, NULL, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->first() );
|
||||
|
||||
/* Work out the new primary screenshot */
|
||||
@@ -366,7 +402,7 @@ class _PendingVersion extends \IPS\Content\Item implements \IPS\Content\Hideable
|
||||
/* Send notifications */
|
||||
if ( $file->open )
|
||||
{
|
||||
$file->sendUpdateNotifications();
|
||||
$file->sendApprovedNotification();
|
||||
}
|
||||
|
||||
$file->processAfterNewVersion( $formValues );
|
||||
|
||||
Reference in new issue
Block a user