diff options
Diffstat (limited to 'system/libraries')
-rwxr-xr-x | system/libraries/Cache/drivers/Cache_file.php | 11 | ||||
-rw-r--r-- | system/libraries/Migration.php | 32 | ||||
-rwxr-xr-x | system/libraries/Profiler.php | 2 | ||||
-rwxr-xr-x | system/libraries/Session.php | 7 |
4 files changed, 22 insertions, 30 deletions
diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index c50043660..e515eebf1 100755 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -151,13 +151,12 @@ class CI_Cache_file extends CI_Driver { { return FALSE; } - - $data = read_file($this->_cache_path.$id); + + $data = read_file($this->_cache_path.$id); $data = unserialize($data); - + if (is_array($data)) { - $data = $data['data']; $mtime = filemtime($this->_cache_path.$id); if ( ! isset($data['ttl'])) @@ -166,11 +165,11 @@ class CI_Cache_file extends CI_Driver { } return array( - 'expire' => $mtime + $data['ttl'], + 'expire' => $mtime + $data['ttl'], 'mtime' => $mtime ); } - + return FALSE; } diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index 5a41377ea..df2dd7ce3 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -57,7 +57,7 @@ class CI_Migration { } // If not set, set it - $this->_migration_path == '' OR $this->_migration_path = APPPATH . 'migrations/'; + $this->_migration_path == '' AND $this->_migration_path = APPPATH . 'migrations/'; // Add trailing slash if not set $this->_migration_path = rtrim($this->_migration_path, '/').'/'; @@ -89,8 +89,7 @@ class CI_Migration { * Calls each migration step required to get to the schema version of * choice * - * @access public - * @param $version integer Target schema version + * @param int Target schema version * @return mixed TRUE if already latest, FALSE if failed, int if upgraded */ public function version($target_version) @@ -105,14 +104,13 @@ class CI_Migration { ++$stop; $step = 1; } - else { // Moving Down $step = -1; } - - $method = $step === 1 ? 'up' : 'down'; + + $method = ($step === 1) ? 'up' : 'down'; $migrations = array(); // We now prepare to actually DO the migrations @@ -216,7 +214,6 @@ class CI_Migration { /** * Set's the schema to the latest migration * - * @access public * @return mixed true if already latest, false if failed, int if upgraded */ public function latest() @@ -228,7 +225,7 @@ class CI_Migration { } $last_migration = basename(end($migrations)); - + // Calculate the last migration step from existing migration // filenames and procceed to the standard version migration return $this->version((int) substr($last_migration, 0, 3)); @@ -239,7 +236,6 @@ class CI_Migration { /** * Set's the schema to the migration version set in config * - * @access public * @return mixed true if already current, false if failed, int if upgraded */ public function current() @@ -252,7 +248,6 @@ class CI_Migration { /** * Error string * - * @access public * @return string Error message returned as a string */ public function error_string() @@ -265,7 +260,6 @@ class CI_Migration { /** * Set's the schema to the latest migration * - * @access protected * @return mixed true if already latest, false if failed, int if upgraded */ protected function find_migrations() @@ -273,7 +267,7 @@ class CI_Migration { // Load all *_*.php files in the migrations path $files = glob($this->_migration_path . '*_*.php'); $file_count = count($files); - + for ($i = 0; $i < $file_count; $i++) { // Mark wrongly formatted files as false for later filtering @@ -283,9 +277,8 @@ class CI_Migration { $files[$i] = FALSE; } } - - sort($files); + sort($files); return $files; } @@ -294,8 +287,7 @@ class CI_Migration { /** * Retrieves current schema version * - * @access protected - * @return integer Current Migration + * @return int Current Migration */ protected function _get_version() { @@ -308,9 +300,8 @@ class CI_Migration { /** * Stores the current schema version * - * @access protected - * @param $migrations integer Migration reached - * @return void Outputs a report of the migration + * @param int Migration reached + * @return bool */ protected function _update_version($migrations) { @@ -324,8 +315,7 @@ class CI_Migration { /** * Enable the use of CI super-global * - * @access public - * @param $var + * @param mixed $var * @return mixed */ public function __get($var) diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 082a5ee1d..882a82c1f 100755 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -506,7 +506,7 @@ class CI_Profiler { foreach ($this->CI->session->all_userdata() as $key => $val) { - if (is_array($val)) + if (is_array($val) OR is_object($val)) { $val = print_r($val, TRUE); } diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 8ee08c5b2..891fdd36a 100755 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -97,7 +97,7 @@ class CI_Session { { $this->sess_expiration = (60*60*24*365*2); } - + // Set the cookie name $this->sess_cookie_name = $this->cookie_prefix.$this->sess_cookie_name; @@ -399,7 +399,7 @@ class CI_Session { function sess_destroy() { // Kill the session DB row - if ($this->sess_use_database === TRUE AND isset($this->userdata['session_id'])) + if ($this->sess_use_database === TRUE && isset($this->userdata['session_id'])) { $this->CI->db->where('session_id', $this->userdata['session_id']); $this->CI->db->delete($this->sess_table_name); @@ -414,6 +414,9 @@ class CI_Session { $this->cookie_domain, 0 ); + + // Kill session data + $this->userdata = array(); } // -------------------------------------------------------------------- |