ReadFile($import_file); if ($import_handle->Count() == 0) { $message = $strNoFilesFoundInZip; $show_error_header = TRUE; $error = TRUE; } elseif ($import_handle->GetError(0) != 0) { $message = $strErrorInZipFile . ' ' . $import_handle->GetErrorMsg(0); $show_error_header = TRUE; $error = TRUE; } else { $import_text = $import_handle->GetData(0); } // We don't need to store it further $import_handle = ''; } else { $message = sprintf($strUnsupportedCompressionDetected, $compression); $show_error_header = TRUE; $error = TRUE; } break; case 'none': $import_handle = @fopen($import_file, 'r'); break; default: $message = sprintf($strUnsupportedCompressionDetected, $compression); $show_error_header = TRUE; $error = TRUE; break; } if (!$error && $import_handle === FALSE) { $message = $strFileCouldNotBeRead; $show_error_header = TRUE; $error = TRUE; } } else { if (!isset($import_text) || empty($import_text)) { $message = $strNothingToImport; $show_error_header = TRUE; $error = TRUE; } } // Convert the file's charset if necessary $charset_conversion = FALSE; $reset_charset = FALSE; if (PMA_MYSQL_INT_VERSION < 40100 && $cfg['AllowAnywhereRecoding'] && $allow_recoding && isset($charset_of_file) && $charset_of_file != $charset) { $charset_conversion = TRUE; } else if (PMA_MYSQL_INT_VERSION >= 40100 && isset($charset_of_file) && $charset_of_file != 'utf8') { PMA_DBI_query('SET NAMES \'' . $charset_of_file . '\''); $reset_charset = TRUE; } // Something to skip? if (isset($skip)) { $original_skip = $skip; while ($skip > 0) { PMA_importGetNextChunk($skip < $read_limit ? $skip : $read_limit); $read_multiply = 1; // Disable read progresivity, otherwise we eat all memory! $skip -= $read_limit; } unset($skip); } if (!$error) { // Do the real import require('./libraries/import/' . PMA_securePath($what) . '.php'); } // Cleanup temporary file if ($file_to_unlink != '') { unlink($file_to_unlink); } // Reset charset back, if we did some changes if ($reset_charset) { PMA_DBI_query('SET CHARACTER SET utf8'); PMA_DBI_query('SET SESSION collation_connection =\'' . $collation_connection . '\''); } if ($finished && !$error) { $message = $strImportFinished; } if ($timeout_passed) { $message = $strTimeoutPassed; if ($offset == 0 || (isset($original_skip) && $original_skip == $offset)) { $message .= ' ' . $strTimeoutNothingParsed; } } // Display back import page require_once('./header.inc.php'); // There was an error? if (isset($my_die)) { foreach ($my_die AS $key => $die) { PMA_mysqlDie($die['error'], $die['sql'], '', $err_url, $error); echo '