本文整理汇总了PHP中wcf\util\FileUtil::isApacheModule方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::isApacheModule方法的具体用法?PHP FileUtil::isApacheModule怎么用?PHP FileUtil::isApacheModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wcf\util\FileUtil
的用法示例。
在下文中一共展示了FileUtil::isApacheModule方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extract
/**
* @see wcf\system\io\IArchive::extract()
*/
public function extract($offset, $destination)
{
if (!is_int($offset)) {
$offset = $this->getIndexByFilename($offset);
}
try {
$file = $this->readFile($offset);
} catch (SystemException $e) {
return false;
}
FileUtil::makePath(dirname($destination));
if ($file['header']['type'] === 'folder') {
FileUtil::makePath($destination);
return;
}
$targetFile = new File($destination);
$targetFile->write($file['content'], strlen($file['content']));
$targetFile->close();
if (FileUtil::isApacheModule() || !@$targetFile->is_writable()) {
@$targetFile->chmod(0777);
} else {
@$targetFile->chmod(0755);
}
if ($file['header']['mtime']) {
@$targetFile->touch($file['header']['mtime']);
}
// check filesize
if (filesize($destination) != $file['header']['size']) {
throw new SystemException("Could not unzip file '" . $file['header']['filename'] . "' to '" . $destination . "'. Maybe disk quota exceeded in folder '" . dirname($destination) . "'.");
}
return true;
}
示例2: extract
/**
* @see wcf\system\io\IArchive::extract()
*/
public function extract($index, $destination)
{
if (!$this->read) {
$this->open();
$this->readContent();
}
$header = $this->getFileInfo($index);
FileUtil::makePath(dirname($destination));
if ($header['type'] === 'folder') {
FileUtil::makePath($destination);
return;
}
// seek to offset
$this->file->seek($header['offset']);
$targetFile = new File($destination);
// read data
$n = floor($header['size'] / 512);
for ($i = 0; $i < $n; $i++) {
$content = $this->file->read(512);
$targetFile->write($content, 512);
}
if ($header['size'] % 512 != 0) {
$content = $this->file->read(512);
$targetFile->write($content, $header['size'] % 512);
}
$targetFile->close();
if (FileUtil::isApacheModule() || !@$targetFile->is_writable()) {
@$targetFile->chmod(0777);
} else {
@$targetFile->chmod(0755);
}
if ($header['mtime']) {
@$targetFile->touch($header['mtime']);
}
// check filesize
if (filesize($destination) != $header['size']) {
throw new SystemException("Could not untar file '" . $header['filename'] . "' to '" . $destination . "'. Maybe disk quota exceeded in folder '" . dirname($destination) . "'.");
}
return true;
}
示例3: createFile
/**
* Creates a file in the target directory.
*
* @param string $file
* @param integer $index
* @param Tar $tar
*/
protected function createFile($file, $index, Tar $tar)
{
$tar->extract($index, $this->targetDir . $file);
if (FileUtil::isApacheModule() || !is_writeable($this->targetDir . $file)) {
$this->makeWriteable($this->targetDir . $file);
}
}