Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cron top-level directory with named scripts #20

Open
g105b opened this issue Aug 18, 2022 · 0 comments
Open

Cron top-level directory with named scripts #20

g105b opened this issue Aug 18, 2022 · 0 comments
Labels
enhancement New feature or request feature

Comments

@g105b
Copy link
Member

g105b commented Aug 18, 2022

It would be nice to be able to treat cron scripts in the same way as we do Page Logic files, almost as if (or maybe completely as if) the scripts are being routed.

Inside the crontab file, we could have something like the following:

0 5 * * * /cache?type=db&mode=daily

This would be triggered at 0500 every day, and it makes sense to store this script in the cron/cache.php file.

Inside the file, it can behave completely like any other go function:

<?php
use Gt\Input\Input;

function go(Input $input, Database $db):void {
  if($input->getString("type") === "db") {
    $db->clean(); // or whatever...
  }
}
@g105b g105b added enhancement New feature or request feature labels Aug 18, 2022
@g105b g105b transferred this issue from PhpGt/WebEngine Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature
Projects
None yet
Development

No branches or pull requests

1 participant