Fixes for the upgrade to php7.0

This commit is contained in:
Hannes Verschore 2017-03-13 12:36:00 -07:00
Родитель 5bc2671d84
Коммит ca1aa1ba8c
2 изменённых файлов: 96 добавлений и 1 удалений

12
database/migration-14.php Normal file
Просмотреть файл

@ -0,0 +1,12 @@
<?php
$migrate = function() {
mysql_query("ALTER TABLE `control_task_queue` CHANGE `start` `start` INT(10) UNSIGNED NOT NULL DEFAULT '0'");
mysql_query("ALTER TABLE `control_task_queue` CHANGE `finish` `finish` INT(10) UNSIGNED NOT NULL DEFAULT '0'");
mysql_query("ALTER TABLE `control_task_queue` CHANGE `output` `output` LONGTEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL") or die(mysql_error());
mysql_query("ALTER TABLE `control_task_queue` CHANGE `error` `error` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL;");
};
$rollback = function() {
};

Просмотреть файл

@ -16,7 +16,7 @@ class Config {
// General Config
public $data_folder;
function Config($config_file_path)
function __construct($config_file_path)
{
$this->init($config_file_path);
}
@ -184,5 +184,88 @@ function awfy_query($query)
return $result;
}
if (!function_exists("mysql_connect")){
/* warning: fatal error "cannot redeclare" if a function was disabled in php.ini with disable_functions:
disable_functions =mysql_connect,mysql_pconnect,mysql_select_db,mysql_ping,mysql_query,mysql_fetch_assoc,mysql_num_rows,mysql_fetch_array,mysql_error,mysql_insert_id,mysql_close,mysql_real_escape_string,mysql_data_seek,mysql_result
*/
function mysql_connect($host, $username, $password){
global $dbconnect;
$dbconnect = mysqli_connect($host, $username, $password);
return $dbconnect;
}
function mysql_pconnect($host, $username, $password){
global $dbconnect;
$dbconnect = mysqli_connect("p:".$host, $username, $password);
return $dbconnect;
}
function mysql_select_db($db){
global $dbconnect;
return mysqli_select_db ( $dbconnect,$db );
}
function mysql_ping($dbconnect){
return mysqli_ping ( $dbconnect );
}
function mysql_query($stmt){
global $dbconnect;
return mysqli_query ($dbconnect, $stmt );
}
function mysql_fetch_assoc($erg){
return mysqli_fetch_assoc ($erg );
}
function mysql_num_rows($e){
return mysqli_num_rows ($e );
}
function mysql_affected_rows($e=NULL){
return mysqli_affected_rows ($e );
}
function mysql_fetch_array($e){
return mysqli_fetch_array ($e );
}
function mysql_error(){
global $dbconnect;
return mysqli_error ($dbconnect);
}
function mysql_insert_id($cnx){
return mysqli_insert_id ( $cnx );
}
function mysql_close(){
return true;
}
function mysql_escape_string($s){
global $dbconnect;
return mysqli_real_escape_string($dbconnect,$s);
}
function mysql_real_escape_string($s){
global $dbconnect;
return mysqli_real_escape_string($dbconnect,$s);
}
function mysql_data_seek($re,$row){
return mysqli_data_seek($re,$row);
}
function mysql_result($res,$row=0,$col=0){
$numrows = mysqli_num_rows($res);
if ($numrows && $row <= ($numrows-1) && $row >=0){
mysqli_data_seek($res,$row);
$resrow = (is_numeric($col)) ? mysqli_fetch_row($res) : mysqli_fetch_assoc($res);
if (isset($resrow[$col])){
return $resrow[$col];
}
}
return false;
}
function mysql_get_server_info() {
global $dbconnect;
return mysqli_get_server_info($dbconnect);
}
function mysql_set_charset($csname) {
global $dbconnect;
return mysqli_set_charset($dbconnect,$csname);
}
function mysql_fetch_object($result) {
return mysqli_fetch_object($result);
}
}
// Init
$config = new Config("/etc/awfy-server.config");