Quantcast
Channel: Backup and restore
Viewing all articles
Browse latest Browse all 6588

Re: How to disable main course backup in automated backups?

$
0
0
by Eloy Lafuente (stronk7).  

Hi Séverin,

that's correct. Automated backups can be invoked from these 2 callers:

  • automated backups cron task. Then they are called under RUN_ON_SCHEDULE mode, and next-start-times are observed.
  • automated backups cli. Then they are called under RUN_IMMEDIATELY mode, and next-start-times are ignored.

So, while your "hack" is ok,to prevent RUN_IMMEDIATELY to proceed with frontpage (id=1) course, they still can be launched because next-start-times can lead to that (hence your need to create a new cron setting and setting those times in the future all the time).

So, I'd suggest, if you are 100% sure that you don't want a frontpage backup to be triggered ever, to apply for the exception globally and not only for the RUN_IMMEDIATELY case. This can be achieved by putting the condition one level outer, in the very same line (that way it will apply to all the cases):

$shouldrunnow = $backupcourse->courseid != 1 && (($backupcourse->nextstarttime > 0 && $backupcourse->nextstarttime < $now)
                    || $rundirective == self::RUN_IMMEDIATELY);

Or alternatively, I think that's the place I'd use, at the beginning of the loop, with a simple and clean continue, aka:

foreach ($rs as $course) {
    if ($backupcourse->courseid == 1) {
        // We don't want frontpage automated backup ever, skip it.
        continue;
    }
    ...
    ...

Ciao smile


Viewing all articles
Browse latest Browse all 6588

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>