1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-05-19 17:28:23 +03:00
ifhub.club/update/update_0.2_to_0.3.php

43 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
set_time_limit(0);
set_include_path(get_include_path().PATH_SEPARATOR.dirname(dirname(__FILE__)));
chdir(dirname(dirname(__FILE__)));
require_once("./config/config.table.php");
$aConfig=include("./config/config.db.php");
$link=mysql_connect($aConfig['host'],$aConfig['user'],$aConfig['pass']);
mysql_select_db($aConfig['dbname'],$link);
mysql_query("set character_set_client='utf8'",$link);
mysql_query("set character_set_results='utf8'",$link);
mysql_query("set collation_connection='utf8_bin'",$link);
/**
* Выполняем SQL для конвертации структуры БД
*/
$fp = fopen("./update/update_0.2_to_0.3.sql", "r");
if (!$fp) {
die("Не найден SQL файл - update_0.2_to_0.3.sql");
}
$sSql = '';
while (!feof($fp)) {
$sSql.=fread($fp, 1024*4);
}
fclose($fp);
if ($sSql!='') {
$aSqlList=explode(';',$sSql);
foreach ($aSqlList as $s) {
if (trim($s)!='') {
if (!mysql_query($s,$link)) {
var_dump(mysql_error($link));
}
}
}
}
?>
Если никакие ошибки не повылазили, значит апдейт на новую версию прошел успешно. Поздравляем!