diff --git a/install.php b/install.php
index 027ad2a70c9..bcde35d7e89 100644
--- a/install.php
+++ b/install.php
@@ -68,7 +68,7 @@ if ( empty($INSTALL['language']) and empty($_POST['language']) ) {
$SESSION->lang = (!empty($_POST['language'])) ? $_POST['language'] : $INSTALL['language'];
$CFG->dirroot = $INSTALL['dirroot'];
$CFG->dataroot = $INSTALL['dataroot'];
-$CFG->directorypermissions = 0777;
+$CFG->directorypermissions = 00777;
/// Include some moodle libraries
@@ -162,26 +162,26 @@ if ($INSTALL['stage'] == 2) {
if (($fh = @fopen($INSTALL['dirroot'].'/install.php', 'r')) === false ) {
$CFG->dirroot = dirname(__FILE__);
$INSTALL['dirroot'] = dirname(__FILE__);
- $errormsg = get_string('dirrooterror', 'install');
- } else {
- fclose($fh);
+ $errormsg .= get_string('dirrooterror', 'install').'
';
+ }
+ if ($fh) fclose($fh);
- $CFG->dirroot = $INSTALL['dirroot'];
+ $CFG->dirroot = $INSTALL['dirroot'];
- /// check wwwroot
+ /// check wwwroot
+ if (ini_get('allow_url_fopen')) {
if (($fh = @fopen($INSTALL['wwwroot'].'/install.php', 'r')) === false) {
- $errormsg = get_string('wwwrooterror', 'install');
- } else {
- fclose($fh);
-
- /// check dataroot
- $CFG->dataroot = $INSTALL['dataroot'];
- if (make_upload_directory('sessions', false) === false ) {
- $errormsg = get_string('datarooterror', 'install');
- }
+ $errormsg .= get_string('wwwrooterror', 'install').'
';
}
}
-
+ if ($fh) fclose($fh);
+
+ /// check dataroot
+ $CFG->dataroot = $INSTALL['dataroot'];
+ if (make_upload_directory('sessions', false) === false ) {
+ $errormsg = get_string('datarooterror', 'install').'
';
+ }
+ if ($fh) fclose($fh);
if (!empty($errormsg)) $nextstage = 2;
@@ -213,24 +213,34 @@ if ($INSTALL['stage'] == 3) {
}
}
- $db = &ADONewConnection($INSTALL['dbtype']);
+ if ($INSTALL['dbtype'] == 'mysql') { /// Check MySQL extension is present
+ if (!extension_loaded('mysql')) {
+ $errormsg = get_string('mysqlextensionisnotpresentinphp', 'install');
+ $nextstage = 3;
+ }
+ }
- error_reporting(0); // Hide errors
-
- if (! $dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname'])) {
- /// The following doesn't seem to work but we're working on it
- /// If you come up with a solution for creating a database in MySQL
- /// feel free to put it in and let us know
- if ($dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'])) {
- switch ($INSTALL['dbtype']) { /// Try to create a database
- case 'mysql':
- if ($db->Execute("CREATE DATABASE {$INSTALL['dbname']};")) {
- $dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname']);
- } else {
- $errormsg = get_string('dbcreationerror', 'install');
- $nextstage = 3;
- }
- break;
+ if (empty($errormsg)) {
+
+ $db = &ADONewConnection($INSTALL['dbtype']);
+
+ error_reporting(0); // Hide errors
+
+ if (! $dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname'])) {
+ /// The following doesn't seem to work but we're working on it
+ /// If you come up with a solution for creating a database in MySQL
+ /// feel free to put it in and let us know
+ if ($dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'])) {
+ switch ($INSTALL['dbtype']) { /// Try to create a database
+ case 'mysql':
+ if ($db->Execute("CREATE DATABASE {$INSTALL['dbname']};")) {
+ $dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname']);
+ } else {
+ $errormsg = get_string('dbcreationerror', 'install');
+ $nextstage = 3;
+ }
+ break;
+ }
}
}
}
@@ -296,7 +306,7 @@ if ($nextstage == 5) {
$str .= '$CFG->admin = \''.$INSTALL['admindirname']."';\r\n";
$str .= "\r\n";
- $str .= '$CFG->directorypermissions = 0777;'."\r\n";
+ $str .= '$CFG->directorypermissions = 00777; // try 02777 on a server in Safe Mode'."\r\n";
$str .= "\r\n";
$str .= 'require_once("$CFG->dirroot/lib/setup.php");'."\r\n";
@@ -346,7 +356,7 @@ if (isset($_GET['help'])) {
|
-
|
@@ -546,7 +556,7 @@ function form_table($nextstage = 0, $formaction = "install.php") { |
| - + | |