public function requireConfig()
    {
        global $CFG;

        if (!defined('CLI_SCRIPT')) {
            define('CLI_SCRIPT', true);
        }
        if (!defined('IGNORE_COMPONENT_CACHE')) {
            define('IGNORE_COMPONENT_CACHE', true);
        }
        if (!defined('CACHE_DISABLE_ALL')) {
            define('CACHE_DISABLE_ALL', true);
        }
        if (!defined('ABORT_AFTER_CONFIG')) {
            // Need this since Moodle will not be fully installed.
            define('ABORT_AFTER_CONFIG', true);
        }
        $path = $this->directory.'/config.php';

        if (!is_file($path)) {
            throw new \RuntimeException('Failed to find Moodle config file');
        }

        /** @noinspection PhpIncludeInspection */
        require_once $path;

        // Save a local reference to Moodle's config.
        if (empty($this->cfg)) {
            $this->cfg = $CFG;
        }
    }
public function requireConfig()
    {
        global $CFG;

        if (!defined('CLI_SCRIPT')) {
            define('CLI_SCRIPT', true);
        }
        if (!defined('IGNORE_COMPONENT_CACHE')) {
            define('IGNORE_COMPONENT_CACHE', true);
        }
        if (!defined('CACHE_DISABLE_ALL')) {
            define('CACHE_DISABLE_ALL', true);
        }
        if (!defined('ABORT_AFTER_CONFIG')) {
            // Need this since Moodle will not be fully installed.
            define('ABORT_AFTER_CONFIG', true);
        }
        $path = $this->directory.'/config.php';

        if (!is_file($path)) {
            throw new \RuntimeException('Failed to find Moodle config file');
        }

        /** @noinspection PhpIncludeInspection */
        require_once $path;

        // Save a local reference to Moodle's config.
        if (empty($this->cfg)) {
            $this->cfg = $CFG;
        }
    }
public function requireConfig ( ) { global $ CFG ; if ( ! defined ( 'CLI_SCRIPT' ) ) { define ( 'CLI_SCRIPT' , true ) ; } if ( ! defined ( 'IGNORE_COMPONENT_CACHE' ) ) { define ( 'IGNORE_COMPONENT_CACHE' , true ) ; } if ( ! defined ( 'CACHE_DISABLE_ALL' ) ) { define ( 'CACHE_DISABLE_ALL' , true ) ; } if ( ! defined ( 'ABORT_AFTER_CONFIG' ) ) { // Need this since Moodle will not be fully installed. define ( 'ABORT_AFTER_CONFIG' , true ) ; } $ path = $ this -> directory . '/config.php' ; if ( ! is_file ( $ path ) ) { throw new \ RuntimeException ( 'Failed to find Moodle config file' ) ; } /** @noinspection PhpIncludeInspection */ require_once $ path ; // Save a local reference to Moodle's config. if ( empty ( $ this -> cfg ) ) { $ this -> cfg = $ CFG ; } }
Load's Moodle config so we can use Moodle APIs.
Load s Moodle config so we can use Moodle APIs .