(PHP 5 >= 5.3.0, PHP 7, PECL phar >= 2.0.0)
はじめに
PharData クラスは、実行可能形式でない tar アーカイブや
zip アーカイブへのアクセスや作成のための高レベルインターフェイスを提供します。
これらのアーカイブにはスタブが含まれておらず、
phar 拡張モジュールから実行することはできません。
そのため、PharData クラスによる通常の zip および tar ファイルの作成や
操作は php.ini の phar.readonly
が 1
であっても可能です。
クラス概要
PharData extends RecursiveDirectoryIterator {
const
int
FilesystemIterator::CURRENT_AS_PATHNAME
= 32
const
int
FilesystemIterator::CURRENT_AS_FILEINFO
= 0
const
int
FilesystemIterator::CURRENT_AS_SELF
= 16
const
int
FilesystemIterator::CURRENT_MODE_MASK
= 240
const
int
FilesystemIterator::KEY_AS_PATHNAME
= 0
const
int
FilesystemIterator::KEY_AS_FILENAME
= 256
const
int
FilesystemIterator::FOLLOW_SYMLINKS
= 512
const
int
FilesystemIterator::KEY_MODE_MASK
= 3840
const
int
FilesystemIterator::NEW_CURRENT_AND_KEY
= 256
const
int
FilesystemIterator::SKIP_DOTS
= 4096
const
int
FilesystemIterator::UNIX_PATHS
= 8192
/* メソッド */
addEmptyDir
( string $dirname
) : void
public Phar::addFile
( string $file
[, string $localname
] ) : void
addFromString
( string $localname
, string $contents
) : void
public Phar::buildFromDirectory
( string $base_dir
[, string $regex
] ) : array
buildFromIterator
( Iterator $iter
[, string $base_directory
] ) : array
compressFiles
( int $compression
) : void
__construct
( string $fname
[, int $flags
[, string $alias
[, int $format
= Phar::TAR
]]] )
convertToData
([ int $format
[, int $compression
[, string $extension
]]] ) : PharData
convertToExecutable
([ int $format
[, int $compression
[, string $extension
]]] ) : Phar
copy
( string $oldfile
, string $newfile
) : bool
decompress
([ string $extension
] ) : PharData
decompressFiles ( ) : bool
delMetadata ( ) : bool
delete
( string $entry
) : bool
extractTo
( string $pathto
[, string|array|null $files
= null
[, bool $overwrite
= false
]] ) : bool
isWritable ( ) : bool
offsetSet
( string $offset
, string $value
) : void
offsetUnset
( string $offset
) : bool
setAlias
( string $alias
) : bool
setDefaultStub
([ string $index
[, string $webindex
]] ) : bool
public Phar::setMetadata
( mixed $metadata
) : void
public Phar::setSignatureAlgorithm
( int $sigtype
) : void
setStub
( string $stub
[, int $len
= -1
] ) : bool
/* 継承したメソッド */
public Phar::addEmptyDir
( string $dirname
) : void
public Phar::addFile
( string $file
[, string $localname
] ) : void
public Phar::addFromString
( string $localname
, string $contents
) : void
final public static Phar::apiVersion ( ) : string
public Phar::buildFromDirectory
( string $base_dir
[, string $regex
] ) : array
public Phar::buildFromIterator
( Iterator $iter
[, string $base_directory
] ) : array
final public static Phar::canCompress
([ int $type
= 0
] ) : bool
final public static Phar::canWrite ( ) : bool
public Phar::compress
( int $compression
[, string $extension
] ) : Phar
public Phar::compressFiles
( int $compression
) : void
public Phar::__construct
( string $fname
[, int $flags
[, string $alias
]] )
public Phar::convertToData
([ int $format
= 9021976
[, int $compression
= 9021976
[, string $extension
]]] ) : PharData
public Phar::convertToExecutable
([ int $format
= 9021976
[, int $compression
= 9021976
[, string $extension
]]] ) : Phar
public Phar::copy
( string $oldfile
, string $newfile
) : bool
public Phar::count ( ) : int
final public static Phar::createDefaultStub
([ string $indexfile
[, string $webindexfile
]] ) : string
public Phar::decompress
([ string $extension
] ) : Phar
public Phar::decompressFiles ( ) : bool
public Phar::delMetadata ( ) : bool
public Phar::delete
( string $entry
) : bool
public Phar::extractTo
( string $pathto
[, string|array|null $files
= null
[, bool $overwrite
= false
]] ) : bool
public Phar::getAlias ( ) : string
public Phar::getMetadata ( ) : mixed
public Phar::getModified ( ) : bool
public Phar::getPath ( ) : string
public Phar::getSignature ( ) : array
public Phar::getStub ( ) : string
final public static Phar::getSupportedCompression ( ) : array
final public static Phar::getSupportedSignatures ( ) : array
public Phar::getVersion ( ) : string
public Phar::hasMetadata ( ) : bool
final public static Phar::interceptFileFuncs ( ) : void
public Phar::isBuffering ( ) : bool
public Phar::isCompressed ( ) : mixed
public Phar::isFileFormat
( int $format
) : bool
final public static Phar::isValidPharFilename
( string $filename
[, bool $executable
= true
] ) : bool
public Phar::isWritable ( ) : bool
final public static Phar::loadPhar
( string $filename
[, string $alias
] ) : bool
final public static Phar::mapPhar
([ string $alias
[, int $dataoffset
= 0
]] ) : bool
final public static Phar::mount
( string $pharpath
, string $externalpath
) : void
final public static Phar::mungServer
( array $munglist
) : void
public Phar::offsetExists
( string $offset
) : bool
public Phar::offsetGet
( string $offset
) : PharFileInfo
public Phar::offsetSet
( string $offset
, string $value
) : void
public Phar::offsetUnset
( string $offset
) : bool
final public static Phar::running
([ bool $retphar
= true
] ) : string
public Phar::setAlias
( string $alias
) : bool
public Phar::setDefaultStub
([ string $index
[, string $webindex
]] ) : bool
public Phar::setMetadata
( mixed $metadata
) : void
public Phar::setSignatureAlgorithm
( int $sigtype
[, string $privatekey
] ) : void
public Phar::setStub
( string $stub
[, int $len
= -1
] ) : bool
public Phar::startBuffering ( ) : void
public Phar::stopBuffering ( ) : void
final public static Phar::unlinkArchive
( string $archive
) : bool
final public static Phar::webPhar
([ string $alias
[, string $index
= "index.php"
[, string $f404
[, array $mimetypes
[, callable $rewrites
]]]]] ) : void
}
目次
- PharData::addEmptyDir — 空のディレクトリを tar/zip アーカイブに追加する
- PharData::addFile — ファイルシステム上のファイルを tar/zip アーカイブに追加する
- PharData::addFromString — ファイルシステム上のファイルを tar/zip アーカイブに追加する
- PharData::buildFromDirectory — ディレクトリ内のファイルから tar/zip アーカイブを作成する
- PharData::buildFromIterator — イテレータから tar あるいは zip アーカイブを作成する
- PharData::compress — tar/zip アーカイブ全体を Gzip あるいは Bzip2 で圧縮する
- PharData::compressFiles — 現在の tar/zip アーカイブ内のすべてのファイルを圧縮する
- PharData::__construct — 実行可能でない tar あるいは zip アーカイブオブジェクトを作成する
- PharData::convertToData — phar アーカイブを実行可能でない tar あるいは zip ファイルに変換する
- PharData::convertToExecutable — 実行可能でない tar/zip アーカイブを実行可能な phar アーカイブ形式に変換する
- PharData::copy — phar アーカイブ内のファイルを、phar 内で別の新しいファイルとしてコピーする
- PharData::decompress — Phar アーカイブ全体の圧縮を解除する
- PharData::decompressFiles — 現在の zip アーカイブ内のすべてのファイルの圧縮を解除する
- PharData::delMetadata — zip アーカイブのグローバルメタデータを削除する
- PharData::delete — tar/zip アーカイブ内のファイルを削除する
- PharData::extractTo — tar/zip アーカイブの内容をディレクトリに展開する
- PharData::isWritable — tar/zip アーカイブが変更可能な場合に true を返す
- PharData::offsetSet — tar/zip の内部のファイルに、外部ファイルあるいは文字列の内容を設定する
- PharData::offsetUnset — ファイルを tar/zip アーカイブから削除する
- PharData::setAlias — ダミー関数 (Phar::setAlias は PharData では使用不能)
- PharData::setDefaultStub — ダミー関数 (Phar::setDefaultStub は PharData では無効)
- Phar::setMetadata — phar アーカイブのメタデータを設定する
- Phar::setSignatureAlgorithm — phar のシグネチャのアルゴリズムを設定する
- PharData::setStub — ダミー関数 (Phar::setStub は PharData では使用不能)
/* 継承した定数 */