Fix bugs in the installation script

This commit is contained in:
Dmitriy Simushev 2012-09-13 12:58:08 +00:00
parent 29d7f891da
commit 89c61a5571
3 changed files with 47 additions and 8 deletions

View File

@ -231,7 +231,25 @@ function create_table($id, $link)
mysql_query($query, $link) or show_install_err(' Query failed: ' . mysql_error($link));
if ($id == "${mysqlprefix}chatoperator") {
create_operator("admin", "", "", "Administrator", "Administrator", "");
// Create First Administrator
mysql_query(
"INSERT INTO ${mysqlprefix}chatoperator ( " .
"vclogin, " .
"vcpassword, " .
"vclocalename, " .
"vccommonname, " .
"vcavatar, " .
"vcemail " .
") values ( " .
"'admin', " .
"MD5(''), " .
"'', " .
"'Administrator', " .
"'Administrator', " .
"''" .
")",
$link
);
} else if ($id == "${mysqlprefix}chatrevision") {
$result = mysql_query("INSERT INTO ${mysqlprefix}chatrevision VALUES (1)", $link);
if (! $result) {

View File

@ -15,8 +15,15 @@
* limitations under the License.
*/
require_once('../libs/common.php');
require_once('../libs/operator.php');
session_start();
require_once('../libs/config.php');
// Include common functions
require_once('../libs/common/constants.php');
require_once('../libs/common/locale.php');
require_once('../libs/common/misc.php');
require_once('../libs/common/response.php');
// Include database structure
require_once('dbinfo.php');
function runsql($query, $link)

View File

@ -15,8 +15,17 @@
* limitations under the License.
*/
require_once('../libs/common.php');
require_once('../libs/settings.php');
session_start();
require_once('../libs/config.php');
// Include common functions
require_once('../libs/common/constants.php');
require_once('../libs/common/locale.php');
require_once('../libs/common/misc.php');
require_once('../libs/common/response.php');
require_once('../libs/common/string.php');
// Include database structure
require_once('dbinfo.php');
$page = array(
@ -295,7 +304,7 @@ function add_canned_messages($link){
function check_status()
{
global $page, $webimroot, $dbversion;
global $page, $webimroot, $dbversion, $mysqlprefix;
$page['done'][] = getlocal2("install.0.php", array(phpversion()));
@ -341,10 +350,15 @@ function check_status()
$page['show_small_login'] = true;
// Update current dbversion
$res = mysql_query("select COUNT(*) as count from ${mysqlprefix}chatconfig where vckey = 'dbversion'", $link);
if(mysql_result($res, 0, 'count') == 0) {
mysql_query("insert into ${mysqlprefix}chatconfig (vckey) values ('dbversion')", $link);
}
mysql_query("update ${mysqlprefix}chatconfig set vcvalue = '{$dbversion}' where vckey='dbversion'", $link);
mysql_close($link);
Settings::set('dbversion', $dbversion);
Settings::update();
}
check_status();