#!/usr/bin/env php
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

if (!defined('CLI_SCRIPT')) {
    define('CLI_SCRIPT', true);
}

if (!is_file(dirname(__DIR__) . '/config.php')) {
    throw new LogicException('Moodle has not been configured and installed. Please ensure it is installed first.');
}

require_once(dirname(__DIR__) . '/public/config.php');

$composer = \core\di::get(\core\composer::class);

if (!$composer->get_package_status('symfony/console')->installed) {
    throw new LogicException('Symfony console has not been installed via composer. Please run composer install.');
}

\core\di::get(\core\cli\application::class)
    ->run();
