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,9 @@
|
||||
/**
|
||||
* @brief Clear bandwidth log Task
|
||||
* @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 Gallery
|
||||
* @since 21 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Clear temporary uploads task
|
||||
* @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 Gallery
|
||||
* @since 18 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
@@ -39,11 +39,21 @@ class _clearUploads extends \IPS\Task
|
||||
{
|
||||
$cutoff = \IPS\DateTime::create()->sub( new \DateInterval( 'P1D' ) )->getTimestamp();
|
||||
$sessions = array();
|
||||
$messages = array();
|
||||
$errorLang = \IPS\Lang::load( \IPS\Lang::defaultLanguage() )->get( 'gallery_clear_uploads_error' );
|
||||
|
||||
foreach( \IPS\Db::i()->select( '*', 'gallery_images_uploads', array( 'upload_date < ?', $cutoff ) ) as $upload )
|
||||
{
|
||||
$file = \IPS\File::get( 'gallery_Images', $upload['upload_location'] )->delete();
|
||||
|
||||
try
|
||||
{
|
||||
$file = \IPS\File::get( 'gallery_Images', $upload['upload_location'] );
|
||||
$file->delete();
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
$messages[] = sprintf( $errorLang, (string) $file, $e->getMessage() );
|
||||
}
|
||||
|
||||
$sessions[ $upload['upload_session'] ] = $upload['upload_session'];
|
||||
}
|
||||
|
||||
@@ -52,7 +62,7 @@ class _clearUploads extends \IPS\Task
|
||||
\IPS\Db::i()->delete( 'gallery_images_uploads', array( array( "upload_session IN('" . implode( "','", $sessions ) . "')" ) ) );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return !empty( $messages ) ? implode( '; ', $messages ) : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user