зеркало из https://github.com/mozilla/pjs.git
added session garbage collection to maintenance.php. We don't need the maintenance
config because we'll just use the public one
This commit is contained in:
Родитель
4596ba815f
Коммит
c127caab7d
|
@ -24,7 +24,7 @@ class AMO_SQL extends SQL
|
||||||
* If our current script is in the shadow array, we should
|
* If our current script is in the shadow array, we should
|
||||||
* connect to the shadow db instead of the default.
|
* connect to the shadow db instead of the default.
|
||||||
*/
|
*/
|
||||||
if (in_array(SCRIPT_NAME, $shadow_config)) {
|
if (defined('SCRIPT_NAME') && in_array(SCRIPT_NAME, $shadow_config)) {
|
||||||
$shadow_dsn = array (
|
$shadow_dsn = array (
|
||||||
'phptype' => 'mysql',
|
'phptype' => 'mysql',
|
||||||
'dbsyntax' => 'mysql',
|
'dbsyntax' => 'mysql',
|
||||||
|
|
|
@ -23,7 +23,10 @@ if (isset($_SERVER['HTTP_HOST'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we get here, we're on the command line, which means we can continue.
|
// If we get here, we're on the command line, which means we can continue.
|
||||||
require_once('config.php');
|
require_once('../../public/inc/config.php');
|
||||||
|
|
||||||
|
// For the addon object and db stuff
|
||||||
|
require_once('../../public/inc/includes.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* * Get time as a float.
|
* * Get time as a float.
|
||||||
|
@ -203,6 +206,10 @@ switch ($action) {
|
||||||
|
|
||||||
// This is unreliable, but it's not a big deal.
|
// This is unreliable, but it's not a big deal.
|
||||||
$affected_rows = mysql_affected_rows();
|
$affected_rows = mysql_affected_rows();
|
||||||
|
|
||||||
|
echo 'Cleaning session tables...'."\n";
|
||||||
|
$_auth->gcSession();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -277,10 +277,10 @@ class AMO_Auth extends AMO_Object{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean out stale sessions
|
* Clean out stale sessions
|
||||||
* @access private
|
* @access public
|
||||||
* @return bool true
|
* @return bool true
|
||||||
*/
|
*/
|
||||||
function _gcSession()
|
function gcSession()
|
||||||
{
|
{
|
||||||
$_sql = "DELETE FROM
|
$_sql = "DELETE FROM
|
||||||
`{$this->_session_table}`
|
`{$this->_session_table}`
|
||||||
|
|
Загрузка…
Ссылка в новой задаче