connect_errno) { echo "Echec lors de la connexion à MySQL : (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } $databases = $tables = array(); // --- Uniquement database selectionné if (array_key_exists('database', $options) && !empty($options['database']) ) { $databases[] = $options['database']; } // --- Liste des bases de données else { $result = $link->query('SHOW DATABASES'); while ($row = $result->fetch_assoc()) { $databases[] = $row['Database']; } } $dbExcluded = array( 'mysql', 'information_schema', ); // --- Sauvegarde des bases de données pour chaque table foreach ($databases as $database) { if ( !in_array($database, $dbExcluded) ) { $link->query('USE '.$database); $result = $link->query('SHOW TABLES'); while ($row = $result->fetch_array()) { $table = $row[0]; echo date('Y/m/d - H:i:s') ." - Schema de '$database.$table'"; // --- Dump schema exec( 'mysqldump -h' . $options['host'] .' -u' . $options['user'] .' -p' . $options['pass'] . ' --compact --no-data ' . $database . ' --tables ' . $table . ' | egrep -v "(^SET|^/\*\!)" | sed \'s/ AUTO_INCREMENT=[0-9]*\b//\' > ' . $options['path'] . '/'.$database.'.'.$table.'.sql' ); echo "\n"; } } } // --- Fermeture du lien mysql mysqli_close($link);