Hello, I’ve been building an app with yii for the past month or so and have stumbled on something I can’t seem to figure out.
I built a simple interface to store crontab entries in the database and execute them automatically via page loads. My approach uses a field that is regenerated each time a cron runs which stores the next "run date" into the database.
To do this I needed for a way to convert the crontab string into a timestamp so it can be stored in the database.
I managed to interact with the library by placing the files under a ‘cron’ directory under ‘components’ and I was able to load the files after adding the ‘protected.components.cron.*’ entry in my config file.
Despite being able to load the class and its dependencies I haven’t been able to get it working, the script seems to be interrupted when I try loading the main class and does not return any error. I can tell something is interrupting the processing because the page exits its loading at that point in time and will not execute any further code past this.
So my question is, what is the proper way of using an external library such as this one into yii so I can utilize its functions?
I apologize if this seems too trivial, this is my first time trying out yii.
I think it’s okay to put this code in components, like you did, but I usually use ‘vendors’ or ‘extensions’ folder (or ‘libs’ folder) - I think it’s not that important and may be chosen depends on your exact project and taste.
Which is more important point in your situation is [color=#1C2837]
[/color]
[color=#1C2837]So I’d first figured out which error stops the execution - so check you have error_reporting switched on, yii debugging and logging switched on and start from that point. Or try to debug code execution with xDebug to see what’s going on. While debugging try to narrow down problematic place, finally you’d be able to find exact troublesome line of code.[/color]