Project

General

Profile

Actions

Support #1799

closed

Who uses the CLI_INSTALLATION constant in main/install/install_db.inc.php?

Added by Julio Montoya about 13 years ago. Updated over 12 years ago.

Status:
Bug resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
02/08/2010
Due date:
% Done:

90%

Estimated time:
Spent time:
Complexity:
Normal
SCRUM pts - complexity:
?

Description

Need some feedback about this constants...

Actions #1

Updated by Julio Montoya about 13 years ago

  • Subject changed from Who uses the CLI_INSTALLATION constant in main/install/isntal_db.inc.php? to Who uses the CLI_INSTALLATION constant in main/install/install_db.inc.php?
Actions #2

Updated by Yannick Warnier about 13 years ago

I guess somehow that must have been me (I'm not aware of anybody else using CLI installation), but you can probably trace it easily here http://code.google.com/p/chamilo/source/list?path=/main/install/install_db.inc.php&repo=classic&r=7ce7939222b0127bd16b4469058d7bc7ac5c25e7 (check all versions until you find one that doesn't have the constant, then look who added it).
Apparently Ivan introduced or changed a constant called SYSTEM_INSTALLATION at some point.

Actions #3

Updated by Yannick Warnier about 13 years ago

  • % Done changed from 0 to 10
Actions #4

Updated by Ivan Tcholakov about 13 years ago

I don't use the constant CLI_INSTALLATION.
I think, I renamed a constant: DOKEOS_INSTALL -----> SYSTEM_INSTALLATION.

Actions #5

Updated by Julio Montoya about 13 years ago

It seems that Guillaume added it here:

http://code.google.com/p/chamilo/source/detail?r=04bde4594ccf49d6f615327b027a3e084fd45194&repo=classic&path=/main/install/install_db.inc.php

I wish to add more conditions because when using a script for BNPanel, I dont want that the install_db.inc.php create the databases.

I wish to add this install_db.inc.php +31

if(!defined('CLI_INSTALLATION')) {
        $dbPrefixForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbPrefixForm);

        $dbNameForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbNameForm);
        if (!empty($dbPrefixForm) && strpos($dbNameForm, $dbPrefixForm) !== 0) {
                $dbNameForm = $dbPrefixForm.$dbNameForm;
        }

        $dbStatsForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbStatsForm);
        if (!empty($dbPrefixForm) && strpos($dbStatsForm, $dbPrefixForm) !== 0) {
                $dbStatsForm = $dbPrefixForm.$dbStatsForm;
        }

        $dbUserForm = preg_replace('/[^a-zA-Z0-9_\-]/', '', $dbUserForm);
        if (!empty($dbPrefixForm) && strpos($dbUserForm, $dbPrefixForm) !== 0) {
                $dbUserForm = $dbPrefixForm.$dbUserForm;
        }

        $mysqlMainDb = $dbNameForm;
        if (empty($mysqlMainDb) || $mysqlMainDb == 'mysql' || $mysqlMainDb == $dbPrefixForm) {
                $mysqlMainDb = $dbPrefixForm.'main';
        }

        $mysqlStatsDb = $dbStatsForm;
        if (empty($mysqlStatsDb) || $mysqlStatsDb == 'mysql' || $mysqlStatsDb == $dbPrefixForm) {
                $mysqlStatsDb = $dbPrefixForm.'stats';
        }

        $mysqlUserDb = $dbUserForm;
        if (empty($mysqlUserDb) || $mysqlUserDb == 'mysql' || $mysqlUserDb == $dbPrefixForm) {
                $mysqlUserDb = $dbPrefixForm.'user';
        }

        $result = Database::query("SHOW VARIABLES LIKE 'datadir'") or die(Database::error());

        $mysqlRepositorySys = Database::fetch_array($result);
        $mysqlRepositorySys = $mysqlRepositorySys['Value'];

        if (!$singleDbForm) {
                Database::query("DROP DATABASE IF EXISTS `$mysqlMainDb`") or die(Database::error());
        }
        Database::query("CREATE DATABASE IF NOT EXISTS `$mysqlMainDb`") or die(Database::error());
}

Actions #6

Updated by Julio Montoya about 13 years ago

  • Status changed from New to Needs more info
  • % Done changed from 10 to 90

Ok I'm adding this validation:

http://code.google.com/p/chamilo/source/detail?r=679c60bf545397dfbb1d1d6845069535fdae9f0b&repo=classic

I hope this does not break the phing process. Waiting feedback.

Actions #7

Updated by Yannick Warnier over 12 years ago

  • Status changed from Needs more info to Bug resolved

Apparently it doesn't (break the phing process). OK for me.

Actions #8

Updated by Yannick Warnier over 12 years ago

  • Target version set to 1.8.8 stable
Actions

Also available in: Atom PDF