export_cleanup_old_exports cron causes exception and long-running cron if export directory doesn't exist
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Low
|
Andrew Nicols |
Bug Description
If export directory doesn't exist (e.g. because no exports have been run), then the cron goes bang.
When the cron goes bang, the lock isn't removed and so the cron can't be run again until the lock expires.
Master on postgres.
Trace follows:
[Sun Dec 05 21:13:32 2010] [error] [client 192.168.254.230] [DBG] 3e (lib/cron.php:146) Running core cron export_
[Sun Dec 05 21:13:32 2010] [error] [client 192.168.254.230] [WAR] 3e (export/
[Sun Dec 05 21:13:32 2010] [error] [client 192.168.254.230] Call stack (most recent first):
[Sun Dec 05 21:13:32 2010] [error] [client 192.168.254.230] * log_message(
[Sun Dec 05 21:13:32 2010] [error] [client 192.168.254.230] * error(2, "DirectoryItera
[Sun Dec 05 21:13:32 2010] [error] [client 192.168.254.230] * DirectoryIterat
[Sun Dec 05 21:13:32 2010] [error] [client 192.168.254.230] * export_
[Sun Dec 05 21:13:32 2010] [error] [client 192.168.254.230]
Changed in mahara: | |
status: | Fix Committed → Fix Released |
Check whether the directory exists before instantiating the DirectoryIterator.
I considered using check_dir_exists, which would create the directory and then allow the cron to be run, but felt that the cron probably wasn't the best place to create the directory -- it's a little counter intuitive to create the directory in the cleanup cron. As a result, I've opted for checking that the directory exists, and if it doesn't, returning from the function at that point.