<?php require_once 'class.tlonuserdocument.php'; TlonUserDocument::updateAll('ellak', time());
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ require_once 'class.tlondata.php'; TlonUserDocument::$TABLE = new TlonDataTable('tl_user_document', 'client_id, username, document_id, last_updated'); class TlonUserDocument { public static $TABLE = null; public static function add($username, $document_id) { self::delete($username, $document_id); return TlonData::insert(self::$TABLE, array(null, $username, $document_id, 0)); } public static function delete($username, $document_id) { return TlonData::delete(self::$TABLE, array(TlonDataComparison::equals('username', $username), TlonDataComparison::equals('document_id', $document_id))); } public static function deleteByDocumentID($document_id) { return TlonData::delete(self::$TABLE, TlonDataComparison::equals('document_id', $document_id));
private function cleanMessages($document_id) { if ($clients = TlonUserDocument::getByDocumentID($document_id)) { $oldest_client = 0; foreach ($clients as $client) { if ($client['last_updated'] < $oldest_client || $oldest_client == 0) { $oldest_client = $client['last_updated']; } } if ($oldest_client != 0) { TlonMessage::deleteByArrivalTimeBefore($oldest_client); } } }