PHP_SMART_HOME_V3/app/api/CronApi.php

27 lines
779 B
PHP
Raw Normal View History

2020-10-14 12:35:04 +00:00
<?php
2020-07-21 08:29:26 +00:00
class CronApi extends ApiController {
2020-08-25 13:12:25 +00:00
2020-07-21 08:29:26 +00:00
public function clean(){
2020-07-21 08:34:15 +00:00
$logKeeper = new LogMaintainer();
2020-07-21 08:29:26 +00:00
$logKeeper->purge(LOGTIMOUT);
2020-07-28 07:02:46 +00:00
$this->response(['Value' => 'OK']);
2020-07-21 08:29:26 +00:00
}
2020-08-25 13:12:25 +00:00
public function fetch(){
2020-10-14 12:35:04 +00:00
//echo (new VirtualDeviceManager)->fetch('');
echo (new Covid)->fetch('');
echo (new OpenWeatherMap)->fetch('');
2020-10-15 16:55:16 +00:00
echo (new UsaElection)->fetch('');
2020-10-21 17:35:52 +00:00
echo (new AirQuality)->fetch('');
2020-10-14 12:35:04 +00:00
2020-10-19 14:23:39 +00:00
// Database Backup
$filenames = [];
$backupWorker = new DatabaseBackup;
$filenames[] = $backupWorker->scheme();
$filenames[] = $backupWorker->data();
$backupWorker->compress($_SERVER['DOCUMENT_ROOT'] . BASEDIR . '/backup/'.date("Y-m-d", time()).'.zip', $filenames);
2020-08-25 13:12:25 +00:00
$this->response(['Value' => 'OK']);
}
2020-10-14 12:35:04 +00:00
}