Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Cron_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct() {
if ( 'running' !== EE_DOCKER::container_status( 'ee-cron-scheduler' ) ) {
$cron_scheduler_run_command = 'docker run --name ee-cron-scheduler --restart=always -d -v ' . EE_CONF_ROOT . '/cron:/etc/ofelia:ro -v /var/run/docker.sock:/var/run/docker.sock:ro easyengine/cron:v' . EE_VERSION;
if ( ! EE_DOCKER::boot_container( 'ee-cron-scheduler', $cron_scheduler_run_command ) ) {
EE::error( "There was some error in starting ee-cron-scheduler container. Please check logs." );
EE::error( 'There was some error in starting ee-cron-scheduler container. Please check logs.' );
}
}
}
Expand Down Expand Up @@ -257,13 +257,13 @@ private function generate_cron_config() {
$crons = Cron::all();

foreach ( $crons as &$cron ) {
$job_type = $cron['site_url'] === 'host' ? 'job-local' : 'job-exec';
$job_type = 'host' === $cron['site_url'] ? 'job-local' : 'job-exec';
$id = $cron['site_url'] . '-' . preg_replace( '/[^a-zA-Z0-9\@]/', '-', $cron['command'] ) . '-' . EE\Utils\random_password( 5 );
$id = preg_replace( '/--+/', '-', $id );
$cron['job_type'] = $job_type;
$cron['id'] = $id;

if ( $cron['site_url'] !== 'host' ) {
if ( 'host' !== $cron['site_url'] ) {
$cron['container'] = $this->site_php_container( $cron['site_url'] );
}
}
Expand Down Expand Up @@ -348,6 +348,8 @@ private function site_php_container( $site ) {
* See https://github.com/EasyEngine/cron-command/issues/4.
*
* @param string $command Command whose syntax needs to be validated.
*
* @throws \EE\ExitException
*/
private function validate_command( $command ) {

Expand Down