mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-17 23:21:33 +02:00
Don't write out when closing unless a file actually exists ...
git-svn-id: file:///svn/phpbb/trunk@4381 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -86,6 +86,22 @@ class compress
|
|||||||
$this->data($name, $src);
|
$this->data($name, $src);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function methods()
|
||||||
|
{
|
||||||
|
$methods = array('tar');
|
||||||
|
|
||||||
|
foreach (array('tar.gz' => 'zlib', 'tar.bz2' => 'bz2', 'zip' => 'zlib') as $type => $module)
|
||||||
|
{
|
||||||
|
if (!@extension_loaded($module))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$methods[] = $type;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $methods;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zip creation class from phpMyAdmin 2.3.0 <20> Tobias Ratschiller, Olivier M<>ller, Lo<4C>c Chapeaux,
|
// Zip creation class from phpMyAdmin 2.3.0 <20> Tobias Ratschiller, Olivier M<>ller, Lo<4C>c Chapeaux,
|
||||||
@@ -182,10 +198,11 @@ class compress_zip extends compress
|
|||||||
sort($mkdir_ary);
|
sort($mkdir_ary);
|
||||||
foreach ($mkdir_ary as $dir)
|
foreach ($mkdir_ary as $dir)
|
||||||
{
|
{
|
||||||
if (!@mkdir($dir))
|
if (!@mkdir($dir, 0777))
|
||||||
{
|
{
|
||||||
trigger_error("Could not create directory $dir");
|
trigger_error("Could not create directory $dir");
|
||||||
}
|
}
|
||||||
|
@chmod("$dir", 0777);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,6 +236,7 @@ class compress_zip extends compress
|
|||||||
{
|
{
|
||||||
trigger_error("Could not create $filename");
|
trigger_error("Could not create $filename");
|
||||||
}
|
}
|
||||||
|
@chmod($filename, 0777);
|
||||||
|
|
||||||
if (!($gzfp = gzopen($filename . '.gz', 'rb')))
|
if (!($gzfp = gzopen($filename . '.gz', 'rb')))
|
||||||
{
|
{
|
||||||
@@ -239,6 +257,7 @@ class compress_zip extends compress
|
|||||||
{
|
{
|
||||||
trigger_error("Could not create $filename");
|
trigger_error("Could not create $filename");
|
||||||
}
|
}
|
||||||
|
@chmod($filename, 0777);
|
||||||
|
|
||||||
fwrite($fp, fread($this->fp, $seek['uc_size']));
|
fwrite($fp, fread($this->fp, $seek['uc_size']));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
@@ -248,8 +267,11 @@ class compress_zip extends compress
|
|||||||
|
|
||||||
function close()
|
function close()
|
||||||
{
|
{
|
||||||
// Write out central file directory and footer
|
// Write out central file directory and footer ... if it exists
|
||||||
|
if (sizeof($this->ctrl_dir))
|
||||||
|
{
|
||||||
fwrite($this->fp, $this->file());
|
fwrite($this->fp, $this->file());
|
||||||
|
}
|
||||||
fclose($this->fp);
|
fclose($this->fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,10 +417,11 @@ class compress_tar extends compress
|
|||||||
|
|
||||||
if ($filetype == 5)
|
if ($filetype == 5)
|
||||||
{
|
{
|
||||||
if (!@mkdir($dst . $filename))
|
if (!@mkdir("$dst$filename", 0777))
|
||||||
{
|
{
|
||||||
trigger_error("Could not create directory $filename");
|
trigger_error("Could not create directory $filename");
|
||||||
}
|
}
|
||||||
|
@chmod("$dst$filename", 0777);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -406,10 +429,11 @@ class compress_tar extends compress
|
|||||||
$tmp = unpack("A12size", substr($buffer, 124, 12));
|
$tmp = unpack("A12size", substr($buffer, 124, 12));
|
||||||
$filesize = octdec((int) trim($tmp['size']));
|
$filesize = octdec((int) trim($tmp['size']));
|
||||||
|
|
||||||
if (!($fp = fopen($dst . $filename, 'wb')))
|
if (!($fp = fopen("$dst$filename", 'wb')))
|
||||||
{
|
{
|
||||||
trigger_error("Could create file $filename");
|
trigger_error("Could create file $filename");
|
||||||
}
|
}
|
||||||
|
@chmod("$dst$filename", 0777);
|
||||||
|
|
||||||
$size = 0;
|
$size = 0;
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user