musicmaster Posted February 23, 2023 Posted February 23, 2023 What is the function of the triggercontroller? When I load a product page I see that a call is made to index.php?controller=trigger&ts=1677152722 What is returned is {"status":"failed","error":"Forbidden"} When I look into the source code I see something about a scheduler but that doesn't make things much clearer. The line "ServiceLocator::getInstance()->getScheduler();" gives me nightmares about Symfony style complexity.
datakick Posted February 23, 2023 Posted February 23, 2023 10 minutes ago, musicmaster said: What is the function of the triggercontroller? When I load a product page I see that a call is made to index.php?controller=trigger&ts=1677152722 What is returned is {"status":"failed","error":"Forbidden"} It's a synthetic event to trigger scheduler. To run scheduled and deferred tasks. In ideal deployment, this would not be needed, because scheduler events would be triggered by cron or external process. That's not realistic for small shops, so it's emulated using this synthetic events. 10 minutes ago, musicmaster said: When I look into the source code I see something about a scheduler but that doesn't make things much clearer. The line "ServiceLocator::getInstance()->getScheduler();" gives me nightmares about Symfony style complexity. Tell me you have never wrote a test without telling me you have never wrote a test.
musicmaster Posted February 23, 2023 Author Posted February 23, 2023 43 minutes ago, datakick said: It's a synthetic event to trigger scheduler. To run scheduled and deferred tasks. But what does that "failed"/"forbidden" reaction that I see mean for the functioning of my webshop?
datakick Posted February 23, 2023 Posted February 23, 2023 What tb version are you using? In 1.3, this issue was caused by CORS preflight requests. Not a critical issue, because trigger was executed during preflight request. Fixed anyway.
datakick Posted February 23, 2023 Posted February 23, 2023 Let's blame it on CORS then 🙂 If you are unable to update to 1.4, you can applie these lines (warning PHP7 syntax used - I know you are working on some PHP5.6 servers, for some reason) https://github.com/thirtybees/thirtybees/blob/81dd5d911a086164146bafc3bf650694786d9a56/controllers/front/TriggerController.php#L38-L44
Scully Posted March 31 Posted March 31 I want to bring this question up again. I recently migrated to TB 1.6. POST /index.php?controller=trigger&ts=XXX is the only request on our shop front end, where a file with .php file extension is directly executed. This causes issues with our security engine, which does not allow to directly call a .php - file. Question: Would it be possible to execute the trigger from server side directly via cron? If so, what would be the URI to call?
datakick Posted March 31 Posted March 31 33 minutes ago, Scully said: Would it be possible to execute the trigger from server side directly via cron? With some custom modifications/overrides it's possible. Easier solution is to go to Preferences > SEO & URLs , click on Add new Page, and define friendly url for this controller. With this in place, your store will use friendly url for this controller instead of direct php call:
Scully Posted April 1 Posted April 1 Thank you @datakick I'll go for your solution and will give it a try. Thank you.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now