summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-05-19 14:30:18 +0200
committerAndrey Andreev <narf@devilix.net>2014-05-19 14:30:18 +0200
commit9e9d86ba77b6aead9daec720bb1444841527e0c7 (patch)
treee613da897617b0a86e9f64cf1a509f4b4aa4147b
parent5b9251f2a2db19d5e77c52def8f97b2cd6443e3e (diff)
parent66c7bb41310ea7543cfeac5b008fa24d30e962e1 (diff)
Merge pull request #3052 from vlakoff/mime
Fix caching of MIME config
-rw-r--r--system/core/Common.php21
-rw-r--r--system/libraries/Email.php7
2 files changed, 15 insertions, 13 deletions
diff --git a/system/core/Common.php b/system/core/Common.php
index 7f2708151..752a2e7f1 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -304,15 +304,22 @@ if ( ! function_exists('get_mimes'))
*/
function &get_mimes()
{
- static $_mimes = array();
+ static $_mimes;
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
+ if (empty($_mimes))
{
- $_mimes = include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
- }
- elseif (file_exists(APPPATH.'config/mimes.php'))
- {
- $_mimes = include(APPPATH.'config/mimes.php');
+ if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
+ {
+ $_mimes = include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
+ }
+ elseif (file_exists(APPPATH.'config/mimes.php'))
+ {
+ $_mimes = include(APPPATH.'config/mimes.php');
+ }
+ else
+ {
+ $_mimes = array();
+ }
}
return $_mimes;
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 1f2f6a991..63b7dc31c 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -2234,14 +2234,9 @@ class CI_Email {
*/
protected function _mime_types($ext = '')
{
- static $mimes;
-
$ext = strtolower($ext);
- if ( ! is_array($mimes))
- {
- $mimes =& get_mimes();
- }
+ $mimes =& get_mimes();
if (isset($mimes[$ext]))
{