Adding fix for #2607, fixes Fatal error: Call to a member function on a non-object when using php 4

Adding fix for #2590, fixes ps_files_cleanup_dir: failed: Permission denied

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5124 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-05-20 04:44:18 +00:00
parent 540b1052d8
commit e2617621fd
2 changed files with 78 additions and 80 deletions

View file

@ -174,8 +174,9 @@ class AclComponent extends Object {
* *
* @package cake * @package cake
* @subpackage cake.cake.libs.controller.components * @subpackage cake.cake.libs.controller.components
* @abstract
*/ */
class AclBase { class AclBase extends Object {
/** /**
* This class should never be instantiated, just subclassed. * This class should never be instantiated, just subclassed.
* *

View file

@ -360,34 +360,6 @@ class CakeSession extends Object {
$this->__overwrite($_SESSION, Set::insert($_SESSION, $var, $value)); $this->__overwrite($_SESSION, Set::insert($_SESSION, $var, $value));
return (Set::extract($_SESSION, $var) == $value); return (Set::extract($_SESSION, $var) == $value);
} }
/**
* Method called on close of a database
* session
*
* @return boolean
* @access private
*/
function __close() {
$probability = mt_rand(1, 150);
if($probability <= 3) {
CakeSession::__gc();
}
return true;
}
/**
* Method called on the destruction of a
* database session
*
* @param integer $key
* @return boolean
* @access private
*/
function __destroy($key) {
$db =& ConnectionManager::getDataSource('default');
$table = $db->fullTableName(CAKE_SESSION_TABLE);
$db->execute("DELETE FROM " . $db->name($table) . " WHERE " . $db->name($table.'.id') . " = " . $db->value($key, 'integer'));
return true;
}
/** /**
* Helper method to destroy invalid sessions. * Helper method to destroy invalid sessions.
* *
@ -411,20 +383,6 @@ class CakeSession extends Object {
$this->__construct($this->path); $this->__construct($this->path);
$this->renew(); $this->renew();
} }
/**
* Helper function called on gc for
* database sessions
*
* @param unknown_type $expires
* @return boolean
* @access private
*/
function __gc($expires = null) {
$db =& ConnectionManager::getDataSource('default');
$table = $db->fullTableName(CAKE_SESSION_TABLE);
$db->execute("DELETE FROM " . $db->name($table) . " WHERE " . $db->name($table.'.expires') . " < ". $db->value(time()));
return true;
}
/** /**
* Helper method to initialize a session, based on Cake core settings. * Helper method to initialize a session, based on Cake core settings.
* *
@ -459,7 +417,6 @@ class CakeSession extends Object {
ini_set('session.name', CAKE_SESSION_COOKIE); ini_set('session.name', CAKE_SESSION_COOKIE);
ini_set('session.cookie_lifetime', $this->cookieLifeTime); ini_set('session.cookie_lifetime', $this->cookieLifeTime);
ini_set('session.cookie_path', $this->path); ini_set('session.cookie_path', $this->path);
ini_set('session.gc_probability', 1);
ini_set('session.auto_start', 0); ini_set('session.auto_start', 0);
ini_set('session.save_path', TMP . 'sessions'); ini_set('session.save_path', TMP . 'sessions');
} }
@ -476,7 +433,6 @@ class CakeSession extends Object {
ini_set('session.name', CAKE_SESSION_COOKIE); ini_set('session.name', CAKE_SESSION_COOKIE);
ini_set('session.cookie_lifetime', $this->cookieLifeTime); ini_set('session.cookie_lifetime', $this->cookieLifeTime);
ini_set('session.cookie_path', $this->path); ini_set('session.cookie_path', $this->path);
ini_set('session.gc_probability', 1);
ini_set('session.auto_start', 0); ini_set('session.auto_start', 0);
} }
} }
@ -494,7 +450,6 @@ class CakeSession extends Object {
ini_set('session.name', CAKE_SESSION_COOKIE); ini_set('session.name', CAKE_SESSION_COOKIE);
ini_set('session.cookie_lifetime', $this->cookieLifeTime); ini_set('session.cookie_lifetime', $this->cookieLifeTime);
ini_set('session.cookie_path', $this->path); ini_set('session.cookie_path', $this->path);
ini_set('session.gc_probability', 1);
} }
} }
break; break;
@ -535,40 +490,6 @@ class CakeSession extends Object {
$this->__setError(1, "Session is valid"); $this->__setError(1, "Session is valid");
} }
} }
/**
* Method called on open of a database
* sesson
*
* @return boolean
* @access private
*
*/
function __open() {
return true;
}
/**
* Method used to read from a database
* session
*
* @param mixed $key The key of the value to read
* @return mixed The value of the key or false if it does not exist
* @access private
*/
function __read($key) {
$db =& ConnectionManager::getDataSource('default');
$table = $db->fullTableName(CAKE_SESSION_TABLE, false);
$row = $db->query("SELECT " . $db->name($table.'.data') . " FROM " . $db->name($table) . " WHERE " . $db->name($table.'.id') . " = " . $db->value($key), false);
if ($row && !isset($row[0][$table]) && isset($row[0][0])) {
$table = 0;
}
if ($row && $row[0][$table]['data']) {
return $row[0][$table]['data'];
} else {
return false;
}
}
/** /**
* Helper method to restart a session. * Helper method to restart a session.
* *
@ -640,6 +561,54 @@ class CakeSession extends Object {
$this->error[$errorNumber] = $errorMessage; $this->error[$errorNumber] = $errorMessage;
$this->lastError = $errorNumber; $this->lastError = $errorNumber;
} }
/**
* Method called on open of a database
* sesson
*
* @return boolean
* @access private
*
*/
function __open() {
return true;
}
/**
* Method called on close of a database
* session
*
* @return boolean
* @access private
*/
function __close() {
$probability = mt_rand(1, 150);
if($probability <= 3) {
CakeSession::__gc();
}
return true;
}
/**
* Method used to read from a database
* session
*
* @param mixed $key The key of the value to read
* @return mixed The value of the key or false if it does not exist
* @access private
*/
function __read($key) {
$db =& ConnectionManager::getDataSource('default');
$table = $db->fullTableName(CAKE_SESSION_TABLE, false);
$row = $db->query("SELECT " . $db->name($table.'.data') . " FROM " . $db->name($table) . " WHERE " . $db->name($table.'.id') . " = " . $db->value($key), false);
if ($row && !isset($row[0][$table]) && isset($row[0][0])) {
$table = 0;
}
if ($row && $row[0][$table]['data']) {
return $row[0][$table]['data'];
} else {
return false;
}
}
/** /**
* Helper function called on write for database * Helper function called on write for database
* sessions * sessions
@ -685,5 +654,33 @@ class CakeSession extends Object {
} }
return true; return true;
} }
/**
* Method called on the destruction of a
* database session
*
* @param integer $key
* @return boolean
* @access private
*/
function __destroy($key) {
$db =& ConnectionManager::getDataSource('default');
$table = $db->fullTableName(CAKE_SESSION_TABLE);
$db->execute("DELETE FROM " . $db->name($table) . " WHERE " . $db->name($table.'.id') . " = " . $db->value($key, 'integer'));
return true;
}
/**
* Helper function called on gc for
* database sessions
*
* @param unknown_type $expires
* @return boolean
* @access private
*/
function __gc($expires = null) {
$db =& ConnectionManager::getDataSource('default');
$table = $db->fullTableName(CAKE_SESSION_TABLE);
$db->execute("DELETE FROM " . $db->name($table) . " WHERE " . $db->name($table.'.expires') . " < ". $db->value(time()));
return true;
}
} }
?> ?>