hmazter / laravel-schedule-list Goto Github PK
View Code? Open in Web Editor NEWLaravel package to add command to list all scheduled artisan commands
License: MIT License
Laravel package to add command to list all scheduled artisan commands
License: MIT License
composer require hmazter/laravel-schedule-list results in:
Warning: Ambiguous class resolution, "Cron\AbstractField"
php artisan schedule:run results in:
In FieldFactory.php line 46:
5 is not a valid position
Using laravel 5.5
This may be due to the way Laravel handles these two functions differently from other scheduler functions, but this package doesn't seem to take into account between() and unlessBetween().
The following two commands output */10 * * * * *
when running php artisan schedule:list
$schedule->command('name-of-command')->everyTenMinutes();
and
$schedule->command('name-of-command')->everyTenMinutes()->between('8:55', '19:00');
It could be great to add an helper function (or something like that) to get the scheduled tasks as an array. So we could display it in a web interface, or iterate over it to check some things.
laravel 5.6 : "Warning: Ambiguous class resolution"
"mtdowling/cron-expression" is deprecated.
moved to https://github.com/dragonmantank/cron-expression.
This package uses mtdowling/cron-expression
:
hmazter/laravel-schedule-list v0.2.1 requires mtdowling/cron-expression (^1.2)
but Laravel 5.6 makes use of dragonmantank/cron-expression
:
laravel/framework v5.6.3 requires dragonmantank/cron-expression (~2.0)
This appears to be working just fine, but running composer
commands results in a list of warnings:
Warning: Ambiguous class resolution, "Cron\DayOfWeekField" was found in both "/var/www/vendor/dragonmantank/cron-expression/src/Cron/DayOfWeekField.php" and "/var/www/vendor/mtdowling/cron-expression/src/Cron/DayOfWeekField.php", the first will be used.
Warning: Ambiguous class resolution, "Cron\CronExpression" was found in both "/var/www/vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php" and "/var/www/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php", the first will be used.
Warning: Ambiguous class resolution, "Cron\FieldFactory" was found in both "/var/www/vendor/dragonmantank/cron-expression/src/Cron/FieldFactory.php" and "/var/www/vendor/mtdowling/cron-expression/src/Cron/FieldFactory.php", the first will be used.
Warning: Ambiguous class resolution, "Cron\MinutesField" was found in both "/var/www/vendor/dragonmantank/cron-expression/src/Cron/MinutesField.php" and "/var/www/vendor/mtdowling/cron-expression/src/Cron/MinutesField.php", the first will be used.
Warning: Ambiguous class resolution, "Cron\HoursField" was found in both "/var/www/vendor/dragonmantank/cron-expression/src/Cron/HoursField.php" and "/var/www/vendor/mtdowling/cron-expression/src/Cron/HoursField.php", the first will be used.
Warning: Ambiguous class resolution, "Cron\MonthField" was found in both "/var/www/vendor/dragonmantank/cron-expression/src/Cron/MonthField.php" and "/var/www/vendor/mtdowling/cron-expression/src/Cron/MonthField.php", the first will be used.
Warning: Ambiguous class resolution, "Cron\AbstractField" was found in both "/var/www/vendor/dragonmantank/cron-expression/src/Cron/AbstractField.php" and "/var/www/vendor/mtdowling/cron-expression/src/Cron/AbstractField.php", the first will be used.
Warning: Ambiguous class resolution, "Cron\FieldInterface" was found in both "/var/www/vendor/dragonmantank/cron-expression/src/Cron/FieldInterface.php" and "/var/www/vendor/mtdowling/cron-expression/src/Cron/FieldInterface.php", the first will be used.
Warning: Ambiguous class resolution, "Cron\DayOfMonthField" was found in both "/var/www/vendor/dragonmantank/cron-expression/src/Cron/DayOfMonthField.php" and "/var/www/vendor/mtdowling/cron-expression/src/Cron/DayOfMonthField.php", the first will be used.
Perhaps it would be wise to depend on the same package as Laravel?
Also because the dependency this package is relying on is deprecated:
NOTE This fork has been deprecated and development moved to https://github.com/dragonmantank/cron-expression. More information can be found in the blog post here. tl;dr - v2.0.0 is a major breaking change, and @dragonmantank can better take care of the project in a separate fork.
Laravel Framework introduces a schedule:list
command in laravel/framework#35574
Is this package needed anymore?
Hi there,
Thanks for this awesome package, It's really helpful in our production environment!
I have one small problem. The description field is empty under atv least Laravel 5.4 when using the listing. Is there any way to fix this?
Cheers,
Ramon Smit
When outputting next run time, scheduler timezones aren't recognized. There are two techniques for setting timezone listed in the docs: https://laravel.com/docs/7.x/scheduling#timezones
I don't have much time to work on something like this, but I thought it might be a useful feature request.
Just upgraded Laravel to 5.6
When I do a composer require hmazter/laravel-schedule-list
I still get the old composer.json
which gives the duplicate require of dragonmantank/cron-expression
and mtdowling/cron-expression
.
Workaround:
Replace the old content of ./vendor/hmazter/laravel-schedule-list/composer.json
with the new version in Git.
Also had to do iffy stuff to ./vendor/composer/installed.json
(remove the mtdowling/cron-expression entry)
Real Workaround:
Stay at Laravel 5.5
Wait until packagist updates to the newer version of laravel-schedule-list by checking that the Requires is from dragonmantank on this page:
https://packagist.org/packages/hmazter/laravel-schedule-list
Possible action for hmazter:
poke packagist? Need to read up on how that works.
For whatever reason I'm unable to get cron schedule through a controller to display on the browser. I have the config file published to my local config folder directory.
I get the list of cron commands on the command line window. Just not when I try to get them through a controller.
Not sure if I'm missing something.
Thank you in advance for your help!
From Laravel 6.15.0 (laravel/framework@3422a24) a section()
method is used on the console output, but that one is not defined:
There was 1 error:
1) ListSchedulerTest::testListSchedulerCommand_withTasksAndTableStyle
Error: Call to undefined method Symfony\Component\Console\Output\BufferedOutput::section()
Taylor has reverted it (laravel/framework@4094d78) but it is not yet released
Tag a release for laravel 6.0 support
Hi guys,
great that you update this package and I like the progress very much.
Unfortunately I can update most of my projects to Laravel 5.6 as other packages need longer to be ready for 5.6. Maybe you can think about alternatives for keeping progress but not use 5.6 commands.
I know you Note: For Laravel version below 5.6 use 0.2.0 tag.
But 0.2.0 does not have the nice new separate class ScheduleList.php which is nice to use in a view.
The comment "dragonmantank/cron-expression does not support Laravel <5.6" on the composer.json is wrong. It does support Laravel 5.5 fine.
Thank you very much.
It could be useful, especially on production websites, to see which of scheduled events/commands are running at the moment. This can be determined by getting the mutex for individual scheduled event/command. If the mutex is present, then command either is running or have crashed and haven't removed mutex. Mutexes expire on their own in 1 day.
I'm proposing to add Status
table column with Running
as one of possible values. No need to write Not Running
for other commands.
If other useful statuses could be determined (e.g. last attempt failed), then it also could be displayed.
My console command has an option that can support spaces (e.g. a name).
The schedule:list
command however never shows these quotes, neither single nor double quotes are being shown.
Command example:
test:hello --name="John Doe"
shows up as:
test:hello --name=John Doe
But is executed as it is configured.
Tried it on Laravel 5.7.3 with 1.1.0 :
$ ./artisan schedule:list
InvalidArgumentException : Console command definition is empty.
at /vagrant/project/vendor/laravel/framework/src/Illuminate/Console/Parser.php: 44
40: */
41: protected static function name($expression)
42: {
43: if (trim($expression) === '') {
44: throw new InvalidArgumentException('Console command definition is empty.');
45: }
46:
47: if (! preg_match('/[^\s]+/', $expression, $matches)) {
48: throw new InvalidArgumentException('Unable to determine command name from signature.');
49: }
Exception trace:
1 Illuminate\Console\Parser::name("")
/vagrant/project/vendor/laravel/framework/src/Illuminate/Console/Parser.php : 22
2 Illuminate\Console\Parser::parse("")
/vagrant/project/vendor/hmazter/laravel-schedule-list/src/ScheduleEvent.php : 115
Please use the argument -v to see more details.
It seems this package doesn't support callback based scheduling jobs as outlined at https://laravel.com/docs/5.7/scheduling#defining-schedules ?
In a project of mine I've >15 scheduled tasks and almost all are defined via ->call()
because I wrap the executed code for logging purpose.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.