4,251
社区成员




Warning (2): strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead [CORE\cake\libs\cache.php, line 597]Code | Context$settings = array(
"engine" => "File",
"path" => "I:\Apache\Apache2.2\htdocs\cakephp-1.3.9-0\app\tmp\cache\persistent\",
"prefix" => "cake_core_",
"lock" => false,
"serialize" => true,
"isWindows" => true,
"duration" => "+10 seconds",
"probability" => 100
)strtotime - [internal], line ??
CacheEngine::init() - CORE\cake\libs\cache.php, line 597
FileEngine::init() - CORE\cake\libs\cache\file.php, line 81
Cache::_buildEngine() - CORE\cake\libs\cache.php, line 166
Cache::config() - CORE\cake\libs\cache.php, line 141
Configure::__loadBootstrap() - CORE\cake\libs\configure.php, line 421
Configure::getInstance() - CORE\cake\libs\configure.php, line 52
include - CORE\cake\bootstrap.php, line 38
require - APP\webroot\index.php, line 76
[main] - CORE\index.php, line 55
Notice: Trying to get property of non-object in I:\Apache\Apache2.2\htdocs\cakephp-1.3.9-0\cake\libs\cache\file.php on line 248
Fatal error: Call to a member function cd() on a non-object in I:\Apache\Apache2.2\htdocs\cakephp-1.3.9-0\cake\libs\cache\file.php on line 248
//cache.php
class CacheEngine {
/**
* Settings of current engine instance
*
* @var int
* @access public
*/
var $settings = array();
/**
* Initialize the cache engine
*
* Called automatically by the cache frontend
*
* @param array $params Associative array of parameters for the engine
* @return boolean True if the engine has been succesfully initialized, false if not
* @access public
*/
function init($settings = array()) {
$this->settings = array_merge(
array('prefix' => 'cake_', 'duration'=> 3600, 'probability'=> 100),
$this->settings,
$settings
);
if (!is_numeric($this->settings['duration'])) {
$this->settings['duration'] = strtotime($this->settings['duration']) - time();
}
return true;
}
/**
* Garbage collection
*
* Permanently remove all expired and deleted data
*
* @access public
*/
function gc() {
}
/**
* Write value for a key into cache
*
* @param string $key Identifier for the data
* @param mixed $value Data to be cached
* @param mixed $duration How long to cache the data, in seconds
* @return boolean True if the data was succesfully cached, false on failure
* @access public
*/
function write($key, &$value, $duration) {
trigger_error(sprintf(__('Method write() not implemented in %s', true), get_class($this)), E_USER_ERROR);
}
/**
* Read a key from the cache
*
* @param string $key Identifier for the data
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
* @access public
*/
function read($key) {
trigger_error(sprintf(__('Method read() not implemented in %s', true), get_class($this)), E_USER_ERROR);
}
/**
* Increment a number under the key and return incremented value
*
* @param string $key Identifier for the data
* @param integer $offset How much to add
* @return New incremented value, false otherwise
* @access public
*/
function increment($key, $offset = 1) {
trigger_error(sprintf(__('Method increment() not implemented in %s', true), get_class($this)), E_USER_ERROR);
}
/**
* Decrement a number under the key and return decremented value
*
* @param string $key Identifier for the data
* @param integer $value How much to substract
* @return New incremented value, false otherwise
* @access public
*/
function decrement($key, $offset = 1) {
trigger_error(sprintf(__('Method decrement() not implemented in %s', true), get_class($this)), E_USER_ERROR);
}
/**
* Delete a key from the cache
*
* @param string $key Identifier for the data
* @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed
* @access public
*/
function delete($key) {
}
/**
* Delete all keys from the cache
*
* @param boolean $check if true will check expiration, otherwise delete all
* @return boolean True if the cache was succesfully cleared, false otherwise
* @access public
*/
function clear($check) {
}
/**
* Cache Engine settings
*
* @return array settings
* @access public
*/
function settings() {
return $this->settings;
}
/**
* Generates a safe key for use with cache engine storage engines.
*
* @param string $key the key passed over
* @return mixed string $key or false
* @access public
*/
function key($key) {
if (empty($key)) {
return false;
}
$key = Inflector::underscore(str_replace(array(DS, '/', '.'), '_', strval($key)));
return $key;
}
}
Release Notes for CakePHP 1.3.9.
Read the changelog
Notice (1024): Please change the value of 'Security.salt' in app/config/core.php to a salt value specific to your application [CORE\cake\libs\debugger.php, line 684]Code function checkSecurityKeys() {
if (Configure::read('Security.salt') == 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi') {
trigger_error(__('Please change the value of \'Security.salt\' in app/config/core.php to a salt value specific to your application', true), E_USER_NOTICE);Debugger::checkSecurityKeys() - CORE\cake\libs\debugger.php, line 684
include - CORE\cake\libs\view\pages\home.ctp, line 27
View::_render() - CORE\cake\libs\view\view.php, line 731
View::render() - CORE\cake\libs\view\view.php, line 426
Controller::render() - CORE\cake\libs\controller\controller.php, line 909
PagesController::display() - CORE\cake\libs\controller\pages_controller.php, line 83
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
require - APP\webroot\index.php, line 83
[main] - CORE\index.php, line 55Notice (1024): Please change the value of 'Security.cipherSeed' in app/config/core.php to a numeric (digits only) seed value specific to your application [CORE\cake\libs\debugger.php, line 688]Code
if (Configure::read('Security.cipherSeed') === '76859309657453542496749683645') {
trigger_error(__('Please change the value of \'Security.cipherSeed\' in app/config/core.php to a numeric (digits only) seed value specific to your application', true), E_USER_NOTICE);Debugger::checkSecurityKeys() - CORE\cake\libs\debugger.php, line 688
include - CORE\cake\libs\view\pages\home.ctp, line 27
View::_render() - CORE\cake\libs\view\view.php, line 731
View::render() - CORE\cake\libs\view\view.php, line 426
Controller::render() - CORE\cake\libs\controller\controller.php, line 909
PagesController::display() - CORE\cake\libs\controller\pages_controller.php, line 83
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
require - APP\webroot\index.php, line 83
[main] - CORE\index.php, line 55Your tmp directory is writable.
The FileEngine is being used for caching. To change the config edit APP/config/core.php
Your database configuration file is NOT present.
Rename config/database.php.default to config/database.php
Editing this Page
To change the content of this page, create: APP/views/pages/home.ctp.
To change its layout, create: APP/views/layouts/default.ctp.
You can also add some CSS styles for your pages at: APP/webroot/css.
Getting Started
//cathe/file.php
<?php
/**
* File Storage engine for cache
*
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs.cache
* @since CakePHP(tm) v 1.2.0.4933
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
if (!class_exists('File')) {
require LIBS . 'file.php';
}
/**
* File Storage engine for cache
*
* @todo use the File and Folder classes (if it's not a too big performance hit)
* @package cake
* @subpackage cake.cake.libs.cache
*/
class FileEngine extends CacheEngine {
/**
* Instance of File class
*
* @var File
* @access protected
*/
var $_File = null;
/**
* Settings
*
* - path = absolute path to cache directory, default => CACHE
* - prefix = string prefix for filename, default => cake_
* - lock = enable file locking on write, default => false
* - serialize = serialize the data, default => true
*
* @var array
* @see CacheEngine::__defaults
* @access public
*/
var $settings = array();
/**
* True unless FileEngine::__active(); fails
*
* @var boolean
* @access protected
*/
var $_init = true;
/**
* Initialize the Cache Engine
*
* Called automatically by the cache frontend
* To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
*
* @param array $setting array of setting for the engine
* @return boolean True if the engine has been successfully initialized, false if not
* @access public
*/
function init($settings = array()) {
parent::init(array_merge(
array(
'engine' => 'File', 'path' => CACHE, 'prefix'=> 'cake_', 'lock'=> false,
'serialize'=> true, 'isWindows' => false
),
$settings
));
if (!isset($this->_File)) {
$this->_File =& new File($this->settings['path'] . DS . 'cake');
}
if (DIRECTORY_SEPARATOR === '\\') {
$this->settings['isWindows'] = true;
}
$path = $this->_File->Folder->cd($this->settings['path']);
if ($path) {
$this->settings['path'] = $path;
}
return $this->__active();
}
/**
* Garbage collection. Permanently remove all expired and deleted data
*
* @return boolean True if garbage collection was succesful, false on failure
* @access public
*/
function gc() {
return $this->clear(true);
}
/**
* Write data for key into cache
*
* @param string $key Identifier for the data
* @param mixed $data Data to be cached
* @param mixed $duration How long to cache the data, in seconds
* @return boolean True if the data was succesfully cached, false on failure
* @access public
*/
function write($key, &$data, $duration) {
if ($data === '' || !$this->_init) {
return false;
}
if ($this->_setKey($key) === false) {
return false;
}
$lineBreak = "\n";
if ($this->settings['isWindows']) {
$lineBreak = "\r\n";
}
if (!empty($this->settings['serialize'])) {
if ($this->settings['isWindows']) {
$data = str_replace('\\', '\\\\\\\\', serialize($data));
} else {
$data = serialize($data);
}
}
if ($this->settings['lock']) {
$this->_File->lock = true;
}
$expires = time() + $duration;
$contents = $expires . $lineBreak . $data . $lineBreak;
$success = $this->_File->write($contents);
$this->_File->close();
return $success;
}
/**
* Read a key from the cache
*
* @param string $key Identifier for the data
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
* @access public
*/
function read($key) {
if ($this->_setKey($key) === false || !$this->_init || !$this->_File->exists()) {
return false;
}
if ($this->settings['lock']) {
$this->_File->lock = true;
}
$time = time();
$cachetime = intval($this->_File->read(11));
if ($cachetime !== false && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) {
$this->_File->close();
return false;
}
$data = $this->_File->read(true);
if ($data !== '' && !empty($this->settings['serialize'])) {
if ($this->settings['isWindows']) {
$data = str_replace('\\\\\\\\', '\\', $data);
}
$data = unserialize((string)$data);
}
$this->_File->close();
return $data;
}
/**
* Delete a key from the cache
*
* @param string $key Identifier for the data
* @return boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed
* @access public
*/
function delete($key) {
if ($this->_setKey($key) === false || !$this->_init) {
return false;
}
return $this->_File->delete();
}
/**
* Delete all values from the cache
*
* @param boolean $check Optional - only delete expired cache items
* @return boolean True if the cache was succesfully cleared, false otherwise
* @access public
*/
function clear($check) {
if (!$this->_init) {
return false;
}
$dir = dir($this->settings['path']);
if ($check) {
$now = time();
$threshold = $now - $this->settings['duration'];
}
$prefixLength = strlen($this->settings['prefix']);
while (($entry = $dir->read()) !== false) {
if (substr($entry, 0, $prefixLength) !== $this->settings['prefix']) {
continue;
}
if ($this->_setKey($entry) === false) {
continue;
}
if ($check) {
$mtime = $this->_File->lastChange();
if ($mtime === false || $mtime > $threshold) {
continue;
}
$expires = $this->_File->read(11);
$this->_File->close();
if ($expires > $now) {
continue;
}
}
$this->_File->delete();
}
$dir->close();
return true;
}
/**
* Get absolute file for a given key
*
* @param string $key The key
* @return mixed Absolute cache file for the given key or false if erroneous
* @access private
*/
function _setKey($key) {
$this->_File->Folder->cd($this->settings['path']);
if ($key !== $this->_File->name) {
$this->_File->name = $key;
$this->_File->path = null;
}
if (!$this->_File->Folder->inPath($this->_File->pwd(), true)) {
return false;
}
}
/**
* Determine is cache directory is writable
*
* @return boolean
* @access private
*/
function __active() {
if ($this->_init && !is_writable($this->settings['path'])) {
$this->_init = false;
trigger_error(sprintf(__('%s is not writable', true), $this->settings['path']), E_USER_WARNING);
return false;
}
return true;
}
}