This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
    jort25758
    
            
            
                    
                                            
        
    
        Hi all, I am struggling a lot with the registerSchedule function within the Plugin.php file.
...
class Plugin extends PluginBase
{
   ...
    public function registerSchedule($schedule)
    {
        $schedule->call(function(){ 
            echo "HALLO!";
        })->everyMinute();
    }
   ...
}Somehow these tasks are not 'seen' since
php artisan schedule:run -valways results in
No scheduled commands are ready to run.Anyone any idea? Thanks!
    jort25758
    
            
            
                    
                                            
        
    
        Just to inform you: issue was that environment variables were not passed correctly, and therefore no database connection was established / found. This is important since it does not get far in the Event.listener('console.schedule') function, which contains a SystemHelper::hasDatabase() function.
/*
         * Allow plugins to use the scheduler
         */
        Event::listen('console.schedule', function ($schedule) {
            // Halt if database has not migrated yet
            if (!SystemHelper::hasDatabase()) {
                return;
            }
            $plugins = PluginManager::instance()->getPlugins();
            foreach ($plugins as $plugin) {
                if (method_exists($plugin, 'registerSchedule')) {
                    $plugin->registerSchedule($schedule);
                }
            }
        });
    daftspunky
    
            
            
                    
                                            
        
    
        Hey jort,
We agree the logic does not seem to make sense in v2 so we will remove it. Thanks for pointing this out.
1-3 of 3