Esempio n. 1
0
 public static function commit_sauvegarde($type_sauvegarde)
 {
     $PHP_SELF = $_SERVER['PHP_SELF'];
     $session = session_id();
     $return = '';
     header("Pragma: no-cache");
     header("Content-Type: text/x-delimtext; name=\"php_conges_" . $type_sauvegarde . ".sql\"");
     header("Content-disposition: attachment; filename=php_conges_" . $type_sauvegarde . ".sql");
     //
     // Build the sql script file...
     //
     $maintenant = date("d-m-Y H:i:s");
     $return .= "#\n";
     $return .= "# PHP_CONGES\n";
     $return .= "#\n# DATE : {$maintenant}\n";
     $return .= "#\n";
     //recup de la liste des tables
     $sql1 = "SHOW TABLES";
     $ReqLog = \includes\SQL::query($sql1);
     while ($resultat = $ReqLog->fetch_array()) {
         $table = $resultat[0];
         $return .= "#\n#\n# TABLE: {$table} \n#\n";
         if ($type_sauvegarde == "all" || $type_sauvegarde == "structure") {
             $return .= "# Struture : \n#\n";
             $return .= \admin\Fonctions::get_table_structure($table);
         }
         if ($type_sauvegarde == "all" || $type_sauvegarde == "data") {
             $return .= "# Data : \n#\n";
             $return .= \admin\Fonctions::get_table_data($table);
         }
     }
     echo $return;
 }