* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2013 by Mailer Developer Team *
* For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
var $rebuilt = array();
// File extension
- var $extension = '.cache';
+ var $extension = '';
var $status = array();
var $readable = array();
var $fullPath = '';
// Constructor
function CacheSystem () {
+ // Set extension
+ $this->extension = getCacheExtension();
+
// Construct full path
$this->fullPath = getPath() . getCachePath();
// Is the pointer a valid resource?
if (is_resource($this->pointer)) {
// Write the line
- fwrite($this->pointer, $line . chr(10));
+ fwrite($this->pointer, $line . PHP_EOL);
} else {
// Something bad happened
reportBug(__METHOD__, __LINE__, 'Pointer type is ' . gettype($this->pointer) . ', expected is resource.');
unset($this->status[$this->name]);
}
+ // Adds a data row (array) to cache file and global cache array
function addRow ($data) {
// Is the pointe rvalid?
if (is_resource($this->pointer)) {
$GLOBALS['cache_array']['config'][$data['config']][$k] = $v;
} elseif ($this->name == 'filter') {
// Filter
- $GLOBALS['cache_array']['filter']['chains'][$data['filter_name']][$data['filter_function']] = $data['filter_active'];
+ $GLOBALS['cache_array']['filter']['chains'][$data['filter_name']][$data['filter_function']] = $data['filter_active'];
$GLOBALS['cache_array']['filter']['counter'][$data['filter_name']][$data['filter_function']] = $data['filter_counter'];
- $GLOBALS['cache_array']['filter']['loaded'][$data['filter_name']][$data['filter_function']] = TRUE;
+ $GLOBALS['cache_array']['filter']['loaded'][$data['filter_name']][$data['filter_function']] = TRUE;
} elseif ($this->name == 'modules') {
// Modules
$GLOBALS['cache_array']['modules'][$k][$data['module']] = $v;
}
}
+ // Closes cache file with closing PHP tag
function finalize () {
// Quit function when no pointer is set
if (is_resource($this->pointer)) {
} // END - if
}
+ // Loads cache file and returns an array of the cached data
function getArrayFromCache () {
// Is the cache already loaded?
if (isset($this->data[$this->name])) {
$this->resetCacheReadStatus();
// Debug message
- //* DEBUG: */ logDebugMessage(__METHOD__, __LINE__, sprintf("%s should be removed.", $this->name));
+ //* DEBUG: */ logDebugMessage(__METHOD__, __LINE__, sprintf('%s should be removed.', $this->name));
// Is the cache file not yet rebuilt?
if ((!isset($this->rebuilt[$this->name])) && ($this->isCacheReadable())) {
// Debug messages
if (isset($this->version[$this->name][$ext_name])) {
// Does it match?
- $GLOBALS[__METHOD__][$ext_name] = ((isset($this->version[$this->name][$ext_name])) && ($this->version[$this->name][$ext_name] == $ext_ver));
+ $GLOBALS[__METHOD__][$ext_name] = ($this->version[$this->name][$ext_name] == $ext_ver);
} elseif ($this->isCacheReadable()) {
// No cache version found
- logDebugMessage(__METHOD__, __LINE__, 'Cache ' . $this->name . ' has missing version entry for extension ' . $ext_name . '! Purging cache...');
+ logDebugMessage(__METHOD__, __LINE__, 'Cache ' . $this->name . ' has missing version entry for extension ext-' . $ext_name . '! Purging cache...');
// Remove the cache file
$this->removeCacheFile(TRUE);