Add quiet flag to StoredFile delete to avoid unnecessary sentry errors when clearing library
This commit is contained in:
parent
9d822b6e8b
commit
bff04820f2
2 changed files with 10 additions and 7 deletions
|
@ -509,11 +509,11 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$files = CcFilesQuery::create()->find();
|
$files = CcFilesQuery::create()->find();
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$storedFile = new Application_Model_StoredFile($file, null);
|
$storedFile = new Application_Model_StoredFile($file, null);
|
||||||
$storedFile->delete();
|
// Delete the files quietly to avoid getting Sentry errors for
|
||||||
|
// every S3 file we delete.
|
||||||
|
$storedFile->delete(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: delete hard copies of files? */
|
|
||||||
|
|
||||||
$this->getResponse()
|
$this->getResponse()
|
||||||
->setHttpResponseCode(200)
|
->setHttpResponseCode(200)
|
||||||
->appendBody("OK");
|
->appendBody("OK");
|
||||||
|
|
|
@ -375,7 +375,7 @@ SQL;
|
||||||
* Deletes the physical file from the local file system or from the cloud
|
* Deletes the physical file from the local file system or from the cloud
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function delete()
|
public function delete($quiet=false)
|
||||||
{
|
{
|
||||||
// Check if the file is scheduled to be played in the future
|
// Check if the file is scheduled to be played in the future
|
||||||
if (Application_Model_Schedule::IsFileScheduledInTheFuture($this->_file->getCcFileId())) {
|
if (Application_Model_Schedule::IsFileScheduledInTheFuture($this->_file->getCcFileId())) {
|
||||||
|
@ -401,13 +401,16 @@ SQL;
|
||||||
//or from the cloud
|
//or from the cloud
|
||||||
if ($this->_file->getDbImportStatus() == CcFiles::IMPORT_STATUS_SUCCESS) {
|
if ($this->_file->getDbImportStatus() == CcFiles::IMPORT_STATUS_SUCCESS) {
|
||||||
try {
|
try {
|
||||||
Logging::info("DELETING PHYSICAL FILE " . $this->_file->getDbTrackTitle());
|
|
||||||
$this->_file->deletePhysicalFile();
|
$this->_file->deletePhysicalFile();
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
//Just log the exception and continue.
|
if ($quiet) {
|
||||||
Logging::error($e);
|
Logging::info($e);
|
||||||
|
} else {
|
||||||
|
//Just log the exception and continue.
|
||||||
|
Logging::error($e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue