本文整理汇总了PHP中PMA_gzencodeNeeded函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_gzencodeNeeded函数的具体用法?PHP PMA_gzencodeNeeded怎么用?PHP PMA_gzencodeNeeded使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_gzencodeNeeded函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_compressExport
/**
* Compress the export buffer
*
* @param string $dump_buffer the current dump buffer
* @param string $compression the compression mode
* @param string $filename the filename
*
* @return object $message a message object (or empty string)
*/
function PMA_compressExport($dump_buffer, $compression, $filename)
{
if ($compression == 'zip' && @function_exists('gzcompress')) {
$zipfile = new ZipFile();
$zipfile->addFile($dump_buffer, substr($filename, 0, -4));
$dump_buffer = $zipfile->file();
} elseif ($compression == 'gzip' && PMA_gzencodeNeeded()) {
// without the optional parameter level because it bugs
$dump_buffer = gzencode($dump_buffer);
}
return $dump_buffer;
}
示例2: PMA_compressExport
/**
* Compress the export buffer
*
* @param string $dump_buffer the current dump buffer
* @param string $compression the compression mode
* @param string $filename the filename
*
* @return object $message a message object (or empty string)
*/
function PMA_compressExport($dump_buffer, $compression, $filename)
{
if ($compression == 'zip' && @function_exists('gzcompress')) {
$filename = substr($filename, 0, -4);
// remove extension (.zip)
$zipfile = new ZipFile();
if (is_array($dump_buffer)) {
foreach ($dump_buffer as $table => $dump) {
$ext_pos = strpos($filename, '.');
$extension = substr($filename, $ext_pos);
$zipfile->addFile($dump, str_replace($extension, '_' . $table . $extension, $filename));
}
} else {
$zipfile->addFile($dump_buffer, $filename);
}
$dump_buffer = $zipfile->file();
} elseif ($compression == 'gzip' && PMA_gzencodeNeeded()) {
// without the optional parameter level because it bugs
$dump_buffer = gzencode($dump_buffer);
}
return $dump_buffer;
}
示例3: PMA_exportOutputHandler
/**
* Output handler for all exports, if needed buffering, it stores data into
* $dump_buffer, otherwise it prints thems out.
*
* @param string $line the insert statement
*
* @return bool Whether output succeeded
*/
function PMA_exportOutputHandler($line)
{
global $time_start, $dump_buffer, $dump_buffer_len, $save_filename;
// Kanji encoding convert feature
if ($GLOBALS['output_kanji_conversion']) {
$line = PMA_kanji_str_conv($line, $GLOBALS['knjenc'], isset($GLOBALS['xkana']) ? $GLOBALS['xkana'] : '');
}
// If we have to buffer data, we will perform everything at once at the end
if ($GLOBALS['buffer_needed']) {
$dump_buffer .= $line;
if ($GLOBALS['onfly_compression']) {
$dump_buffer_len += strlen($line);
if ($dump_buffer_len > $GLOBALS['memory_limit']) {
if ($GLOBALS['output_charset_conversion']) {
$dump_buffer = PMA_convert_string('utf-8', $GLOBALS['charset_of_file'], $dump_buffer);
}
// as bzipped
if ($GLOBALS['compression'] == 'bzip2' && @function_exists('bzcompress')) {
$dump_buffer = bzcompress($dump_buffer);
} elseif ($GLOBALS['compression'] == 'gzip' && PMA_gzencodeNeeded()) {
// as a gzipped file
// without the optional parameter level because it bugs
$dump_buffer = gzencode($dump_buffer);
}
if ($GLOBALS['save_on_server']) {
$write_result = @fwrite($GLOBALS['file_handle'], $dump_buffer);
if (!$write_result || $write_result != strlen($dump_buffer)) {
$GLOBALS['message'] = PMA_Message::error(__('Insufficient space to save the file %s.'));
$GLOBALS['message']->addParam($save_filename);
return false;
}
} else {
echo $dump_buffer;
}
$dump_buffer = '';
$dump_buffer_len = 0;
}
} else {
$time_now = time();
if ($time_start >= $time_now + 30) {
$time_start = $time_now;
header('X-pmaPing: Pong');
}
// end if
}
} else {
if ($GLOBALS['asfile']) {
if ($GLOBALS['output_charset_conversion']) {
$line = PMA_convert_string('utf-8', $GLOBALS['charset_of_file'], $line);
}
if ($GLOBALS['save_on_server'] && strlen($line) > 0) {
$write_result = @fwrite($GLOBALS['file_handle'], $line);
if (!$write_result || $write_result != strlen($line)) {
$GLOBALS['message'] = PMA_Message::error(__('Insufficient space to save the file %s.'));
$GLOBALS['message']->addParam($save_filename);
return false;
}
$time_now = time();
if ($time_start >= $time_now + 30) {
$time_start = $time_now;
header('X-pmaPing: Pong');
}
// end if
} else {
// We export as file - output normally
echo $line;
}
} else {
// We export as html - replace special chars
echo htmlspecialchars($line);
}
}
return true;
}