本文整理汇总了PHP中gpFiles::GetRaw方法的典型用法代码示例。如果您正苦于以下问题:PHP gpFiles::GetRaw方法的具体用法?PHP gpFiles::GetRaw怎么用?PHP gpFiles::GetRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gpFiles
的用法示例。
在下文中一共展示了gpFiles::GetRaw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SaveBackup
/**
* Save a backup of the file
*
*/
function SaveBackup()
{
global $dataDir;
$dir = $dataDir . '/data/_backup/pages/' . $this->gp_index;
gpFiles::CheckDir($dir);
$time = time();
if (isset($_REQUEST['revision']) && is_numeric($_REQUEST['revision'])) {
$time = $_REQUEST['revision'];
}
$contents = gpFiles::GetRaw($this->file);
//backup file name
$len = strlen($contents);
$backup_file = $dir . '/' . $time . '.' . $len;
if (isset($this->file_stats['username']) && $this->file_stats['username']) {
$backup_file .= '.' . $this->file_stats['username'];
}
//compress
if (function_exists('gzencode') && function_exists('readgzfile')) {
$backup_file .= '.gze';
$contents = gzencode($contents, 9);
}
gpFiles::Save($backup_file, $contents);
$this->CleanBackupFolder();
}
示例2: SaveBackup
/**
* Save a backup of the file
*
*/
public function SaveBackup()
{
global $dataDir;
$dir = $dataDir . '/data/_backup/pages/' . $this->gp_index;
if ($this->draft_exists) {
$contents = gpFiles::GetRaw($this->draft_file);
$time = $this->draft_stats['modified'];
} else {
$contents = gpFiles::GetRaw($this->file);
$time = $this->file_stats['modified'];
}
//backup file name
$len = strlen($contents);
$backup_file = $dir . '/' . $time . '.' . $len;
if (isset($this->file_stats['username']) && $this->file_stats['username']) {
$backup_file .= '.' . $this->file_stats['username'];
}
//compress
if (function_exists('gzencode') && function_exists('readgzfile')) {
$backup_file .= '.gze';
$contents = gzencode($contents, 9);
}
if (!gpFiles::Save($backup_file, $contents)) {
return false;
}
$this->CleanBackupFolder();
return true;
}