2020-10-14 12:35:04 +00:00
|
|
|
<?php
|
2020-10-22 14:42:49 +00:00
|
|
|
class CronApi extends ApiController
|
|
|
|
{
|
2020-08-25 13:12:25 +00:00
|
|
|
|
2020-10-22 14:42:49 +00:00
|
|
|
public function clean()
|
|
|
|
{
|
|
|
|
//Log Cleaning
|
|
|
|
$logKeeper = new LogMaintainer();
|
|
|
|
$logKeeper->purge(LOGTIMOUT);
|
|
|
|
|
|
|
|
//Database Backup Cleanup
|
|
|
|
$backupWorker = new DatabaseBackup();
|
|
|
|
$backupWorker->purge(5);
|
2020-08-25 13:12:25 +00:00
|
|
|
|
2020-10-22 14:42:49 +00:00
|
|
|
$this->response(['Value' => 'OK']);
|
|
|
|
}
|
2020-10-14 12:35:04 +00:00
|
|
|
|
2020-10-22 14:42:49 +00:00
|
|
|
public function fetch()
|
|
|
|
{
|
|
|
|
//Run Plugins
|
|
|
|
$result = [];
|
|
|
|
$dir = $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/';
|
|
|
|
$pluginsFiles = array_diff(scandir($dir), ['..','.']);
|
|
|
|
foreach ($pluginsFiles as $key => $pluginFile) {
|
|
|
|
$className = str_replace(".php", "", $pluginFile);
|
|
|
|
echo " test s " . $className . '\\n';
|
|
|
|
if(class_exists($className)){
|
|
|
|
$pluginMakeClass = new $className;
|
|
|
|
if (method_exists($pluginMakeClass,'make')){
|
|
|
|
$result[$className] = $pluginMakeClass->make();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Print Result
|
|
|
|
$this->response($result);
|
|
|
|
}
|
2020-10-14 12:35:04 +00:00
|
|
|
}
|