original_string: public static function request_status_update() {
          global $DB;
  
          list($sitecourses, $coursetotal) = api::get_courses('', 1, 1, ['allsitecourses' => 1]);
  
          // Update status for all these course.
          foreach ($sitecourses as $sitecourse) {
              // Get the publication from the hub course id.
              $publication = $DB->get_record('course_published', ['hubcourseid' => $sitecourse['id']]);
              if (!empty($publication)) {
                  $publication->status = $sitecourse['privacy'];
                  $publication->timechecked = time();
                  self::update_publication($publication);
              } else {
                  $msgparams = new stdClass();
                  $msgparams->id = $sitecourse['id'];
                  $msgparams->hubname = html_writer::tag('a', 'Moodle.net', array('href' => HUB_MOODLEORGHUBURL));
                  \core\notification::add(get_string('detectednotexistingpublication', 'hub', $msgparams)); // TODO action?
              }
          }
  
      }
code: public static function request_status_update() {
          global $DB;
  
          list($sitecourses, $coursetotal) = api::get_courses('', 1, 1, ['allsitecourses' => 1]);
  
          // Update status for all these course.
          foreach ($sitecourses as $sitecourse) {
              // Get the publication from the hub course id.
              $publication = $DB->get_record('course_published', ['hubcourseid' => $sitecourse['id']]);
              if (!empty($publication)) {
                  $publication->status = $sitecourse['privacy'];
                  $publication->timechecked = time();
                  self::update_publication($publication);
              } else {
                  $msgparams = new stdClass();
                  $msgparams->id = $sitecourse['id'];
                  $msgparams->hubname = html_writer::tag('a', 'Moodle.net', array('href' => HUB_MOODLEORGHUBURL));
                  \core\notification::add(get_string('detectednotexistingpublication', 'hub', $msgparams)); // TODO action?
              }
          }
  
      }
code_tokens: public static function request_status_update ( ) { global $ DB ; list ( $ sitecourses , $ coursetotal ) = api :: get_courses ( '' , 1 , 1 , [ 'allsitecourses' => 1 ] ) ; // Update status for all these course. foreach ( $ sitecourses as $ sitecourse ) { // Get the publication from the hub course id. $ publication = $ DB -> get_record ( 'course_published' , [ 'hubcourseid' => $ sitecourse [ 'id' ] ] ) ; if ( ! empty ( $ publication ) ) { $ publication -> status = $ sitecourse [ 'privacy' ] ; $ publication -> timechecked = time ( ) ; self :: update_publication ( $ publication ) ; } else { $ msgparams = new stdClass ( ) ; $ msgparams -> id = $ sitecourse [ 'id' ] ; $ msgparams -> hubname = html_writer :: tag ( 'a' , 'Moodle.net' , array ( 'href' => HUB_MOODLEORGHUBURL ) ) ; \ core \ notification :: add ( get_string ( 'detectednotexistingpublication' , 'hub' , $ msgparams ) ) ; // TODO action? } } }
docstring: Check all courses published from this site if they have been approved
docstring_tokens: Check all courses published from this site if they have been approved