本文整理汇总了PHP中stream_get_wrappers函数的典型用法代码示例。如果您正苦于以下问题:PHP stream_get_wrappers函数的具体用法?PHP stream_get_wrappers怎么用?PHP stream_get_wrappers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stream_get_wrappers函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
if (in_array('sfImageSource', stream_get_wrappers())) {
stream_wrapper_unregister('sfImageSource');
}
stream_wrapper_register('sfImageSource', 'sfImageSourceMock') or die('Failed to register protocol..');
}
示例2: writeFile
/**
* Write content to file
* @param string $path
* @param string $content
*/
protected function writeFile($path, $content)
{
if (!in_array(SafeStream::PROTOCOL, stream_get_wrappers())) {
SafeStream::register();
}
file_put_contents("safe://" . $path, $content);
}
示例3: __construct
/**
* Creates an ImportXMLReader drawing from the source provided
* @param ImportSource $source
* @param Config $config
*/
function __construct(ImportSource $source, Config $config = null)
{
$this->reader = new XMLReader();
if (!$config) {
wfDeprecated(__METHOD__ . ' without a Config instance', '1.25');
$config = ConfigFactory::getDefaultInstance()->makeConfig('main');
}
$this->config = $config;
if (!in_array('uploadsource', stream_get_wrappers())) {
stream_wrapper_register('uploadsource', 'UploadSourceAdapter');
}
$id = UploadSourceAdapter::registerSource($source);
if (defined('LIBXML_PARSEHUGE')) {
$this->reader->open("uploadsource://{$id}", null, LIBXML_PARSEHUGE);
} else {
$this->reader->open("uploadsource://{$id}");
}
// Default callbacks
$this->setPageCallback(array($this, 'beforeImportPage'));
$this->setRevisionCallback(array($this, "importRevision"));
$this->setUploadCallback(array($this, 'importUpload'));
$this->setLogItemCallback(array($this, 'importLogItem'));
$this->setPageOutCallback(array($this, 'finishImportPage'));
$this->importTitleFactory = new NaiveImportTitleFactory();
}
示例4: __construct
/**
* Constructor
*
* @param string $streamWrapperClassName
*/
public function __construct($streamWrapperClassName)
{
$registered = in_array(self::WRAPPER, stream_get_wrappers());
if (!$registered) {
stream_wrapper_register(self::WRAPPER, $streamWrapperClassName);
}
}
示例5: __construct
function __construct()
{
parent::__construct();
$gz = in_array('compress.zlib', stream_get_wrappers()) ? 'ok' : '(disabled; requires PHP zlib module)';
$bz2 = in_array('compress.bzip2', stream_get_wrappers()) ? 'ok' : '(disabled; requires PHP bzip2 module)';
$this->mDescription = <<<TEXT
This script reads pages from an XML file as produced from Special:Export or
dumpBackup.php, and saves them into the current wiki.
Compressed XML files may be read directly:
.gz {$gz}
.bz2 {$bz2}
.7z (if 7za executable is in PATH)
Note that for very large data sets, importDump.php may be slow; there are
alternate methods which can be much faster for full site restoration:
<https://www.mediawiki.org/wiki/Manual:Importing_XML_dumps>
TEXT;
$this->stderr = fopen("php://stderr", "wt");
$this->addOption('report', 'Report position and speed after every n pages processed', false, true);
$this->addOption('namespaces', 'Import only the pages from namespaces belonging to the list of ' . 'pipe-separated namespace names or namespace indexes', false, true);
$this->addOption('dry-run', 'Parse dump without actually importing pages');
$this->addOption('debug', 'Output extra verbose debug information');
$this->addOption('uploads', 'Process file upload data if included (experimental)');
$this->addOption('no-updates', 'Disable link table updates. Is faster but leaves the wiki in an inconsistent state');
$this->addOption('image-base-path', 'Import files from a specified path', false, true);
$this->addArg('file', 'Dump file to import [else use stdin]', false);
}
示例6: unregisterWrapper
public static function unregisterWrapper()
{
$existed = in_array('stack', stream_get_wrappers());
if ($existed) {
stream_wrapper_unregister('stack');
}
}
示例7: unregister
/**
* unregisters vfsStreamWrapper
*/
public static function unregister()
{
if (in_array(vfsStream::SCHEME, stream_get_wrappers()) === true) {
stream_wrapper_unregister(vfsStream::SCHEME);
}
self::$registered = false;
}
示例8: register
public static function register()
{
if (in_array('phpspec', stream_get_wrappers())) {
stream_wrapper_unregister('phpspec');
}
stream_wrapper_register('phpspec', 'PhpSpec\\Loader\\StreamWrapper');
}
示例9: __construct
/**
* HubUpdater constructor.
* @param array|string $option
* @throws \Exception
*/
public function __construct($option)
{
if (!in_array('https', stream_get_wrappers())) {
throw new \Exception("No HTTPS Wrapper Exception");
}
$this->setOptions($option);
$this->options['save'] = rtrim($this->options['save'], '/');
if ($this->options['save'] !== '') {
$this->options['save'] .= '/';
if (!file_exists($this->options['save'])) {
mkdir($this->options['save']);
}
}
$this->options['cache'] = $this->options['save'] . rtrim($this->options['cache'], '/');
if ($this->options['cache'] !== '') {
$this->options['cache'] .= '/';
if (!file_exists($this->options['cache'])) {
mkdir($this->options['cache']);
}
}
$this->cachedInfo = new CacheOneFile($this->options['cache'] . $this->options['cacheFile'], $this->options['holdTime']);
$additionalHeader = '';
if ($this->options['auth']) {
$additionalHeader .= "Authorization: Basic " . base64_encode($this->options['auth']) . "\r\n";
}
$caFilePath = CaBundle::getSystemCaRootBundlePath();
$this->streamContext = stream_context_create(array('http' => array('header' => "User-Agent: Awesome-Update-My-Self-" . $this->options['name'] . "\r\n" . "Accept: application/vnd.github.v3+json\r\n" . $additionalHeader), 'ssl' => array('cafile' => $caFilePath, 'verify_peer' => true)));
$this->streamContext2 = stream_context_create(array('http' => array('header' => "User-Agent: Awesome-Update-My-Self-" . $this->options['name'] . "\r\n" . $additionalHeader), 'ssl' => array('cafile' => $caFilePath, 'verify_peer' => true)));
$this->allRelease = $this->getRemoteInfo();
}
示例10: __construct
/**
* TODO don't hardcode pool, use params
* TODO check rados extensions are available
* @param $params
*/
public function __construct($params)
{
$this->pool = 'owncloud';
if (!in_array("rados", stream_get_wrappers())) {
stream_wrapper_register("rados", '\\OCA\\Rados\\RadosStream');
}
}
示例11: register
/**
* Register the GridFS stream wrapper.
*/
public static function register()
{
if (in_array('gridfs', stream_get_wrappers())) {
stream_wrapper_unregister('gridfs');
}
stream_wrapper_register('gridfs', get_called_class(), \STREAM_IS_URL);
}
示例12: __construct
/**
* Constructs CustomURIResolver from scheme prefix string (e.g. "arg" or "http").
* @param string $scheme Scheme prefix string
*/
function __construct($scheme)
{
$this->scheme = $scheme;
if (!in_array($scheme, stream_get_wrappers())) {
stream_wrapper_register($scheme, "StringStream") or die("Failed to register '" . $scheme . "'");
}
}
示例13: get_last_log
function get_last_log($path = '')
{
global $config_logfile_maxsize, $neue_datei, $log_file_number, $config_log_zlib;
$name = split_log_name();
$ext = $name['ext'];
$name = $name['name'];
$i = 0;
$neue_datei = false;
while (is_file($path . $name . $i . $ext) || is_file($path . $name . $i . $ext . '.gz')) {
$i++;
}
$i--;
@($log_size = filesize($path . $name . $i . $ext) / 1000);
if (!is_dir(dirname($path . $name))) {
return false;
}
if ($i == -1 || $config_logfile_maxsize !== false && $log_size >= $config_logfile_maxsize) {
if ($config_log_zlib && in_array('compress.zlib', stream_get_wrappers())) {
// compress old file
$fh_compressed = fopen('compress.zlib://' . $path . $name . $i . $ext . '.gz', 'w');
fwrite($fh_compressed, file_get_contents($path . $name . $i . $ext));
fclose($fh_compressed);
unlink($path . $name . $i . $ext);
}
$i++;
$neue_log = fopen($path . $name . $i . $ext, 'w');
fclose($neue_log);
$neue_datei = true;
}
$log_file_number = $i;
return $path . $name . $i . $ext;
}
示例14: registerStreamWrapper
/**
* Register a stream wrapper according to its scheme and class.
* Must called prior the opening of first stream under this scheme
*/
public static function registerStreamWrapper()
{
if (in_array(static::SCHEME, stream_get_wrappers())) {
stream_wrapper_unregister(static::SCHEME);
}
stream_register_wrapper(static::SCHEME, get_called_class());
}
示例15: unregisterWhenNotRegistered
/**
* Unregistering while not registers won't fail.
*
* @test
*/
public function unregisterWhenNotRegistered()
{
// Unregister possible registered URL wrapper.
vfsStreamWrapper::unregister();
$this->assertNotContains(vfsStream::SCHEME, stream_get_wrappers());
vfsStreamWrapper::unregister();
}