3 // This file is part of Moodle - http://moodle.org/
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
19 * CLI sync for full category enrol synchronisation.
22 * $sudo -u www-data /usr/bin/php /var/www/moodle/enrol/category/cli/sync.php
25 * - it is required to use the web server account when executing PHP CLI scripts
26 * - you need to change the "www-data" to match the apache user account
27 * - use "su" if "sudo" not available
30 * @subpackage category
31 * @copyright 2010 Petr Skoda {@link http://skodak.org}
32 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
35 define('CLI_SCRIPT', true);
37 require(dirname(dirname(dirname(dirname(__FILE__
)))).'/config.php');
38 require_once("$CFG->dirroot/enrol/category/locallib.php");
40 if (!enrol_is_enabled('category')) {
41 die('enrol_category plugin is disabled, sync is disabled');
44 enrol_category_sync_full();