Fixed issue #42. Fixed PDO migration in backup package (not fully)
This commit is contained in:
parent
1e791ed608
commit
d2f0644ea4
@ -31,7 +31,7 @@
|
||||
<thead class="thead-default">
|
||||
<tr>
|
||||
<th><mx:text id="TxtName"/></th>
|
||||
<th><mx:text id="Txtdate"/></th>
|
||||
<th><mx:text id="TxtDate"/></th>
|
||||
<th data-orderable="false"><mx:text id="TxtAction"/></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -40,7 +40,7 @@
|
||||
<tr>
|
||||
<td><mx:text id="nom"/></td>
|
||||
<td><mx:text id="date"/></td>
|
||||
<td><a mXattribut="href:js" class="linkview"></a></td>
|
||||
<td><span><a mXattribut="href:js"><span class="fa fa-lg fa-eye"></span></a></span></td>
|
||||
</tr>
|
||||
<tr style="display:none;" mXattribut="id:id">
|
||||
<td colspan="3">
|
||||
|
@ -811,6 +811,25 @@ Class InstallManager extends CoordinationObj
|
||||
|
||||
addMessageFile("installmanager.ini");
|
||||
|
||||
/* gestion du lib en fonction de la langue courante */
|
||||
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
|
||||
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
|
||||
/* fin récupèration des codes par defaut */
|
||||
|
||||
mxPageTitle("actionAdminTitlePage");
|
||||
|
||||
$arrayCallCss = array();
|
||||
$arrayCallCss[] = "data/css/dataTables.bootstrap4/1.10.22/dataTables.bootstrap4.min.css";
|
||||
mxCallCss($arrayCallCss);
|
||||
|
||||
$arrayCallJs = array();
|
||||
$arrayCallJs[] = "data/javascript/jquery.dataTables/1.10.22/jquery.dataTables.min.js";
|
||||
$arrayCallJs[] = "data/javascript/dataTables.bootstrap4/1.10.22/dataTables.bootstrap4.min.js";
|
||||
mxCallJs($arrayCallJs);
|
||||
|
||||
$arrayRawJs[] = "\$(document).ready(function(){\$(\"#tabBkpList\").dataTable({\"bPaginate\": true,\"bFilter\": false,\"bInfo\": true,\"sPaginationType\": \"full_numbers\",\"bAutoWidth\": false,\"bLengthChange\": false,\"aaSorting\": [[ 1, \"asc\" ]],\"iDisplayLength\": 10,\"oLanguage\": {\"sUrl\": \"data/message/".$currentCode."/datatables.txt\"}});});";
|
||||
mxRawJs($arrayRawJs);
|
||||
|
||||
withBlocPath("InstallManager", "bkpmanageinstall");
|
||||
|
||||
$this->tabeCreate();
|
||||
@ -824,12 +843,12 @@ Class InstallManager extends CoordinationObj
|
||||
$tabpatch=$backup->getAllPatch();
|
||||
|
||||
for ($i=0; $i<count($tabpatch); $i++){
|
||||
$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut("BACKUP.js", "javascript:visible('".$tabpatch[$i]["id"]."');");
|
||||
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("BACKUP.id", $tabpatch[$i]["id"]);
|
||||
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.id", $tabpatch[$i]["id"]);
|
||||
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.nom", $tabpatch[$i]["nom"]);
|
||||
$GLOBALS['SYSTEM_TEMPLATE']->MxAttribut("BACKUP.js", "javascript:visible('".$tabpatch[$i]["backup_id"]."');");
|
||||
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("BACKUP.id", $tabpatch[$i]["backup_id"]);
|
||||
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.id", $tabpatch[$i]["backup_id"]);
|
||||
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.nom", $tabpatch[$i]["backup_nom"]);
|
||||
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.BtnView", getMessage("BtnView"));
|
||||
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.date", date("Y-m-d H:i:s", $tabpatch[$i]["bkpdate"]));
|
||||
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("BACKUP.date", date("Y-m-d H:i:s", $tabpatch[$i]["backup_date"]));
|
||||
|
||||
# Affichage des backups de db...
|
||||
if ($tabpatch[$i]["db"]!==false){
|
||||
|
@ -48,7 +48,6 @@ class backup
|
||||
* @return entier clé du paquet
|
||||
*/
|
||||
function createBackup($name){
|
||||
//$prefixe=(!defined("DATA_ACCES_TABLE_PREFIX"))?"": DATA_ACCES_TABLE_PREFIX ;
|
||||
$sql="INSERT INTO ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_PACKAGE_PREFIX."backup(backup_libelle, backup_date) VALUES ('".addslashes($name)."', ".time().")";
|
||||
$rs=$GLOBALS["SYSTEM_DATABASE_CONN"]->sql_query($sql);
|
||||
return $GLOBALS["SYSTEM_DATABASE_CONN"]->sql_nextid($rs);
|
||||
@ -64,7 +63,6 @@ class backup
|
||||
*/
|
||||
function stockFile($idpatch,$oldname,$newname)
|
||||
{
|
||||
//$prefixe=(!defined("DATA_ACCES_TABLE_PREFIX"))?"": DATA_ACCES_TABLE_PREFIX ;
|
||||
$sql="INSERT INTO ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_PACKAGE_PREFIX."backupfile(backupfile_new_name,backupfile_old_name,backup_id) VALUES ('".addslashes($newname)."','".addslashes($oldname)."',".$idpatch.")";
|
||||
$GLOBALS["SYSTEM_DATABASE_CONN"]->sql_query($sql);
|
||||
return true;
|
||||
@ -94,7 +92,6 @@ class backup
|
||||
{
|
||||
$tabresult=array();
|
||||
$tabpatch=array();
|
||||
//$prefixe=(!defined("DATA_ACCES_TABLE_PREFIX"))?"": DATA_ACCES_TABLE_PREFIX ;
|
||||
|
||||
//Requete permettant de recupérer tous les patchs
|
||||
$sql_patch="SELECT * FROM ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_PACKAGE_PREFIX."backup ORDER BY backup_date DESC";
|
||||
@ -106,12 +103,12 @@ class backup
|
||||
$i=0;
|
||||
while ($tabpatch=$GLOBALS["SYSTEM_DATABASE_CONN"]->sql_fetchrow($query_patch))
|
||||
{
|
||||
$tabresult[$i]["backup_id"]=$tabpatch["id_backup"];
|
||||
$tabresult[$i]["backup_nom"]=stripslashes($tabpatch["libelle"]);
|
||||
$tabresult[$i]["backup_date"]=$tabpatch["bkpdate"];
|
||||
$tabresult[$i]["backup_id"]=$tabpatch["backup_id"];
|
||||
$tabresult[$i]["backup_nom"]=stripslashes($tabpatch["backup_libelle"]);
|
||||
$tabresult[$i]["backup_date"]=$tabpatch["backup_date"];
|
||||
|
||||
//On vérifie s'il existe des scripts associés au patch
|
||||
$sql_script="SELECT COUNT(new_name) as cpt FROM ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_PACKAGE_PREFIX."backupfile WHERE backup_id=".$tabpatch["id_backup"];
|
||||
$sql_script="SELECT COUNT(new_name) as cpt FROM ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_PACKAGE_PREFIX."backupfile WHERE backup_id=".$tabpatch["backup_id"];
|
||||
$result_script=$GLOBALS["SYSTEM_DATABASE_CONN"]->sql_query($sql_script);
|
||||
$tab=$GLOBALS["SYSTEM_DATABASE_CONN"]->sql_fetchrow();
|
||||
|
||||
@ -125,7 +122,7 @@ class backup
|
||||
}
|
||||
|
||||
//On vérifie s'il existe des sauvegardes de bd associées au patch
|
||||
$sql_db="SELECT COUNT(nom_bd) as cpt FROM ".$prefixe."backupbd WHERE backup_id=".$tabpatch["id_backup"];
|
||||
$sql_db="SELECT COUNT(nom_bd) as cpt FROM ".$prefixe."backupbd WHERE backup_id=".$tabpatch["backup_id"];
|
||||
$result_db=$GLOBALS["SYSTEM_DATABASE_CONN"]->sql_query($sql_db);
|
||||
$tab=$GLOBALS["SYSTEM_DATABASE_CONN"]->sql_fetchrow();
|
||||
|
||||
@ -156,7 +153,6 @@ class backup
|
||||
$tabresult=array();
|
||||
$tabpatch=array();
|
||||
$i=0;
|
||||
//$prefixe=(!defined("DATA_ACCES_TABLE_PREFIX"))?"": DATA_ACCES_TABLE_PREFIX ;
|
||||
|
||||
//Requete permettant de recupérer tous les patchs
|
||||
$sql_patch="SELECT backupfile_id,backupfile_new_name,backupfile_old_name,backup_id FROM ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_PACKAGE_PREFIX."backupfile WHERE ";
|
||||
@ -193,7 +189,6 @@ class backup
|
||||
$tabresult=array();
|
||||
$tabpatch=array();
|
||||
$i=0;
|
||||
//$prefixe=(!defined("DATA_ACCES_TABLE_PREFIX"))?"": DATA_ACCES_TABLE_PREFIX ;
|
||||
|
||||
//Requete permettant de recupérer tous les patchs
|
||||
$sql_patch="SELECT backupfile_id,backupfile_new_name,backupfile_old_name,backup_id FROM ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_PACKAGE_PREFIX."backupfile WHERE ";
|
||||
@ -230,7 +225,6 @@ class backup
|
||||
$tabresult=array();
|
||||
$tabpatch=array();
|
||||
$i=0;
|
||||
//$prefixe=(!defined("DATA_ACCES_TABLE_PREFIX"))?"": DATA_ACCES_TABLE_PREFIX ;
|
||||
|
||||
//Requete permettant de recupérer tous les patchs
|
||||
$sql_patch="SELECT backupbd_id,backupbd_nom,backup_id FROM ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_PACKAGE_PREFIX."backupbd WHERE ";
|
||||
@ -262,8 +256,7 @@ class backup
|
||||
$tabresult=array();
|
||||
$tabpatch=array();
|
||||
$i=0;
|
||||
//$prefixe=(!defined("DATA_ACCES_TABLE_PREFIX"))?"": DATA_ACCES_TABLE_PREFIX ;
|
||||
|
||||
|
||||
//Requete permettant de recupérer tous les patchs
|
||||
$sql_patch="SELECT backupbd_id,backupbd_nom,backup_id FROM ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_PACKAGE_PREFIX."backupbd WHERE ";
|
||||
$sql_patch.="backup_id=".$id;
|
||||
@ -291,8 +284,6 @@ class backup
|
||||
*/
|
||||
function deleteBackup($id)
|
||||
{
|
||||
//$prefixe=(!defined("DATA_ACCES_TABLE_PREFIX"))?"": DATA_ACCES_TABLE_PREFIX ;
|
||||
|
||||
//Requete permettant de supprimer le backup associés a l'id ainsi que les enregistrements associés dans les autres tables
|
||||
$sql_patch="DELETE FROM ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_PACKAGE_PREFIX."backup WHERE backup_id=".$id;
|
||||
$sql_file="DELETE FROM ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_PACKAGE_PREFIX."backupfile WHERE backup_id=".$id;
|
||||
@ -490,13 +481,13 @@ class backup
|
||||
{
|
||||
$backupDB = new backupDb();
|
||||
|
||||
# Backup de la DB
|
||||
# Backup de la DB
|
||||
if (!$backupDB->createBackupDb($GLOBALS["CONF_DATA_PATH"]."data/backup/", $installName."-".$backupId.".sql"))
|
||||
{
|
||||
return "InvalidBackupDb";
|
||||
}else{
|
||||
if ($chmod!="")
|
||||
@chmod(($GLOBALS["CONF_DATA_PATH"]."data/backup/".$installName."-".$backupId.".sql"), $chmod);
|
||||
@chmod(($GLOBALS["CONF_DATA_PATH"]."data/backup/".$installName."-".$backupId.".sql"), $chmod);
|
||||
$this->stockDb($backupId, $installName."-".$backupId.".sql");
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class BackupDb
|
||||
* @param chaine nom de la base de données
|
||||
* @return booleen
|
||||
*/
|
||||
function create($type, $host,$login,$password,$chemin,$nom_fichier,$db, $chmod=0775)
|
||||
function create($type, $host, $login, $password, $chemin, $nom_fichier, $db, $chmod=0775)
|
||||
{
|
||||
if (file_exists($GLOBALS["CONF_LIB_PATH"]."lib/package/backup/".strtolower($type)."backupdb.php"))
|
||||
{
|
||||
@ -124,10 +124,10 @@ class BackupDb
|
||||
* @param chaine nom de la base de données
|
||||
* @return booleen
|
||||
*/
|
||||
function createBackupDb($chemin,$nom_fichier)
|
||||
function createBackupDb($chemin, $nom_fichier)
|
||||
{
|
||||
if (defined("DATA_SOURCE_SQL_TYPE")){
|
||||
return BackupDb::create(DATA_SOURCE_SQL_TYPE, DATA_SOURCE_SQL_SERVER, DATA_SOURCE_SQL_USER, DATA_SOURCE_SQL_PASSWORD,$chemin,$nom_fichier, DATA_SOURCE_SQL_DATABASE);
|
||||
if (defined("DATA_SOURCE_DB_TYPE")){
|
||||
return BackupDb::create(DATA_SOURCE_DB_TYPE, DATA_SOURCE_DB_SERVER, DATA_SOURCE_DB_USER, DATA_SOURCE_DB_PASSWORD, $chemin, $nom_fichier, DATA_SOURCE_DB_DATABASE);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
265
lib/package/backup/mysqlbackupdb.php
Executable file
265
lib/package/backup/mysqlbackupdb.php
Executable file
@ -0,0 +1,265 @@
|
||||
<?php
|
||||
|
||||
/**-----------------------------------------------
|
||||
*
|
||||
* Rooty, 2018 <rooty@rooty.me>
|
||||
*
|
||||
*
|
||||
* This software is protected by copyright, please
|
||||
* read the file COPYRIGHT.
|
||||
* This program is distributed in the hope that it
|
||||
* will be useful, but without any warranty; without
|
||||
* even the implied warranty of merchantability or
|
||||
* fitness for a particular purpose. Please
|
||||
* read the file LICENCE.
|
||||
*
|
||||
* Ce fichier contient la gestion de BackupDb (Factory+Modéle)
|
||||
*
|
||||
* @author Rooty <www.rooty.me|rooty@rooty.me>
|
||||
* @since 2005/03/11
|
||||
* @link www.rooty.me
|
||||
* @version 0.3
|
||||
* @package package
|
||||
* @subpackage BackupDb
|
||||
* @copyright Copyright © 2009-2018, Rooty
|
||||
*/
|
||||
|
||||
if ( !defined('SYSTEM_IN') )
|
||||
{
|
||||
die("Hacking attempt");
|
||||
}
|
||||
|
||||
/**
|
||||
* Inclusion des éléments de parsage sql (sqlParse)
|
||||
*/
|
||||
include_once($GLOBALS["CONF_LIB_PATH"]."lib/system/system_data_source/database/sql_parse.php");
|
||||
|
||||
/**
|
||||
* Classe MysqlBackupDb
|
||||
*classe de gestion des BackupDb (BD) pour mysql
|
||||
* @package package
|
||||
* @subpackage BackupDb
|
||||
*/
|
||||
class MysqlBackUpDb extends CommonBackupDb
|
||||
{
|
||||
|
||||
//
|
||||
// Constructeur (non surchargé!!)
|
||||
//
|
||||
|
||||
/**
|
||||
* Liste les tables pour une BD
|
||||
* @param chaine nom de la BD
|
||||
*/
|
||||
function getListTables($db)
|
||||
{
|
||||
$i = 0;
|
||||
$nbtab = $GLOBALS["SYSTEM_DATABASE_CONN"]->sql_query("show tables");
|
||||
while ($row = $nbtab->fetch(PDO::FETCH_NUM)) {
|
||||
$tb_names[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
return $tb_names;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupération des données pour une table
|
||||
* @param chaine nom de la table
|
||||
* @param entier pointeur de fichier
|
||||
*/
|
||||
function getTableData($table, $fd)
|
||||
{
|
||||
$tableau = array ();
|
||||
$j = 0;
|
||||
$resultat = $GLOBALS["SYSTEM_DATABASE_CONN"]->sql_query("select * from $table");
|
||||
|
||||
if ($resultat == FALSE)
|
||||
{
|
||||
return "La requete dans la table '".$table."' a echoue.<br>";
|
||||
} else {
|
||||
while ($valeurs = $resultat->fetch(PDO::FETCH_NUM))
|
||||
{
|
||||
$this->writeLine($valeurs, $table, $fd);
|
||||
}
|
||||
return $valeurs;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* recuperation de la structure de la table
|
||||
* @param chaine nom de la table
|
||||
* @param entier pointeur de fichier
|
||||
*/
|
||||
function getTableStructure($struct, $fd)
|
||||
{
|
||||
$requete = $GLOBALS["SYSTEM_DATABASE_CONN"]->sql_query("show create table $struct");
|
||||
|
||||
if ($requete == FALSE)
|
||||
{
|
||||
return "la recuperation de la structure '".$struct."' a echoue.<br>";
|
||||
} else {
|
||||
$structure = $GLOBALS["SYSTEM_DATABASE_CONN"]->sql_fetchrow();
|
||||
$ligne = 0;
|
||||
return $structure[1];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* recuperation de la structure de la table
|
||||
* @param chaine chaine sql de création de table
|
||||
* @param chaine nom de la table
|
||||
* @param entier pointeur de fichier
|
||||
*/
|
||||
function putStructIntoFile ($structure, $nom_table, $fd)
|
||||
{
|
||||
$struct = "#\n# Structure de la table ".$nom_table."\n#\n\n";
|
||||
# Ajout de l'énnonçé DROP TABLE...
|
||||
$struct .="DROP TABLE IF EXISTS `".$nom_table."`;\n";
|
||||
$struct .= $structure;
|
||||
$struct .= ";\n\n";
|
||||
$ecriture = fwrite ($fd, $struct, strlen ($struct));
|
||||
|
||||
if ($ecriture == 0)
|
||||
{
|
||||
return "erreur lors de l'ecriture de la strucuture dans le fichier de sauvgarde.";
|
||||
}
|
||||
else{
|
||||
return $fd;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* integre les donnees dans un fichier
|
||||
* @param chaine données à insérer
|
||||
* @param chaine nom de la table
|
||||
* @param entier pointeur de fichier
|
||||
*/
|
||||
function putDataIntoFile ($donnees, $nom_table, $fd)
|
||||
{
|
||||
$lignes = 0;
|
||||
$infos = "#\n# donnees de la table ".$nom_table ."\n#\n\n";
|
||||
fwrite ($fd, $infos, strlen ($infos));
|
||||
|
||||
while (isset ($donnees[$lignes]))
|
||||
{
|
||||
$appel_fonction = $this->writeLine($donnees[$lignes], $nom_table, $fd);
|
||||
$lignes++;
|
||||
}
|
||||
return $fd;
|
||||
}
|
||||
|
||||
/**
|
||||
* écrit une ligne de données
|
||||
* @param chaine données à insérer
|
||||
* @param chaine nom de la table
|
||||
* @param entier pointeur de fichier
|
||||
*/
|
||||
function writeLine ($donnees, $nom_table, $fd)
|
||||
{
|
||||
$case = 1;
|
||||
$debut = "INSERT INTO `".$nom_table."` VALUES ('".$donnees[0]."'";
|
||||
fwrite ($fd, $debut, strlen ($debut));
|
||||
|
||||
while (isset ($donnees[$case])){
|
||||
fwrite ($fd, ", '".addslashes($donnees[$case])."'", strlen (", '".addslashes($donnees[$case])."'"));
|
||||
$case++;
|
||||
}
|
||||
$fin = ");\n\n\n";
|
||||
fwrite ($fd, $fin, strlen ($fin));
|
||||
}
|
||||
|
||||
/**
|
||||
* Création d'une sauvegarde
|
||||
* @todo ne gére pas les enregistrement dont un champs peut être null :-(
|
||||
* @return booleen
|
||||
*/
|
||||
function backup()
|
||||
{
|
||||
# Récupération des paramètres
|
||||
$host=$this->host;
|
||||
$login=$this->login;
|
||||
$password=$this->passwd;
|
||||
$chemin=$this->path;
|
||||
$nom_fichier=$this->file;
|
||||
$db=$this->db;
|
||||
$emplacement = $chemin."/".$nom_fichier;
|
||||
|
||||
if (!isset ($chemin) || !is_dir ($chemin)){
|
||||
addError(2,"MysqlBackupDb", " $chemin n'est pas un repertoire ou n'existe pas.", __line__, __file__);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file_exists ($nom_fichier)){
|
||||
addError(2,"MysqlBackupDb","Impossible de faire la sauvegarde, le fichier $nom_fichier existe deja.", __line__, __file__);
|
||||
return false;
|
||||
}else{
|
||||
$list = $this->getListTables ($db);
|
||||
$tab = 0;
|
||||
$fd = fopen ($emplacement, "w+");
|
||||
|
||||
while (isset ($list[$tab]))
|
||||
{
|
||||
$structure = $this->getTableStructure ($list[$tab], $fd);
|
||||
$backup = $this->putStructIntoFile ($structure, $list[$tab], $fd);
|
||||
$query = $this->getTableData ($list[$tab], $fd);
|
||||
$backup_suite = $this->putDataIntoFile ($query, $list[$tab], $fd);
|
||||
$tab++;
|
||||
}
|
||||
fclose ($fd);
|
||||
chmod($emplacement, $this->perm);
|
||||
|
||||
$directory = $chemin."/";
|
||||
$name_zip = substr ( $nom_fichier, 0,strpos($nom_fichier, "."));
|
||||
$name = $nom_fichier;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Réstauration d'une sauvegarde
|
||||
* @return booleen
|
||||
*/
|
||||
function restore()
|
||||
{
|
||||
# Récupération des paramètres
|
||||
$host=$this->host;
|
||||
$login=$this->login;
|
||||
$password=$this->passwd;
|
||||
$chemin=$this->path;
|
||||
$nom_fichier=$this->file;
|
||||
$db=$this->db;
|
||||
$emplacement = $chemin."/".$nom_fichier;
|
||||
|
||||
if (!isset ($chemin) || !is_dir ($chemin)){
|
||||
addError(2,"MysqlBackupDb", " $chemin n'est pas un repertoire ou n'existe pas.", __line__, __file__);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!file_exists ($emplacement)){
|
||||
addError(2,"MysqlBackupDb","Impossible d'executer le fichier $nom_fichier n'existe pas.", __line__, __file__);
|
||||
return false;
|
||||
}else{
|
||||
$connect = mysql_connect($host, $login, $password);
|
||||
mysql_select_db($db, $connect);
|
||||
$sql_query = @fread(@fopen($emplacement, 'r'), @filesize($emplacement));
|
||||
$sql_query = remove_remarks($sql_query);
|
||||
$sql_query = split_sql_file($sql_query, ";");
|
||||
$sql_query = make_path($sql_query);
|
||||
|
||||
for ($i = 0; $i < sizeof($sql_query); $i++)
|
||||
{
|
||||
if (trim($sql_query[$i]) != '')
|
||||
{
|
||||
if (!($result = mysql_query($sql_query[$i],$connect)))
|
||||
{
|
||||
addError(2,"MysqlBackupDb","Impossible d'executer le fichier $nom_fichier n'existe pas.", __line__, __file__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user