| Línea 28... |
Línea 28... |
| 28 |
* @copyright 2009 Petr Skoda (http://skodak.org)
|
28 |
* @copyright 2009 Petr Skoda (http://skodak.org)
|
| 29 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
29 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
| 30 |
*/
|
30 |
*/
|
| Línea 31... |
Línea 31... |
| 31 |
|
31 |
|
| - |
|
32 |
define('CLI_SCRIPT', true);
|
| Línea 32... |
Línea 33... |
| 32 |
define('CLI_SCRIPT', true);
|
33 |
define('NO_DEBUG_DISPLAY', false);
|
| 33 |
|
34 |
|
| 34 |
// extra execution prevention - we can not just require config.php here
|
35 |
// extra execution prevention - we can not just require config.php here
|
| 35 |
if (isset($_SERVER['REMOTE_ADDR'])) {
|
36 |
if (isset($_SERVER['REMOTE_ADDR'])) {
|
| Línea 163... |
Línea 164... |
| 163 |
$CFG->docroot = 'http://docs.moodle.org';
|
164 |
$CFG->docroot = 'http://docs.moodle.org';
|
| 164 |
$CFG->running_installer = true;
|
165 |
$CFG->running_installer = true;
|
| 165 |
$CFG->early_install_lang = true;
|
166 |
$CFG->early_install_lang = true;
|
| 166 |
$CFG->ostype = (stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin')) ? 'WINDOWS' : 'UNIX';
|
167 |
$CFG->ostype = (stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin')) ? 'WINDOWS' : 'UNIX';
|
| 167 |
$CFG->dboptions = array();
|
168 |
$CFG->dboptions = array();
|
| 168 |
$CFG->debug = (E_ALL | E_STRICT);
|
169 |
$CFG->debug = (E_ALL);
|
| 169 |
$CFG->debugdisplay = true;
|
170 |
$CFG->debugdisplay = true;
|
| 170 |
$CFG->debugdeveloper = true;
|
171 |
$CFG->debugdeveloper = true;
|
| Línea 171... |
Línea 172... |
| 171 |
|
172 |
|
| 172 |
$parts = explode('/', str_replace('\\', '/', dirname(__DIR__)));
|
173 |
$parts = explode('/', str_replace('\\', '/', dirname(__DIR__)));
|
| Línea 173... |
Línea 174... |
| 173 |
$CFG->admin = array_pop($parts);
|
174 |
$CFG->admin = array_pop($parts);
|
| 174 |
|
175 |
|
| 175 |
//point pear include path to moodles lib/pear so that includes and requires will search there for files before anywhere else
|
176 |
// Point pear include path to moodles lib/pear so that includes and requires will search there for files before anywhere else
|
| Línea -... |
Línea 177... |
| - |
|
177 |
// the problem is that we need specific version of quickforms and hacked excel files :-(.
|
| 176 |
//the problem is that we need specific version of quickforms and hacked excel files :-(
|
178 |
ini_set('include_path', $CFG->libdir.'/pear' . PATH_SEPARATOR . ini_get('include_path'));
|
| - |
|
179 |
|
| - |
|
180 |
// The core_component class can be used in any scripts, it does not need anything else.
|
| - |
|
181 |
require_once($CFG->libdir.'/classes/component.php');
|
| - |
|
182 |
|
| 177 |
ini_set('include_path', $CFG->libdir.'/pear' . PATH_SEPARATOR . ini_get('include_path'));
|
183 |
// Register our classloader.
|
| 178 |
|
184 |
\core\component::register_autoloader();
|
| 179 |
require_once($CFG->libdir.'/classes/component.php');
|
185 |
|
| 180 |
require_once($CFG->libdir.'/classes/text.php');
|
186 |
require_once($CFG->libdir.'/classes/text.php');
|
| 181 |
require_once($CFG->libdir.'/classes/string_manager.php');
|
187 |
require_once($CFG->libdir.'/classes/string_manager.php');
|
| Línea 188... |
Línea 194... |
| 188 |
require_once($CFG->libdir.'/dmllib.php');
|
194 |
require_once($CFG->libdir.'/dmllib.php');
|
| 189 |
require_once($CFG->libdir.'/moodlelib.php');
|
195 |
require_once($CFG->libdir.'/moodlelib.php');
|
| 190 |
require_once($CFG->libdir.'/deprecatedlib.php');
|
196 |
require_once($CFG->libdir.'/deprecatedlib.php');
|
| 191 |
require_once($CFG->libdir.'/adminlib.php');
|
197 |
require_once($CFG->libdir.'/adminlib.php');
|
| 192 |
require_once($CFG->libdir.'/componentlib.class.php');
|
198 |
require_once($CFG->libdir.'/componentlib.class.php');
|
| 193 |
require_once($CFG->dirroot.'/cache/lib.php');
|
- |
|
| 194 |
|
- |
|
| 195 |
// Register our classloader, in theory somebody might want to replace it to load other hacked core classes.
|
- |
|
| 196 |
// Required because the database checks below lead to session interaction which is going to lead us to requiring autoloaded classes.
|
- |
|
| 197 |
if (defined('COMPONENT_CLASSLOADER')) {
|
- |
|
| 198 |
spl_autoload_register(COMPONENT_CLASSLOADER);
|
- |
|
| 199 |
} else {
|
- |
|
| 200 |
spl_autoload_register('core_component::classloader');
|
- |
|
| 201 |
}
|
- |
|
| Línea 202... |
Línea 199... |
| 202 |
|
199 |
|
| 203 |
require($CFG->dirroot.'/version.php');
|
200 |
require($CFG->dirroot.'/version.php');
|
| Línea 204... |
Línea 201... |
| 204 |
$CFG->target_release = $release;
|
201 |
$CFG->target_release = $release;
|
| Línea 218... |
Línea 215... |
| 218 |
//Database types
|
215 |
//Database types
|
| 219 |
$databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'),
|
216 |
$databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'),
|
| 220 |
'auroramysql' => moodle_database::get_driver_instance('auroramysql', 'native'),
|
217 |
'auroramysql' => moodle_database::get_driver_instance('auroramysql', 'native'),
|
| 221 |
'mariadb'=> moodle_database::get_driver_instance('mariadb', 'native'),
|
218 |
'mariadb'=> moodle_database::get_driver_instance('mariadb', 'native'),
|
| 222 |
'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'),
|
219 |
'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'),
|
| 223 |
'oci' => moodle_database::get_driver_instance('oci', 'native'),
|
- |
|
| 224 |
'sqlsrv' => moodle_database::get_driver_instance('sqlsrv', 'native'), // MS SQL*Server PHP driver
|
220 |
'sqlsrv' => moodle_database::get_driver_instance('sqlsrv', 'native'), // MS SQL*Server PHP driver
|
| 225 |
);
|
221 |
);
|
| 226 |
foreach ($databases as $type=>$database) {
|
222 |
foreach ($databases as $type=>$database) {
|
| 227 |
if ($database->driver_installed() !== true) {
|
223 |
if ($database->driver_installed() !== true) {
|
| 228 |
unset($databases[$type]);
|
224 |
unset($databases[$type]);
|
| Línea 562... |
Línea 558... |
| 562 |
|
558 |
|
| 563 |
// Ask for db prefix.
|
559 |
// Ask for db prefix.
|
| 564 |
if ($interactive) {
|
560 |
if ($interactive) {
|
| 565 |
cli_separator();
|
561 |
cli_separator();
|
| 566 |
cli_heading(get_string('dbprefix', 'install'));
|
- |
|
| 567 |
//TODO: solve somehow the prefix trouble for oci.
|
562 |
cli_heading(get_string('dbprefix', 'install'));
|
| 568 |
if ($options['prefix'] !== '') {
|
563 |
if ($options['prefix'] !== '') {
|
| 569 |
$prompt = get_string('clitypevaluedefault', 'admin', $options['prefix']);
|
564 |
$prompt = get_string('clitypevaluedefault', 'admin', $options['prefix']);
|
| 570 |
} else {
|
565 |
} else {
|
| 571 |
$prompt = get_string('clitypevalue', 'admin');
|
566 |
$prompt = get_string('clitypevalue', 'admin');
|