diff options
| author | 2014-08-11 19:18:12 +0200 | |
|---|---|---|
| committer | 2014-08-11 19:18:12 +0200 | |
| commit | 8ffd59f34ac458827f2a0217e4630caf69705853 (patch) | |
| tree | 2e05b9f8df5a51ba8d89974e5523e962542fc2a5 /app/Controllers/importExportController.php | |
| parent | 94570aaf5a23dfc02bf1120d168ec30c2ab3f044 (diff) | |
Improve import system
Catch errors of zip_open and log it. A notification is shown to indicate
something went wrong.
See https://github.com/marienfressinaud/FreshRSS/issues/494
Diffstat (limited to 'app/Controllers/importExportController.php')
| -rw-r--r-- | app/Controllers/importExportController.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index dd6c23322..15871ed80 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -42,6 +42,20 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { if ($type_file === 'zip' && extension_loaded('zip')) { $zip = zip_open($file['tmp_name']); + if (!is_resource($zip)) { + Minz_Log::error( + 'Zip file cannot be imported. Error code: ' . $zip + ); + + // zip_open cannot open file: something is wrong + Minz_Session::_param('notification', array( + 'type' => 'bad', + 'content' => _t('zip_error') + )); + + Minz_Request::forward(array('c' => 'importExport'), true); + } + while (($zipfile = zip_read($zip)) !== false) { $type_zipfile = $this->guessFileType( zip_entry_name($zipfile) |
