`user`.`language` AS `language`,
`user`.`register_date` AS `register_date`,
`user`.`login_date` AS `login_date`,
- IF (`user`.`last-activity` IS NULL, DATE(`user`.`login_date`), `user`.`last-activity`) AS `last-activity`,
+ `user`.`last-activity` AS `last-activity`,
`user`.`default-location` AS `default-location`,
`user`.`allow_location` AS `allow_location`,
`user`.`theme` AS `theme`,
}
// We display the last activity (post or login), reduced to year and week number
- $last_active = 0;
- $condition = ['uid' => $owner['uid'], 'self' => true];
- $contact = DBA::selectFirst('contact', ['last-item'], $condition);
- if (DBA::isResult($contact)) {
- $last_active = strtotime($contact['last-item']);
- }
-
- $user = User::getOwnerDataById($owner['uid']);
- if (DBA::isResult($user)) {
- if ($last_active < strtotime($user['last-activity'])) {
- $last_active = strtotime($user['last-activity']);
- }
+ $last_active = strtotime($owner['last-item']);
+ if ($last_active < strtotime($owner['last-activity'])) {
+ $last_active = strtotime($owner['last-activity']);
}
$json_info['last-activity'] = date('o-W', $last_active);
if (!empty($abandon_days)) {
$condition = DBA::mergeConditions($condition,
- ["`uid` != ? AND `uid` IN (SELECT `uid` FROM `owner-view` WHERE NOT `account_expired` AND NOT `account_removed` AND `last-activity` > ?)", 0, DateTimeFormat::utc('now - ' . $abandon_days . ' days')]);
+ ["`uid` != ? AND `uid` IN (SELECT `uid` FROM `user` WHERE NOT `account_expired` AND NOT `account_removed` AND `last-activity` > ?)", 0, DateTimeFormat::utc('now - ' . $abandon_days . ' days')]);
} else {
$condition = DBA::mergeConditions($condition,
["`uid` != ? AND `uid` IN (SELECT `uid` FROM `user` WHERE NOT `account_expired` AND NOT `account_removed`)", 0]);
"language" => ["user", "language"],
"register_date" => ["user", "register_date"],
"login_date" => ["user", "login_date"],
- "last-activity" => "IF (`user`.`last-activity` IS NULL, DATE(`user`.`login_date`), `user`.`last-activity`)",
+ "last-activity" => ["user", "last-activity"],
"default-location" => ["user", "default-location"],
"allow_location" => ["user", "allow_location"],
"theme" => ["user", "theme"],
{
DBA::update('contact', ['remote_self' => Contact::MIRROR_OWN_POST], ['remote_self' => Contact::MIRROR_FORWARDED]);
return Update::SUCCESS;
+}
+
+function update_1497()
+{
+ DBA::e("UPDATE `user` SET `last-activity` = DATE(`login_date`) WHERE `last-activity` IS NULL");
+ return Update::SUCCESS;
}
\ No newline at end of file