0

For internal use by editors I would like to get cron link into a custom menu, but I need to do this dynamically, such that it can used across multiple sites.

Editors do not have access to Admin Toolbar which is why I need a link instead.

Why do I need this? I want allow editors to make a quick backup with Backup Migrate, but I don't want to give them full access and the module permissions are not granular enough to just make a quick database backup.

A colleague suggested letting editors run a cron job instead. This seems like a solution.

I already have Menu Token module installed, so I am wondering if there is a token for a site's cron token?

If not. Is another approach recommended?

2

The cron key is generated by Drupal core then stored as state data (system.cron_key) when Drupal is first installed. system_token_info() doesn't expose this key as a token.

You could just make a static menu link with the /cron/$KEY path as the key will remain static as long as the system.cron_key entry remains in the state table.

If the end goal is to only envoke the Backup Migrate cron handler and custom development is an option, creating your own custom route that invokes the specific backup code (e.g. backup_migrate_cron()) would be a more direct method and have a less chance of side effects from regular arbitrary runs of all cron handlers

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.