variable_set('demo_reset_last', time()) should be called before demo_reset(), otherwise the demo_reset_interval is effectively every _other_ period.

Settings: reset every hour
Crontab runs every hour

Log of demo reset being run every _other_ cron run.

Great little module btw. Thanks!

CommentFileSizeAuthor
#5 demo-time-last.patch660 bytesjohn.money
#2 demo-time-last.patch659 bytesjohn.money

Comments

wiredescape’s picture

Thanks John,

Possibly same issue as #336216: Automatic reset not always executed in configured interval ?

Be nice to find a solution for this annoying bug!

john.money’s picture

StatusFileSize
new659 bytes

Patched against 5.x-1.x-dev (2009-Mar-13)... not heavily tested but should work in theory. :)

sun’s picture

Status: Active » Needs review

Thanks! Looks good, needs some positive confirmation.

wiredescape’s picture

Found an error in patch. A missing left parenthesis in this line:

+ if ($time - $interval) >= variable_get('demo_reset_last', 0)) {

should be:

+ if (($time - $interval) >= variable_get('demo_reset_last', 0)) {

(note second left parenthesis required between 'if' and '($time - $interval)'.

john.money’s picture

StatusFileSize
new660 bytes

Bizarre. Not sure how patch got out of sync with my module changes, but you're of course right. Attached is corrected one.

wiredescape’s picture

Patch has been running on live site with no problems for about a week now but still has some odd behaviour.

When cron set to 60 minutes & Demo set to 30 minutes everything works correctly. If cron and Demonstration site are set to the same time interval, i.e. cron & Demo both set to 60 minutes, the database restoration is inconsistent. Cron fires correctly but Demo will skip the BD restore often but with no pattern. Basically the same problem I reported before #336216: Automatic reset not always executed in configured interval.

sun’s picture

Status: Needs review » Fixed

Thanks for reporting, reviewing, and testing! Committed with slight modifications to all branches.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.