mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
- get session list for session.save_handler='files' working again
- sessions are sorted by default with session_dla DESC (newest updated sessions first)
This commit is contained in:
parent
a18f6d1b85
commit
c475f86147
@ -51,7 +51,7 @@
|
|||||||
{
|
{
|
||||||
$info = array(
|
$info = array(
|
||||||
'start' => 0,
|
'start' => 0,
|
||||||
'sort' => 'asc',
|
'sort' => 'DESC',
|
||||||
'order' => 'session_dla'
|
'order' => 'session_dla'
|
||||||
);
|
);
|
||||||
$this->store_location($info);
|
$this->store_location($info);
|
||||||
|
@ -1162,10 +1162,10 @@ class egw_session //extends sessions
|
|||||||
*
|
*
|
||||||
* @param int $start
|
* @param int $start
|
||||||
* @param string $sort='session_dla' session_lid, session_id, session_started, session_logintime, session_action, or (default) session_dla
|
* @param string $sort='session_dla' session_lid, session_id, session_started, session_logintime, session_action, or (default) session_dla
|
||||||
* @param string $order='ASC' ASC or DESC
|
* @param string $order='DESC' ASC or DESC
|
||||||
* @return array with sessions (values for keys as in $sort) or array() if not supported by session-handler
|
* @return array with sessions (values for keys as in $sort) or array() if not supported by session-handler
|
||||||
*/
|
*/
|
||||||
public static function session_list($start,$sort='ASC',$order='session_dla')
|
public static function session_list($start,$sort='DESC',$order='session_dla')
|
||||||
{
|
{
|
||||||
if (method_exists(self::$session_handler,'session_list'))
|
if (method_exists(self::$session_handler,'session_list'))
|
||||||
{
|
{
|
||||||
|
@ -33,16 +33,16 @@ class egw_session_files
|
|||||||
*
|
*
|
||||||
* @param int $start
|
* @param int $start
|
||||||
* @param string $sort='session_dla' session_lid, session_id, session_started, session_logintime, session_action, or (default) session_dla
|
* @param string $sort='session_dla' session_lid, session_id, session_started, session_logintime, session_action, or (default) session_dla
|
||||||
* @param string $order='ASC' ASC or DESC
|
* @param string $order='DESC' ASC or DESC
|
||||||
* @return array with sessions (values for keys as in $sort) or array() if not supported by session-handler
|
* @return array with sessions (values for keys as in $sort) or array() if not supported by session-handler
|
||||||
*/
|
*/
|
||||||
public static function session_list($start,$sort='ASC',$order='session_dla',$all_no_sort = False)
|
public static function session_list($start,$sort='DESC',$order='session_dla',$all_no_sort = False)
|
||||||
{
|
{
|
||||||
if (session_module_name() != 'files')
|
if (session_module_name() != 'files')
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
//echo '<p>'.__METHOD__."($start,'$order','$sort',$all)</p>\n";
|
//echo '<p>'.__METHOD__."($start,sort='$sort',order='$order',$all)</p>\n".function_backtrace();
|
||||||
$session_cache =& $_SESSION['egw_files_session_cache'];
|
$session_cache =& $_SESSION['egw_files_session_cache'];
|
||||||
|
|
||||||
$values = array();
|
$values = array();
|
||||||
@ -68,6 +68,7 @@ class egw_session_files
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
//echo "<p>$path/$file: ".substr(file_get_contents($path . '/' . $file,'r'),0,256)."</p>\n";
|
||||||
if (isset($session_cache[$file]) && !$session_cache[$file]) // session is marked as not to list (not ours or anonymous)
|
if (isset($session_cache[$file]) && !$session_cache[$file]) // session is marked as not to list (not ours or anonymous)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -89,19 +90,14 @@ class egw_session_files
|
|||||||
$session_cache[$file] = false; // dont try reading it again
|
$session_cache[$file] = false; // dont try reading it again
|
||||||
continue; // happens if webserver runs multiple user-ids
|
continue; // happens if webserver runs multiple user-ids
|
||||||
}
|
}
|
||||||
$session = '';
|
unset($session);
|
||||||
if (($fd = fopen ($path . '/' . $file,'r')))
|
list(,$session) = explode(egw_session::EGW_SESSION_VAR.'|',file_get_contents($path . '/' . $file,'r'));
|
||||||
{
|
if (!$session || !($session = unserialize($session)))
|
||||||
$session = ($size = filesize ($path . '/' . $file)) ? fread ($fd, $size) : 0;
|
|
||||||
fclose ($fd);
|
|
||||||
}
|
|
||||||
if (substr($session,0,1+strlen(EGW_SESSION_VAR)) != EGW_SESSION_VAR.'|')
|
|
||||||
{
|
{
|
||||||
$session_cache[$file] = false; // dont try reading it again
|
$session_cache[$file] = false; // dont try reading it again
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$session = unserialize(substr($session,1+strlen(EGW_SESSION_VAR)));
|
unset($session[egw_session::EGW_APPSESSION_VAR]); // not needed, saves memory
|
||||||
unset($session['app_sessions']); // not needed, saves memory
|
|
||||||
$session['php_session_file'] = $path . '/' . $file;
|
$session['php_session_file'] = $path . '/' . $file;
|
||||||
$session_cache[$file] = $session;
|
$session_cache[$file] = $session;
|
||||||
|
|
||||||
@ -131,8 +127,7 @@ class egw_session_files
|
|||||||
|
|
||||||
if(!$all_no_sort)
|
if(!$all_no_sort)
|
||||||
{
|
{
|
||||||
uasort($values,create_function('$a,$b','return '.(strcasecmp($sort,'ASC') ? '' : '-').'strcasecmp($a['.$order.'],$b['.$order.']);'));
|
uasort($values,create_function('$a,$b','return '.(!strcasecmp($sort,'ASC') ? '' : '-').'strcasecmp($a['.$order.'],$b['.$order.']);'));
|
||||||
|
|
||||||
return array_slice($values,(int)$start,$maxmatchs);
|
return array_slice($values,(int)$start,$maxmatchs);
|
||||||
}
|
}
|
||||||
return $values;
|
return $values;
|
||||||
|
Loading…
Reference in New Issue
Block a user