PharFileInfo::chmod
(PHP >= 5.3.0, PECL phar >= 1.0.0)
PharFileInfo::chmod — Sets file-specific permission bits
Description
$permissions
)PharFileInfo::chmod() allows setting of the executable file permissions bit, as well as read-only bits. Writeable bits are ignored, and set at runtime based on the phar.readonly INI variable. As with all functionality that modifies the contents of a phar, the phar.readonly INI variable must be off in order to succeed if the file is within a Phar archive. Files within PharData archives do not have this restriction.
Return Values
No value is returned.
Examples
Example #1 A PharFileInfo::chmod() example
<?php
// make sure it doesn't exist
@unlink('brandnewphar.phar');
try {
$p = new Phar('brandnewphar.phar', 0, 'brandnewphar.phar');
$p['file.sh'] = '#!/usr/local/lib/php
<?php echo "hi"; ?>';
// set executable bit
$p['file.sh']->chmod(0555);
var_dump($p['file.sh']->isExecutable());
} catch (Exception $e) {
echo 'Could not create/modify phar: ', $e;
}
?>
The above example will output:
bool(true)
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для сжатия и архивации
- Phar
- Функция PharFileInfo::chmod() - Sets file-specific permission bits
- Функция PharFileInfo::compress() - Compresses the current Phar entry with either zlib or bzip2 compression
- Функция PharFileInfo::__construct() - Construct a Phar entry object
- Функция PharFileInfo::decompress() - Decompresses the current Phar entry within the phar
- Функция PharFileInfo::delMetadata() - Deletes the metadata of the entry
- Функция PharFileInfo::getCRC32() - Returns CRC32 code or throws an exception if CRC has not been verified
- Функция PharFileInfo::getCompressedSize() - Returns the actual size of the file (with compression) inside the Phar archive
- Функция PharFileInfo::getMetadata() - Returns file-specific meta-data saved with a file
- Функция PharFileInfo::getPharFlags() - Returns the Phar file entry flags
- Функция PharFileInfo::hasMetadata() - Returns the metadata of the entry
- Функция PharFileInfo::isCRCChecked() - Returns whether file entry has had its CRC verified
- Функция PharFileInfo::isCompressed() - Returns whether the entry is compressed
- Функция PharFileInfo::isCompressedBZIP2() - Returns whether the entry is compressed using bzip2
- Функция PharFileInfo::isCompressedGZ() - Returns whether the entry is compressed using gz
- Функция PharFileInfo::setCompressedBZIP2() - Compresses the current Phar entry within the phar using Bzip2 compression
- Функция PharFileInfo::setCompressedGZ() - Compresses the current Phar entry within the phar using gz compression
- Функция PharFileInfo::setMetadata() - Sets file-specific meta-data saved with a file
- Функция PharFileInfo::setUncompressed() - Uncompresses the current Phar entry within the phar, if it is compressed
Коментарии
404 Not Found