Moodle
  1. Moodle
  2. MDL-42808

Automated backups do not run when scheduled (or random timezone issue)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.3, 2.6
    • Fix Version/s: 2.5.4, 2.6.1
    • Component/s: Backup
    • Labels:
    • Testing Instructions:
      Hide

      Testing instructions from MDL-28531.

      Test pre-requisites

      1. Remove any date.timezone from your php.ini (CLI/Apache)
      2. Enable automated backups (Settings > Site administration > Courses > Backups > Automated backup setup)
      3. Set the cron time to 6pm (or any time later than now)
      4. Enable today's day and Sunday
      5. Set your admin's user to server timezone (Settings > My profile settings > Edit profile)
      6. Your server timezone should be Australia/Perth (This is your machine setting)
      7. Tests are to be run one after the other (without reset except if specified)

      Test 1

      1. Create two new courses, one has to be hidden
      2. Run the cron
      3. Go to the backup report (Settings > Site administration > Reports > Backups)
      4. Make sure boths courses have been skipped
      5. Make sure they're set to run today at 6pm

      Test 2

      1. Create a new course
      2. Run the cron
      3. Go to the backup report
      4. Make sure all the courses have been skipped
      5. Make sure all the courses are scheduled for today at 6pm

      Test 3

      1. Change your system time to 7pm
      2. Run the cron
      3. Go to the backup report
      4. Make sure courses have been backed up
      5. Make sure courses are scheduled for Sunday at 6pm

      Test 4

      1. Reset your system to the correct time/date
      2. Change your admin's timezone to UTC-2
      3. Run the cron
      4. In the cron output, make sure courses are scheduled for tomorrow at 4am
      5. Go to the backup report
      6. Make sure courses are skipped
      7. Make sure they are scheduled for today at 6pm

      Test 5

      1. Change your system time to tomorrow at 5am
      2. Run the cron
      3. In the cron output, make sure courses are scheduled for Monday, 4 am
      4. Go to the backup report
      5. Make sure courses are backed up
      6. Make sure they are rescheduled for Sunday at 6am

      Test 6

      1. Run the Backup Unit Tests and make sure none fails
      Show
      Testing instructions from MDL-28531 . Test pre-requisites Remove any date.timezone from your php.ini (CLI/Apache) Enable automated backups (Settings > Site administration > Courses > Backups > Automated backup setup) Set the cron time to 6pm (or any time later than now) Enable today's day and Sunday Set your admin's user to server timezone (Settings > My profile settings > Edit profile) Your server timezone should be Australia/Perth (This is your machine setting) Tests are to be run one after the other (without reset except if specified) Test 1 Create two new courses, one has to be hidden Run the cron Go to the backup report (Settings > Site administration > Reports > Backups) Make sure boths courses have been skipped Make sure they're set to run today at 6pm Test 2 Create a new course Run the cron Go to the backup report Make sure all the courses have been skipped Make sure all the courses are scheduled for today at 6pm Test 3 Change your system time to 7pm Run the cron Go to the backup report Make sure courses have been backed up Make sure courses are scheduled for Sunday at 6pm Test 4 Reset your system to the correct time/date Change your admin's timezone to UTC-2 Run the cron In the cron output, make sure courses are scheduled for tomorrow at 4am Go to the backup report Make sure courses are skipped Make sure they are scheduled for today at 6pm Test 5 Change your system time to tomorrow at 5am Run the cron In the cron output, make sure courses are scheduled for Monday, 4 am Go to the backup report Make sure courses are backed up Make sure they are rescheduled for Sunday at 6am Test 6 Run the Backup Unit Tests and make sure none fails
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull from Repository:
    • Pull 2.5 Branch:
    • Pull Master Branch:
      MDL-42808-master
    • Rank:
      54674

      Description

      While exploring the Administration, I noticed that the backup scheduler was not running the backups at the right time. Having spent quite some time on it as part of MDL-28531, that surprised me.

      So I have investigated and the problem is not occurring in 2.4, but it is in 2.5 and master. The problem seems to come from the Google library that we have included in 2.5. Though this is not occurring if you have a timezone set in your php.ini.

      Google_Client.php
      
      if (! ini_get('date.timezone') && function_exists('date_default_timezone_set')) {
        date_default_timezone_set('UTC');
      }
      

      Reported upstream: http://code.google.com/p/google-api-php-client/issues/detail?id=422

        Issue Links

          Activity

          Hide
          Frédéric Massart added a comment -

          Another issue that I am sending for peer review set as a must fix for consideration.

          Show
          Frédéric Massart added a comment - Another issue that I am sending for peer review set as a must fix for consideration.
          Hide
          Ankit Agarwal added a comment -

          Hi Fred,
          As we discussed changes make sense. However this is not a must fix for 2.6 as the issue was present in 2.5 as well, still will be nice to get this sorted out the earliest.

          cheers

          Show
          Ankit Agarwal added a comment - Hi Fred, As we discussed changes make sense. However this is not a must fix for 2.6 as the issue was present in 2.5 as well, still will be nice to get this sorted out the earliest. cheers
          Hide
          Frédéric Massart added a comment -

          Thanks Ankit. I removed the MUST FIX label and pushed for integration.

          Show
          Frédéric Massart added a comment - Thanks Ankit. I removed the MUST FIX label and pushed for integration.
          Hide
          Damyon Wiese added a comment -

          Thanks Fred for finding and fixing this.

          Integrated to 25, 26 and master.

          Show
          Damyon Wiese added a comment - Thanks Fred for finding and fixing this. Integrated to 25, 26 and master.
          Hide
          Rossiani Wijaya added a comment -

          This is working as expected.

          Tested for 2.5, 2.6 and master.

          Test passed.

          Show
          Rossiani Wijaya added a comment - This is working as expected. Tested for 2.5, 2.6 and master. Test passed.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          ...
          But still, I thank you, for you made me stronger…

          Stronger as the beast that roar in the wild
          Stronger as the storm across the ocean
          Stronger as the diamond that won’t break
          Stronger enough to take all heart aches….

          I thank you my friend, for you made me stronger…

          ---- Juneah Landicho

          Closing as fixed. Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - ... But still, I thank you, for you made me stronger… Stronger as the beast that roar in the wild Stronger as the storm across the ocean Stronger as the diamond that won’t break Stronger enough to take all heart aches…. I thank you my friend, for you made me stronger… ---- Juneah Landicho Closing as fixed. Ciao

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: