Update database and helper functionality in CodeIgniter
Revised database drivers, query builder, and file/inflector helpers for improved consistency and functionality. Updated copyrights, links, and standardized function names including deprecating `is_countable` in favor of `word_is_countable`. Added support for new SQL features and optimized query handling.
This commit is contained in:
Executable → Regular
+53
-15
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2017, British Columbia Institute of Technology
|
||||
* Copyright (c) 2019 - 2022, CodeIgniter Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -29,8 +29,9 @@
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
|
||||
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
|
||||
* @license https://opensource.org/licenses/MIT MIT License
|
||||
* @link https://codeigniter.com
|
||||
* @since Version 3.0.0
|
||||
* @filesource
|
||||
@@ -44,9 +45,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
* @subpackage Libraries
|
||||
* @category Sessions
|
||||
* @author Andrey Andreev
|
||||
* @link https://codeigniter.com/user_guide/libraries/sessions.html
|
||||
* @link https://codeigniter.com/userguide3/libraries/sessions.html
|
||||
*/
|
||||
class CI_Session_memcached_driver extends CI_Session_driver implements SessionHandlerInterface {
|
||||
class CI_Session_memcached_driver extends CI_Session_driver implements CI_Session_driver_interface {
|
||||
|
||||
/**
|
||||
* Memcached instance
|
||||
@@ -117,7 +118,7 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
|
||||
{
|
||||
$this->_memcached = NULL;
|
||||
log_message('error', 'Session: Invalid Memcached save path format: '.$this->_config['save_path']);
|
||||
return $this->_fail();
|
||||
return $this->_failure;
|
||||
}
|
||||
|
||||
foreach ($matches as $match)
|
||||
@@ -142,9 +143,11 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
|
||||
if (empty($server_list))
|
||||
{
|
||||
log_message('error', 'Session: Memcached server pool is empty.');
|
||||
return $this->_fail();
|
||||
return $this->_failure;
|
||||
}
|
||||
|
||||
$this->php5_validate_id();
|
||||
|
||||
return $this->_success;
|
||||
}
|
||||
|
||||
@@ -170,7 +173,7 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
|
||||
return $session_data;
|
||||
}
|
||||
|
||||
return $this->_fail();
|
||||
return $this->_failure;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -188,14 +191,14 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
|
||||
{
|
||||
if ( ! isset($this->_memcached, $this->_lock_key))
|
||||
{
|
||||
return $this->_fail();
|
||||
return $this->_failure;
|
||||
}
|
||||
// Was the ID regenerated?
|
||||
elseif ($session_id !== $this->_session_id)
|
||||
{
|
||||
if ( ! $this->_release_lock() OR ! $this->_get_lock($session_id))
|
||||
{
|
||||
return $this->_fail();
|
||||
return $this->_failure;
|
||||
}
|
||||
|
||||
$this->_fingerprint = md5('');
|
||||
@@ -213,7 +216,7 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
|
||||
return $this->_success;
|
||||
}
|
||||
|
||||
return $this->_fail();
|
||||
return $this->_failure;
|
||||
}
|
||||
elseif (
|
||||
$this->_memcached->touch($key, $this->_config['expiration'])
|
||||
@@ -223,7 +226,7 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
|
||||
return $this->_success;
|
||||
}
|
||||
|
||||
return $this->_fail();
|
||||
return $this->_failure;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -242,14 +245,14 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
|
||||
$this->_release_lock();
|
||||
if ( ! $this->_memcached->quit())
|
||||
{
|
||||
return $this->_fail();
|
||||
return $this->_failure;
|
||||
}
|
||||
|
||||
$this->_memcached = NULL;
|
||||
return $this->_success;
|
||||
}
|
||||
|
||||
return $this->_fail();
|
||||
return $this->_failure;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -271,7 +274,7 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
|
||||
return $this->_success;
|
||||
}
|
||||
|
||||
return $this->_fail();
|
||||
return $this->_failure;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -290,6 +293,39 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
|
||||
return $this->_success;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Update Timestamp
|
||||
*
|
||||
* Update session timestamp without modifying data
|
||||
*
|
||||
* @param string $id Session ID
|
||||
* @param string $data Unknown & unused
|
||||
* @return bool
|
||||
*/
|
||||
public function updateTimestamp($id, $unknown)
|
||||
{
|
||||
return $this->_memcached->touch($this->_key_prefix.$id, $this->_config['expiration']);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validate ID
|
||||
*
|
||||
* Checks whether a session ID record exists server-side,
|
||||
* to enforce session.use_strict_mode.
|
||||
*
|
||||
* @param string $id Session ID
|
||||
* @return bool
|
||||
*/
|
||||
public function validateId($id)
|
||||
{
|
||||
$this->_memcached->get($this->_key_prefix.$id);
|
||||
return ($this->_memcached->getResultCode() === Memcached::RES_SUCCESS);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -313,6 +349,8 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
|
||||
? $this->_memcached->add($this->_lock_key, time(), 300)
|
||||
: FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// 30 attempts to obtain a lock, in case another request already has it
|
||||
|
||||
Reference in New Issue
Block a user