Menu

#9598 Task plugin

Parent Category:
DPMedia
Category:
Joomla plugins
Last Updated:
Allon Moritz, Tuesday, 20 August 2024 13:01
Created:
Monday, 12 December 2022 13:52
Hits:
1609

This feature is part of the DPMedia Standard subscription.
SubscribePHP 8Joomla 4.4Joomla 5

Introduction

The task plugin offers the possibility to run some background tasks through the core joomla task scheduler.

More information about the task scheduler can be found in the official Joomla magazine.

Joomla tasks

Task: Media sync

The media sync task offers the possibility to sync remote media files to a local folder within the images folder. The local folder is the folder where the files should be synced to. If the delete flag is turned on, then local files are deleted during the sync which do not exist on the remote location. The remote folder is a full path name with the plugin name, adapter id and folder names/ids. It must match the scheme:

{plugin name}-{adapter name}:/{folder tree}

The easiest way to get the correct name is to navigate in the ordinary media manager to the remote folder and then copy the path from the browser url.

Joomla media sync params

Task: Sync local media files

The local media sync offers the possibility to sync media files, which are served as local files, from the cloud service for specific adapters or all. This means, when a publisher picked an image from a remote adapter like Google drive or Dropbox and local images is enabled, then the file is copied to the Joomla webserver and served from there in the article.

When the file changes on the cloud service, then the Joomla server gets no notification about the update. This task can be used to refetch the changed remote files, so they contain the new content from the cloud service.

More information about local files can be found in the Concept of image service provider integration article or the respective cloud service adapter.

Joomla local media sync params

Run scheduler as cron job

The DPMedia scheduler tasks can become long running. So it is obvious that they should not run in a browser page request as they very likely have a limit of 30 seconds or so. This will then abort tha execution of the tasks. It is very much recommended to run the scheduler as a cron job, which syncs the media completely in the background. Like that the visitor will never suffer from media sync during a page load.

The following line can be copied into the crontab file to set up a scheduler cron job. It will run the scheduler every minute, as the time management is done within the Joomla scheduler it is safe to execute the cron job every minute.

* * * * * /{my-path-php-executable}/php /{{joomla-root}}/cli/joomla.php scheduler:run

Comments (0)

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.