Compare commits

..

No commits in common. "64b50ead9fe5bdfc8e9cb33f55a5527567de4a02" and "c4f36235aba37d60c8d20c4672bcf45c2ad9b6c5" have entirely different histories.

4 changed files with 1 additions and 21 deletions

View File

@ -53,7 +53,6 @@ $router->any('/api/HA', 'GoogleHomeApi@response');
$router->post('/api/endpoint/', 'EndpointsApi@default');
$router->any('/api/update/', 'UpdatesApi@default');
$router->any('/api/users/status', 'UsersApi@status');
$router->any('/api/users/subscribe', 'UsersApi@subscribe');
// examples
$router->any('/api/example', 'ExampleApi@example');

View File

@ -12,11 +12,6 @@ class CronApi extends ApiController
$backupWorker = new DatabaseBackup();
$backupWorker->purge(5);
//Old Records Cleanup
foreach (SubDeviceManager::getAllSubDevices() as $key => $value) {
RecordManager::setHistory($value['subdevice_id']);
}
$this->response(['Value' => 'OK']);
}

View File

@ -34,13 +34,4 @@ class UsersApi extends ApiController{
}
$this->response(['value'=>'OK']);
}
public function subscribe(){
//$this->requireAuth();
$subscriptionToken = $this->input['token'];
$subscriptionUserId = $this->input['user_id'];
NotificationManager::addSubscriber($subscriptionUserId, $subscriptionToken);
$this->response(['value'=>'OK']);
}
}

View File

@ -102,7 +102,7 @@ class RecordManager{
public static function clean ($day) {
if (isset($day)) {
Db::command ('DELETE FROM records WHERE `time` < ADDDATE(NOW(), INTERVAL ? DAY);', array($day));
Db::command ('DELETE FROM records WHERE `time` < ADDDATE(NOW(), INTERVAL -? DAY);', array($day));
}
}
@ -110,10 +110,5 @@ class RecordManager{
public static function cleanSubdeviceRecords ($subDeviceId) {
Db::command ('DELETE FROM records WHERE subdevice_id = ?);', array($subDeviceId));
}
public static function setHistory($subDeviceId){
$history = SubDeviceManager::getSubDevice($subDeviceId)['history'];
if ($history > 0) self::clean(-abs($history));
}
}
?>