diff options
-rw-r--r-- | framework/Caching/TAPCCache.php | 23 | ||||
-rw-r--r-- | framework/Exceptions/messages.txt | 4 |
2 files changed, 19 insertions, 8 deletions
diff --git a/framework/Caching/TAPCCache.php b/framework/Caching/TAPCCache.php index 969de4a4..253507b6 100644 --- a/framework/Caching/TAPCCache.php +++ b/framework/Caching/TAPCCache.php @@ -40,6 +40,7 @@ * </code>
*
* @author Alban Hanry <compte_messagerie@hotmail.com>
+ * @author Knut Urdalen <knut.urdalen@gmail.com>
* @version $Id$
* @package System.Caching
* @since 3.0b
@@ -54,12 +55,16 @@ class TAPCCache extends TCache */
public function init($config)
{
- if(substr(php_sapi_name(), 0, 3) !== 'cli') //APC is usually disabled in CLI mode.
- {
- if(!extension_loaded('apc'))
- throw new TConfigurationException('apccache_extension_required');
- parent::init($config);
- }
+ if(!extension_loaded('apc'))
+ throw new TConfigurationException('apccache_extension_required');
+
+ if(ini_get('apc.enabled') == false)
+ throw new TConfigurationException('apccache_extension_not_enabled');
+
+ if(substr(php_sapi_name(), 0, 3) === 'cli' and ini_get('apc.enable_cli') == false)
+ throw new TConfigurationException('apccache_extension_not_enabled_cli');
+
+ parent::init($config);
}
/**
@@ -98,7 +103,11 @@ class TAPCCache extends TCache */
protected function addValue($key,$value,$expire)
{
- throw new TNotSupportedException('apccache_add_unsupported');
+ if(function_exists('apc_add')) {
+ return apc_add($key,$value,$expire);
+ } else {
+ throw new TNotSupportedException('apccache_add_unsupported');
+ }
}
/**
diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt index 528b5c62..803271e5 100644 --- a/framework/Exceptions/messages.txt +++ b/framework/Exceptions/messages.txt @@ -94,6 +94,8 @@ memcache_port_unchangeable = TMemCache.Port cannot be modified after the modu apccache_extension_required = TAPCCache requires APC PHP extension.
apccache_add_unsupported = TAPCCache.add() is not supported.
apccache_replace_unsupported = TAPCCache.replace() is not supported.
+apccache_extension_not_enabled = TAPCCache need apc.enabled = 1 in php.ini in order to work.
+apccache_extension_not_enabled_cli = TAPCCache need apc.enable_cli = 1 in php.ini in order to work with PHP from the command line.
errorhandler_errortemplatepath_invalid = TErrorHandler.ErrorTemplatePath '{0}' is invalid. Make sure it is in namespace form and points to a valid directory containing error template files.
@@ -368,7 +370,7 @@ dbtransaction_transaction_inactive = TDbTransaction is inactive. dbcommandbuilder_value_must_not_be_null = Property {0} must not be null as defined by column '{2}' in table '{1}'.
-dbcommon_invalid_table_name = Database table '{0}' not found. Error Msg: {1}.
+dbcommon_invalid_table_name = Database table '{0}' not found. Error message: {1}.
dbcommon_invalid_identifier_name = Invalid database identifier name '{0}', see {1} for details.
dbtableinfo_invalid_column_name = Invalid column name '{0}' for database table '{1}'.
dbmetadata_invalid_table_view = Invalid table/view name '{0}', or that table/view '{0}' contains no accessible column/field definitions.
|