[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/enrol/database/ -> enrol_database_sync.php (source)

   1  <?php // $Id: enrol_database_sync.php,v 1.6.2.1 2008/01/02 22:35:33 skodak Exp $
   2  
   3      if(!empty($_SERVER['GATEWAY_INTERFACE'])){
   4          error_log("should not be called from apache!");
   5          exit;
   6      }
   7      error_reporting(E_ALL);
   8      
   9      require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); // global moodle config file.
  10  
  11      require_once($CFG->dirroot . '/course/lib.php');
  12      require_once($CFG->dirroot . '/lib/blocklib.php');
  13      require_once($CFG->dirroot . "/enrol/database/enrol.php");
  14  
  15      // ensure errors are well explained
  16      $CFG->debug=E_ALL;
  17  
  18      if (!is_enabled_enrol('database')) {
  19           error_log("Database enrol plugin not enabled!");
  20           die;
  21      }
  22  
  23      // update enrolments -- these handlers should autocreate courses if required
  24      $enrol = new enrolment_plugin_database();
  25  
  26      // If we have settings to handle roles individually, through each type of
  27      // role and update it.  Otherwise, just got through once (with no role
  28      // specified).
  29      $roles = !empty($CFG->enrol_db_remoterolefield) && !empty($CFG->enrol_db_localrolefield)
  30          ? get_records('role')
  31          : array(null);
  32          
  33      foreach ($roles as $role) {
  34          $enrol->sync_enrolments($role);
  35      }
  36      
  37      // sync metacourses
  38      if (function_exists('sync_metacourses')) {
  39          sync_metacourses();
  40      }
  41      
  42  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7