Feature #272 - Providing a better way for the function api_get_path() for detecting when installation runs, by using the constant SYSTEM_INSTALLATION.

skala
Ivan Tcholakov 16 years ago
parent f03c754f82
commit f44a6e3321
  1. 2
      main/inc/global_error_message.inc.php
  2. 7
      main/inc/lib/main_api.lib.php
  3. 23
      main/install/index.php

@ -115,7 +115,7 @@ if (is_int($global_error_code) && $global_error_code > 0) {
}
$click_to_install = substr($InstallationDescription, 0, $pos);
$read_installation_guide = substr($InstallationDescription, $pos + 2);
$InstallationDescription = '<form action="main/install/index.php" method="get"><button class="save" type="submit" value="&nbsp;&nbsp; '.$click_to_install.' &nbsp;&nbsp;" >'.$click_to_install.'</button></form><br />
$InstallationDescription = '<form action="'.$root_rel.'main/install/index.php" method="get"><button class="save" type="submit" value="&nbsp;&nbsp; '.$click_to_install.' &nbsp;&nbsp;" >'.$click_to_install.'</button></form><br />
<a href="'.$installation_guide_url.'" target="_blank">'.$read_installation_guide.'</a>';
$global_error_message['description'] = $InstallationDescription;
break;

@ -402,12 +402,11 @@ function api_get_path($path_type, $path = null) {
//
// Support for the installation process.
// Developers might use the function api_fet_path() directly or indirectly (this is difficult to be traced), at the moment when
// Developers might use the function api_get_path() directly or indirectly (this is difficult to be traced), at the moment when
// configuration has not been created yet. This is why this function should be upgraded to return correct results in this case.
//
if (!file_exists($include_path_sys.'/conf/configuration.php')) {
$requested_page_rel = api_get_self();
if (($pos = strpos($requested_page_rel, 'main/install')) !== false) {
if (defined('SYSTEM_INSTALLATION') && SYSTEM_INSTALLATION) {
if (($pos = strpos(($requested_page_rel = api_get_self()), 'main/install')) !== false) {
$root_rel = substr($requested_page_rel, 0, $pos);
// See http://www.mediawiki.org/wiki/Manual:$wgServer
$server_protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';

@ -15,6 +15,20 @@
==============================================================================
*/
/*
==============================================================================
CONSTANTS
==============================================================================
*/
define('SYSTEM_INSTALLATION', 1);
define('MAX_COURSE_TRANSFER', 100);
define('INSTALL_TYPE_UPDATE', 'update');
define('FORM_FIELD_DISPLAY_LENGTH', 40);
define('DATABASE_FORM_FIELD_DISPLAY_LENGTH', 25);
define('MAX_FORM_FIELD_LENGTH', 80);
define('DEFAULT_LANGUAGE', 'english'); // TODO: To be examined.
/*
==============================================================================
PHP VERSION CHECK
@ -96,15 +110,6 @@ api_set_internationalization_default_encoding($charset);
// Page encoding initialization.
header('Content-Type: text/html; charset='. api_get_system_encoding());
// Some constants
define('SYSTEM_INSTALLATION', 1);
define('MAX_COURSE_TRANSFER', 100);
define('INSTALL_TYPE_UPDATE', 'update');
define('FORM_FIELD_DISPLAY_LENGTH', 40);
define('DATABASE_FORM_FIELD_DISPLAY_LENGTH', 25);
define('MAX_FORM_FIELD_LENGTH', 80);
define('DEFAULT_LANGUAGE', 'english'); // TODO: To be examined.
// Setting the error reporting levels.
error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR);

Loading…
Cancel
Save