128 lines
3.8 KiB
PHP
128 lines
3.8 KiB
PHP
<?php
|
|
|
|
namespace Config;
|
|
|
|
use CodeIgniter\Config\BaseConfig;
|
|
use Daycry\CronJob\Scheduler;
|
|
|
|
class CronJob extends \Daycry\CronJob\Config\CronJob
|
|
{
|
|
/**
|
|
* Set true if you want save logs
|
|
*/
|
|
public bool $logPerformance = true;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Log Saving Method
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Set to specify the REST API requires to be logged in
|
|
|
|
|
| 'file' Save in files
|
|
| 'database' Save in database
|
|
|
|
|
*/
|
|
public string $logSavingMethod = 'file';
|
|
|
|
/**
|
|
* Directory
|
|
*/
|
|
public string $filePath = WRITEPATH . 'cronJob/';
|
|
|
|
/**
|
|
* File Name in folder jobs structure
|
|
*/
|
|
public string $fileName = 'jobs';
|
|
|
|
/**
|
|
* --------------------------------------------------------------------------
|
|
* Maximum performance logs
|
|
* --------------------------------------------------------------------------
|
|
*
|
|
* The maximum number of logs that should be saved per Job.
|
|
* Lower numbers reduced the amount of database required to
|
|
* store the logs.
|
|
*
|
|
* If you write 0 it is unlimited
|
|
*/
|
|
public int $maxLogsPerJob = 3;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Database Group
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Connect to a database group for logging, etc.
|
|
|
|
|
*/
|
|
public string $databaseGroup = 'default';
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Cronjob Table Name
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| The table name in your database that stores cronjobs
|
|
|
|
|
*/
|
|
public string $tableName = 'cronjob';
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Cronjob Notification
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Notification of each task
|
|
|
|
|
*/
|
|
public bool $notification = false;
|
|
public string $from = 'your@example.com';
|
|
public string $fromName = 'CronJob';
|
|
public string $to = 'your@example.com';
|
|
public string $toName = 'User';
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Views
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Notification of each task
|
|
|
|
|
*/
|
|
public array $views = [
|
|
'login' => '\Daycry\CronJob\Views\login',
|
|
'dashboard' => '\Daycry\CronJob\Views\dashboard',
|
|
'layout' => '\Daycry\CronJob\Views\layout',
|
|
'logs' => '\Daycry\CronJob\Views\logs'
|
|
];
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Dashboard login
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
public bool $enableDashboard = false;
|
|
public string $username = 'admin';
|
|
public string $password = 'admin';
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Cronjobs
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Register any tasks within this method for the application.
|
|
| Called by the TaskRunner.
|
|
|
|
|
| @param Scheduler $schedule
|
|
*/
|
|
public function init(Scheduler $schedule)
|
|
{
|
|
// $schedule->command('foo:bar')->everyMinute();
|
|
$schedule->url('http://localhost/golf_backend/scheduler')->everyFiveMinutes();
|
|
// $schedule->shell('cp foo bar')->daily( '11:00 pm' );
|
|
|
|
// $schedule->call( function() { do something.... } )->everyMonday()->named( 'foo' )
|
|
}
|
|
}
|