Commit dbe2cad3 authored by Matthias Larisch's avatar Matthias Larisch Committed by Gitlab

Remove fs_activity

The activity table was only used to show the online status on the
profile page which is replaced by isActive memcache implementation.

Also replaces wrong core.model isActive implementation (using activity_
memcache keys that are never filled) with the global db model one,
this should effectively do not send mails about chat messages to online
users anymore.
parent 11f9afcf
......@@ -141,29 +141,6 @@ class Model extends ManualDb
return false;
}
/**
* Method to check users online status by checking timestamp from memcahce
*
* @param integer $fs_id
* @return boolean
*/
public function isActive($fs_id)
{
if($time = Mem::get('activity_'.$fs_id))
{
if((time()-$time) > 600)
{
return false;
}
else
{
return true;
}
}
return false;
}
public function updateSleepMode($status,$from,$to,$msg)
{
return $this->update('
......
......@@ -107,15 +107,10 @@ class ProfileModel extends Model
fs.rolle,
UNIX_TIMESTAMP(fs.sleep_from) AS sleep_from_ts,
UNIX_TIMESTAMP(fs.sleep_until) AS sleep_until_ts,
fs.mailbox_id,
UNIX_TIMESTAMP(a.zeit) AS last_activity
fs.mailbox_id
FROM '.PREFIX.'foodsaver fs
LEFT JOIN '.PREFIX.'activity a
ON fs.id = a.foodsaver_id
WHERE fs.id = '.(int)$this->fs_id.'
')) == false)
......@@ -130,13 +125,8 @@ class ProfileModel extends Model
{
$data['bouched'] = true;
}
$data['online'] = false;
if( (time()-(int)$data['last_activity']) < 1800)
{
$data['online'] = true;
}
$data['online'] = $this->isActive((int)$this->fs_id);
$data['bananen'] = $this->q('
SELECT fs.id,
fs.name,
......
......@@ -696,12 +696,8 @@ class Db
public function logout()
{
//$this->update('UPDATE '.PREFIX.'foodsaver SET `gcm` = "" WHERE id = '.(int)fsId());
$this->del('DELETE FROM '.PREFIX.'activity WHERE `foodsaver_id` = '.(int)fsId());
Mem::userDel(fsId(), 'active');
Mem::userDel(fsId(), 'lastMailMessage');
}
public function login($email,$pass)
......@@ -841,29 +837,8 @@ class Db
{
if($time = Mem::user($fs_id, 'active'))
{
if((time()-$time) > 600)
{
return false;
}
else
{
return true;
}
}
/*
if($time = $this->qOne('SELECT UNIX_TIMESTAMP(`zeit`) FROM `'.PREFIX.'activity` WHERE `foodsaver_id` = '.$this->intval($fs_id)))
{
if((time()-$time) > 600)
{
return false;
}
else
{
return true;
}
return !((time()-$time) > 600);
}
*/
return false;
}
......@@ -875,8 +850,6 @@ class Db
}
Mem::userSet($fs_id, 'active', time());
Mem::userSet($fs_id, 'sid', session_id());
$this->update('UPDATE `'.PREFIX.'activity` SET `zeit` = NOW() WHERE `foodsaver_id` = '.$this->intval($fs_id));
}
public function dbLoginAs($fs_id)
......@@ -886,7 +859,6 @@ class Db
private function initSessionData($fs_id)
{
$this->insert('INSERT IGNORE INTO '.PREFIX.'activity(`foodsaver_id`,`zeit`)VALUE('.$this->intval($fs_id).',NOW()) ');
$this->updateActivity($fs_id);
if($fs = $this->qRow('
SELECT `id`,
......
......@@ -37,6 +37,9 @@ sql-file foodsharing migrations/static.sql
sql-file foodsharing migrations/27-profilchange.sql
sql-file foodsharing migrations/27-verify.sql
sql-file foodsharing tests/seed.sql
for f in migrations/incremental-*; do
sql-file foodsharing $f
done
echo "Running tests"
exec-in-container app vendor/bin/codecept run "$@"
......
......@@ -73,6 +73,9 @@ function migratedb() {
sql-file $database migrations/static.sql
sql-file $database migrations/27-profilchange.sql
sql-file $database migrations/27-verify.sql
for f in migrations/incremental-*; do
sql-file $database $f
done
}
function wait-for-mysql() {
......
......@@ -23,6 +23,9 @@ sql-file foodsharing migrations/static.sql
sql-file foodsharing migrations/27-profilchange.sql
sql-file foodsharing migrations/27-verify.sql
sql-file foodsharing tests/seed.sql
for f in migrations/incremental-*; do
sql-file foodsharing $f
done
echo "Running composer install"
exec-in-container app composer install
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment