well, for that particular task I don’t think you would need cron jobs. You just need to know when the user registered and if that date was more than 30 days ago (and they have not payed yet), you just won’t let them log in.
Or better yet, when they register, you’d also have another column in your DB called expire which would hold the expiration date and you can verify against that. (and actually use this column in the future)
Imehesz I think that is maybe a bit risky solution, because what happens if the server clock breaks or malfuncion for any reason? several hundreds users will have premium account again (at least temporaly), isn’t it?
Another question more in relation to jobs, is how to send an email to the user saying it’s about to close his account several times before do it (1 week, 4 days ago, 2 days ago…).
Searching for schechulding jobs or taks documentation in Yii, I think clearly there is a lack of…
And apart for console commands, that is a very important topic for many people to include in the main definitive guide (maybe we are loosing something)
Even if you set a cron job this remains a problem… @Imehesz idea is OK… I would suggest to add one more filed/attribute like "active" so the first time that the program tests the registered date is 30 days old it sets this field to FALSE so that even if the server clock fails this field remains FALSE…
You should be able to rely on some basic things - server clock is one of them. If you don’t want to use a cron job, the described solution is valid IMO.
For this you need a cron job anyway. See below.
By the nature of the web, web applications only run when there’s a request. So any scheduled tasks should better be performed from a cron job (or the task scheduler provided by your OS). There’s a complete page dedicated to this topic in the guide: