Remove config save_user_last_login see # 7042

1.10.x
jmontoya 9 years ago
parent a35502f7a5
commit 1afc60670b
  1. 14
      main/inc/global.inc.php
  2. 24
      main/inc/lib/api.lib.php
  3. 36
      main/inc/lib/tracking.lib.php
  4. 8
      main/inc/lib/usermanager.lib.php

@ -544,15 +544,11 @@ if (!isset($_SESSION['login_as']) && isset($_user)) {
$sql = "UPDATE $tbl_track_login SET logout_date = '$now'
WHERE login_id='$i_id_last_connection'";
Database::query($sql);
// Saves the last login in the user table see BT#7297
if (isset($_configuration['save_user_last_login']) &&
$_configuration['save_user_last_login']
) {
$tableUser = Database::get_main_table(TABLE_MAIN_USER);
$sql = "UPDATE $tableUser SET last_login = '$now'
WHERE user_id = ".$_user["user_id"];
Database::query($sql);
}
$tableUser = Database::get_main_table(TABLE_MAIN_USER);
$sql = "UPDATE $tableUser SET last_login = '$now'
WHERE user_id = ".$_user["user_id"];
Database::query($sql);
}
}

@ -1445,29 +1445,9 @@ function _api_format_user($user, $add_password = false)
$user_id = intval($user['user_id']);
// Maintain the user_id index for backwards compatibility
$result['user_id'] = $result['id'] = $user_id;
$saveUserLastLogin = api_get_configuration_value('save_user_last_login');
if ($saveUserLastLogin) {
$last_login = $user['last_login'];
} else {
if (!isset($user['lastLogin']) && !isset($user['last_login'])) {
$timestamp = Tracking::get_last_connection_date($result['user_id'], false, true);
// Convert the timestamp back into a datetime
// NOTE: this timestamp has ALREADY been converted to the local timezone in the get_last_connection_date function
$last_login = date('Y-m-d H:i:s', $timestamp);
} else {
if (isset($user['lastLogin'])) {
$last_login = $user['lastLogin'];
} else {
$last_login = $user['last_login'];
}
}
}
$result['last_login'] = $last_login;
$result['last_login'] = $user['last_login'];
// Kept for historical reasons
$result['lastLogin'] = $last_login;
$result['lastLogin'] = $user['last_login'];
// Getting user avatar.

@ -5390,25 +5390,23 @@ class Tracking
get_lang('Status'),
array(1 => get_lang('Active'), 0 => get_lang('Inactive'))
);
if (isset($_configuration['save_user_last_login']) &&
$_configuration['save_user_last_login']
) {
$form->addElement(
'select',
'sleeping_days',
get_lang('InactiveDays'),
array(
'',
1 => 1,
5 => 5,
15 => 15,
30 => 30,
60 => 60,
90 => 90,
120 => 120,
)
);
}
$form->addElement(
'select',
'sleeping_days',
get_lang('InactiveDays'),
array(
'',
1 => 1,
5 => 5,
15 => 15,
30 => 30,
60 => 60,
90 => 90,
120 => 120,
)
);
$form->addButtonSearch(get_lang('Search'));
return $form;

@ -3960,12 +3960,8 @@ class UserManager
}
if (!empty($lastConnectionDate)) {
if (isset($_configuration['save_user_last_login']) &&
$_configuration['save_user_last_login']
) {
$lastConnectionDate = Database::escape_string($lastConnectionDate);
$userConditions .= " AND u.last_login <= '$lastConnectionDate' ";
}
$lastConnectionDate = Database::escape_string($lastConnectionDate);
$userConditions .= " AND u.last_login <= '$lastConnectionDate' ";
}
$courseConditions = null;

Loading…
Cancel
Save