Question Schedules Tasks

More
5 days 20 hours ago #3447 by Sakis Terz
Schedules Tasks was created by Sakis Terz
Hi Ruud

I have seen your 2 Scheduled Task plugins and wonder if the old cron jobs are still needed.
Also noticed that sentence in your docs, but I am not sure what it means?

It is advised to configure thr scheduled tasks manager as Web Cron (so not as Lazy Scheduler).


Thanks!
Sakis

Please Log in to join the conversation.

More
5 days 20 hours ago - 5 days 20 hours ago #3448 by Ruud van Lent
Replied by Ruud van Lent on topic Schedules Tasks
Hi Sakis,

the scheduled tasks (which are automatically created (unpublished)) for you are replacing the 'old' crons: they do exactly the same and are still configured in the automation tab of the component.
In the next major version the old cron functionality will be removed, then only the scheduled tasks will work.

When you install the new version you will be notified of the new scheduled tasks (if not enabled), you will also be notified if you are still using the old cronjobs: this to provide a move over to this new functionality without leaving you in the dark somehow.

There are basiscally two ways to use the Core Joomla 'Lazy scheduler', out of the box it runs its tasks on the session of a visitor.
This means that timing of the cronjobs depends on a visitor visiting your site, also when the cronjob e.g. takes 10 seconds to complete the visitor will have this 10 second load.

So although this works, this is not optimal, especially for an ecommerce site.

So it is best to configure the Joomla core lazy scheduler as a webcron (it is defined in the options of the scheduler). When you do that a unique token is generated and you will be provided an URL that when visited will start the scheduled tasks component on your site.

This URL you need to set as a crontask on your server (or somewhere else), just like you now have set the two cronjobs for ochSubscriptions. You can set it to run every minute or 5 minutes.

Here is some more in-depth information from Akeeba which also uses the scheduled tasks:  www.akeeba.com/documentation/admin-tools...joomlascheduled.html
Last edit: 5 days 20 hours ago by Ruud van Lent.
The following user(s) said Thank You: Sakis Terz

Please Log in to join the conversation.

More
4 days 21 hours ago #3449 by Sakis Terz
Replied by Sakis Terz on topic Schedules Tasks
FYI, when I run the Joomla cli `/cli/joomla.php scheduler:run --all`, it gives me that error:
Run Tasks ========= In OchsubscriptionsHelper.php line 490: Call to undefined method Joomla\CMS\Application\ConsoleApplication::getDocu ment() scheduler:run [-i|--id ID] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [-n|--no-interaction] ] <command>

Please Log in to join the conversation.

More
4 days 3 hours ago - 4 days 3 hours ago #3450 by Ruud van Lent
Replied by Ruud van Lent on topic Schedules Tasks
Hi Sakis,

was able to reproduce.

in ./administrator/components/com_ochsubscriptions/src/Helper/OchsubscriptionsHelper.php

add the following use statement in the top of the file:
Code:
use Joomla\CMS\Application\WebApplication;

 and then replace public static function setDebugLevel(): void with the following function:
Code:
    public static function setDebugLevel(): void     {         $joomlaVersion = new Version();         if (\defined('OCHSUBSCRIPTIONS_DEBUG') === \false) {             if (Config::get()->enable_debug || JDEBUG) {                 Log::addLogger(array('text_file' => 'com_ochsubscriptions-site-log.php'), Log::ALL, array('ochsubscriptions'));                 \define('OCHSUBSCRIPTIONS_DEBUG', \true);             } else {                 Log::addLogger(array('text_file' => 'com_ochsubscriptions-site-log.php'), Log::ALL & ~Log::INFO & ~Log::DEBUG, array('ochsubscriptions'));                 \define('OCHSUBSCRIPTIONS_DEBUG', \false);             }             $app = Factory::getApplication();             if ($app instanceof WebApplication) {                 $app->getDocument()->addScriptOptions(                     'com_ochsubscriptions',                     [                         'debug' => OCHSUBSCRIPTIONS_DEBUG,                         'version' => '___VERSION___',                         'cms_version' => $joomlaVersion::MAJOR_VERSION                     ]                 );             }         }     }
 
Last edit: 4 days 3 hours ago by Ruud van Lent.
The following user(s) said Thank You: Sakis Terz

Please Log in to join the conversation.

More
2 days 21 hours ago #3451 by Ruud van Lent
Replied by Ruud van Lent on topic Schedules Tasks
@sakis,

If you could confirm if this fixes the issue that would be great, I can then prepare a bugfix release for next week with this and other fixes.

let me know,
have a nice weekend,
Ruud.

Please Log in to join the conversation.