Skip to content

Commit

Permalink
[5.6] Updated to use new release of cron-expression (#21637)
Browse files Browse the repository at this point in the history
* Updated to use new release of cron-expression

*    fix test
  • Loading branch information
dragonmantank authored and taylorotwell committed Oct 13, 2017
1 parent e8e2acb commit e9e1860
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Scheduling/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Event
*
* @var string
*/
public $expression = '* * * * * *';
public $expression = '* * * * *';

/**
* The timezone the date should be evaluated on.
Expand Down

6 comments on commit e9e1860

@cmosguy
Copy link

@cmosguy cmosguy commented on e9e1860 Oct 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dragonmantank I am getting an error with this update, attached is my composer.json file.

root@9b22d304da51:/var/www/html# php artisan schedule:run

In FieldFactory.php line 46:

  5 is not a valid position

Is there something I am missing here:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "type": "project",
    "version": "0.5.1",
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/WowzaMediaSystems/wse-rest-library-php.git"
        }
    ],
    "require": {
        "php": ">=7.0.0",
        "camroncade/timezone": "0.1",
        "doctrine/dbal": "^2.6",
        "fideloper/proxy": "~3.3",
        "fzaninotto/faker": "~1.4",
        "google/apiclient": "2.x-dev",
        "google/cloud": "v0.37.0",
        "guzzlehttp/guzzle": "6.3.0",
        "laravel/framework": "5.5.*",
        "laravel/horizon": "^1.0@dev",
        "laravel/socialite": "3.0.x-dev",
        "laravel/tinker": "~1.0",
        "pda/pheanstalk": "^3.1@dev",
        "php-ffmpeg/php-ffmpeg": "0.9.5",
        "predis/predis": "v1.1.1",
        "spatie/laravel-tags": "dev-master",
        "wowza/wse-rest-library-php": "dev-master"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.0@dev",
        "barryvdh/laravel-ide-helper": "^2.4",
        "filp/whoops": "~2.0",
        "laracasts/generators": "dev-master",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~6.0"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        },
        "files": [
            "tests/utilities/functions.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize",
            "php artisan storage:link"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan ide-helper:generate",
            "php artisan ide-helper:meta",
            "php artisan optimize"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    }
}

@dragonmantank
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Position 5 was the year position, which the library no longer supports (it was barely supported by most traditional cron parsers). Just check any scheduled jobs you have, and if they have 6 parameters, remove the last one.

Though ideally I should also have that error be 1-based instead of 0-based to make that much more clear.

@cmosguy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dragonmantank thank you for your quick reply. I don't think I understand what you mean here, all I am using is laravels scheduler:

I have this in my Kernel.php file:

    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')
        //          ->hourly();

        $schedule
            ->command('octane:schedule-runner')
            ->everyMinute();

        $schedule
            ->command('octane:schedule-end')
            ->everyMinute();

        $schedule->command('horizon:snapshot')->everyFiveMinutes();
    }

Is this what you are referring to?

@cmosguy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dragonmantank thanks again for your help, it looks like the updates you and @taylorotwell made may have introduced a bug. In order to get around the bug I had to change the file:

    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')
        //          ->hourly();

        $schedule
            ->command('octane:schedule-runner')
            ->cron('* * * * *');

        $schedule
            ->command('octane:schedule-end')
            ->cron('* * * * *');

        $schedule->command('horizon:snapshot')
            ->cron('*/5 * * * *');
    }

@dragonmantank
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. The change was for Laravel 5.6/master (laravel/framework#21637), but according to your composer.json you've requested laravel/framework:5.5.*, so you should not even be using the new code that dropped the year.

Check your composer.lock file and see if you have mtdowling/cron-expression or dragonmantank/cron-expression, and what version it's pinned at. That will shed a bit more light on what is going on.

@cmosguy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dragonmantank thanks for the heads up about the composer.lock file.

Here is the gist of the file: https://gist.github.com/cmosguy/e4a1bd13a06984ee90e464996941f13a

Can you you tell what could be causing the conflict? I got this situation by just doing composer update and just including aws-php-sdk. In there aws-php-sdk it uses mtdowling but then you forked it and now I believe it causes a conflict with Laravels CronExpression class.

Please sign in to comment.