本文整理汇总了PHP中File_Archive::appender方法的典型用法代码示例。如果您正苦于以下问题:PHP File_Archive::appender方法的具体用法?PHP File_Archive::appender怎么用?PHP File_Archive::appender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File_Archive
的用法示例。
在下文中一共展示了File_Archive::appender方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _unzipFile
/**
* _unzipFile
*
* @return bool
**/
public function _unzipFile()
{
// local file name
$downloadDirPath = realpath($this->Xupdate->params['temp_path']);
$downloadFilePath = $this->Xupdate->params['temp_path'] . '/' . $this->target_key . '.zip';
$exploredDirPath = realpath($downloadDirPath . '/' . $this->target_key);
if (empty($downloadFilePath)) {
$this->_set_error_log('getDownloadFilePath not found error in: ' . $this->_getDownloadFilePath());
return false;
}
if (!chdir($exploredDirPath)) {
$this->_set_error_log('chdir error in: ' . $exploredDirPath);
return false;
//chdir error
}
File_Archive::extract(File_Archive::read($downloadFilePath . '/'), File_Archive::appender($exploredDirPath));
return true;
}
示例2: cmdUpgrade
/**
* cmdUpgrade()
*
* @param array &$aryPear
* @return void
*/
function cmdUpgrade(&$aryPear)
{
$sFile = BLOCKEN_TMP_DIR . '/BlockenPackage.zip';
$sRet = $aryPear['curl']->execute(BLOCKEN_UPGRADE_URL);
if (PEAR::isError($sRet)) {
echo "Blockenのアップグレードに失敗しました\n";
return;
}
$fpPkg = fopen($sFile, 'wb');
if (!$fpPkg) {
echo "Blockenのアップグレードに失敗しました\n";
return;
}
flock($fpPkg, LOCK_EX);
fwrite($fpPkg, $sRet);
flock($fpPkg, LOCK_UN);
fclose($fpPkg);
File_Archive::extract(File_Archive::read("{$sFile}/"), File_Archive::appender(BLOCKEN_BASE));
unlink($sFile);
$aryOldFile = file(BLOCKEN_BASE . '/config.php');
$aryNewFile = file(BLOCKEN_BASE . '/config.php.default');
$objDiff =& new Text_Diff($aryOldFile, $aryNewFile);
$objRenderer =& new Text_Diff_Renderer_unified();
$sBuff = $objRenderer->render($objDiff);
$fpDiff = fopen(BLOCKEN_BASE . '/config.php.diff', 'w');
if (!$fpDiff) {
echo "Blockenのアップグレードに失敗しました\n";
return;
}
flock($fpDiff, LOCK_EX);
fwrite($fpDiff, $sBuff);
flock($fpDiff, LOCK_UN);
fclose($fpDiff);
chmod(BLOCKEN_BASE . '/config.php.default', 0644);
chmod(BLOCKEN_BASE . '/config.php.diff', 0644);
echo "Blockenのアップグレードが完了しました\n";
echo "configファイルを必要に応じてマージしてください\n";
echo "New Config File: " . BLOCKEN_BASE . "/config.php.default\n";
echo "Diff Config File: " . BLOCKEN_BASE . "/config.php.diff\n";
}
示例3: dirname
/**
* Try to interpret the object as a writer
* Strings are converted to writers using File_Archive::appender
* Arrays are converted to writers using a multi writer
*
* @access private
*/
function &_convertToWriter(&$dest)
{
if (is_string($dest)) {
return File_Archive::appender($dest);
} else {
if (is_array($dest)) {
require_once dirname(__FILE__) . '/Archive/Writer/Multi.php';
$writer = new File_Archive_Writer_Multi();
foreach ($dest as $key => $foo) {
$writer->addWriter($dest[$key]);
}
} else {
return $dest;
}
}
}
示例4: foreach
/**
* Try to interpret the object as a writer
* Strings are converted to writers using File_Archive::appender
* Arrays are converted to writers using a multi writer
*
* @access private
*/
function &_convertToWriter(&$dest)
{
if (is_string($dest)) {
$obj =& File_Archive::appender($dest);
return $obj;
} else {
if (is_array($dest)) {
require_once 'File/Archive/Writer/Multi.php';
$writer = new File_Archive_Writer_Multi();
foreach ($dest as $key => $foo) {
$writer->addWriter($dest[$key]);
}
return $writer;
} else {
return $dest;
}
}
}
示例5: getRestoreArray
/**
* バックアップXMLファイル->リストア配列変換処理
*
* @access public
*/
function getRestoreArray($upload_id, $backup_page_id, $module_id, $temporary_file_path)
{
set_time_limit(BACKUP_TIME_LIMIT);
// メモリ最大サイズ設定
ini_set('memory_limit', -1);
$errorList =& $this->_actionChain->getCurErrorList();
//if($backup_page_id == 0 || $upload_id == 0) {
// // フルバックアップをリストアしようとしている
// $errorList->add("backup", BACKUP_FAILURE_RESTORE);
// return false;
//}
//$uploads = $this->_db->selectExecute("uploads", array("upload_id" => $upload_id, "room_id" => $backup_page_id, "module_id" => $module_id));
$uploads = $this->_db->selectExecute("uploads", array("upload_id" => $upload_id, "module_id" => $module_id));
if ($uploads === false || !isset($uploads[0]) || count($uploads) > 1) {
return false;
}
$uploads_file_path = FILEUPLOADS_DIR . "backup/" . $uploads[0]['physical_file_name'];
if (!file_exists($uploads_file_path)) {
// バックアップファイルなし
$errorList->add("backup", BACKUP_NONE_RESTORE);
return false;
}
if (file_exists($temporary_file_path)) {
// 現在、同じバックアップファイル-リストア中
// エラーとする
$errorList->add("backup", BACKUP_RESTORING);
return false;
}
if (!mkdir($temporary_file_path, 0777)) {
$errorList->add("backup", BACKUP_RESTORE_ERROR);
return false;
}
//
// 解凍
//
File_Archive::extract(File_Archive::read($uploads_file_path . "/"), File_Archive::appender($temporary_file_path));
if (!file_exists($temporary_file_path . BACKUP_ROOM_XML_FILE_NAME)) {
// XMLファイルなし
$this->_fileAction->delDir($temporary_file_path);
$errorList->add("backup", BACKUP_FAILURE_RESTORE);
return false;
}
// PHP 4 > 4.3.0, PHP 5
$xml = file_get_contents($temporary_file_path . BACKUP_ROOM_XML_FILE_NAME);
if ($xml === false) {
$this->_fileAction->delDir($temporary_file_path);
$errorList->add("backup", BACKUP_RESTORE_ERROR);
return false;
}
if (!file_exists($temporary_file_path . BACKUP_ROOM_XML_INI_NAME)) {
// XML INIファイルなし
$this->_fileAction->delDir($temporary_file_path);
$errorList->add("backup", BACKUP_FAILURE_RESTORE);
return false;
}
$xml_ini = file_get_contents($temporary_file_path . BACKUP_ROOM_XML_INI_NAME);
if ($xml_ini === false) {
$this->_fileAction->delDir($temporary_file_path);
$errorList->add("backup", BACKUP_RESTORE_ERROR);
return false;
}
$unserializer =& new XML_Unserializer();
//
// 複合化チェック
//
$result = $unserializer->unserialize($xml_ini);
if ($result !== true) {
$this->_fileAction->delDir($temporary_file_path);
$errorList->add("backup", BACKUP_FAILURE_UNSERIALIZE);
return false;
}
$data_ini = $unserializer->getUnserializedData();
// 共有設定されているかどうか
if ($data_ini["host_field"] == BASE_URL . INDEX_FILE_NAME) {
// 自サイトならば、無条件でOK
$self_flag = true;
} else {
$self_flag = false;
// サイトテーブルにあり、commons_flagが立っているものを許す
$data_ini["host_field"] = preg_replace("/" . preg_quote(INDEX_FILE_NAME, "/") . "\$/i", "", $data_ini["host_field"]);
$where_params = array("url" => $data_ini["host_field"], "commons_flag" => _ON);
// 有効期限がいついつの公開鍵を取得
$other_site = $this->_db->selectExecute("sites", $where_params, null, 1);
if ($other_site === false) {
$this->_fileAction->delDir($temporary_file_path);
$errorList->add("backup", BACKUP_RESTORE_ERROR);
return false;
}
if (!isset($other_site[0])) {
// 共有設定されていない
$this->_fileAction->delDir($temporary_file_path);
$errorList->add("backup", BACKUP_RESTORE_COMMONS_ERROR);
return false;
}
}
//.........这里部分代码省略.........