Welcome Guest, Not a member yet? Register   Sign In
How to prevent a controller to run from web?
#14

[eluser]mddd[/eluser]
Aha, I see. We were thinking about two slightly different things Smile

I agree that the most simple and safe way would be to place the 'cronnable' scripts above document root. But you are right, that loses the whole CI idea.

Using "CI-style private" methods and then "un-privatising" them for the cron seems a bit of a workaround to me. I think checking in each cron-routine would be preferable to making a separate CI-flow without the underscore checking.

Keeping cron code with the rest of the code is absolutely a good idea. If a controller (lets say News) has methods like add_article, remove_article etc. it can also have a method check_for_old_articles which is meant to be run by a cron job. But yes, you would have to check inside that method to see if it really is called by a cron job and not by a user.


Messages In This Thread
How to prevent a controller to run from web? - by El Forum - 04-25-2010, 04:14 PM
How to prevent a controller to run from web? - by El Forum - 04-25-2010, 06:29 PM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 12:41 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 01:28 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 01:36 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 01:44 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 01:49 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 01:55 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 01:56 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 02:14 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 02:19 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 02:50 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 05:27 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 05:45 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 06:31 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 06:38 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 06:41 AM
How to prevent a controller to run from web? - by El Forum - 04-26-2010, 08:41 AM
How to prevent a controller to run from web? - by El Forum - 06-06-2010, 01:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB