Merge branch 'MDL-39653-master' of git://github.com/danpoltawski/moodle
authorMarina Glancy <marina@moodle.com>
Tue, 1 Oct 2013 10:42:37 +0000 (20:42 +1000)
committerMarina Glancy <marina@moodle.com>
Tue, 1 Oct 2013 10:42:37 +0000 (20:42 +1000)
1  2 
enrol/imsenterprise/lib.php

@@@ -85,6 -85,7 +85,7 @@@ function cron() 
          $this->logfp = fopen($logtolocation, 'a');
      }
  
+     $fileisnew = false;
      if ( file_exists($filename) ) {
          @set_time_limit(0);
          $starttime = time();
          if(empty($prev_path)  || ($filename != $prev_path)) {
              $fileisnew = true;
          } elseif(isset($prev_time) && ($filemtime <= $prev_time)) {
-             $fileisnew = false;
              $this->log_line('File modification time is not more recent than last update - skipping processing.');
          } elseif(isset($prev_md5) && ($md5 == $prev_md5)) {
-             $fileisnew = false;
              $this->log_line('File MD5 hash is same as on last update - skipping processing.');
          } else {
              $fileisnew = true; // Let's process it!
          $this->log_line('File not found: '.$filename);
      }
  
-     if (!empty($mailadmins)) {
+     if (!empty($mailadmins) && $fileisnew) {
          $msg = "An IMS enrolment has been carried out within Moodle.\nTime taken: $timeelapsed seconds.\n\n";
          if(!empty($logtolocation)){
              if($this->logfp){
  
          $eventdata = new stdClass();
          $eventdata->modulename        = 'moodle';
 -        $eventdata->component         = 'imsenterprise';
 +        $eventdata->component         = 'enrol_imsenterprise';
          $eventdata->name              = 'imsenterprise_enrolment';
          $eventdata->userfrom          = get_admin();
          $eventdata->userto            = get_admin();