本文整理汇总了PHP中Magento\Framework\Filesystem\Directory\WriteInterface::isReadable方法的典型用法代码示例。如果您正苦于以下问题:PHP WriteInterface::isReadable方法的具体用法?PHP WriteInterface::isReadable怎么用?PHP WriteInterface::isReadable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Filesystem\Directory\WriteInterface
的用法示例。
在下文中一共展示了WriteInterface::isReadable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setTmpDir
/**
* Set TMP file path prefix
*
* @param string $path
* @return bool
*/
public function setTmpDir($path)
{
if (is_string($path) && $this->_directory->isReadable($path)) {
$this->_tmpDir = $path;
return true;
}
return false;
}
示例2: enableCacheTypes
/**
* Enables apppropriate cache types in app/etc/env.php based on the passed in $cacheTypes array
* TODO: to be removed in scope of MAGETWO-53476
*
* @param string[]
*
* @return void
*/
private function enableCacheTypes($cacheTypes)
{
if (empty($cacheTypes)) {
return;
}
$envPath = $this->getEnvPath();
if ($this->write->isReadable($this->write->getRelativePath($envPath))) {
$envData = (include $envPath);
foreach ($cacheTypes as $cacheType) {
if (isset($envData['cache_types'][$cacheType])) {
$envData['cache_types'][$cacheType] = 1;
}
}
$formatter = new PhpFormatter();
$contents = $formatter->format($envData);
$this->write->writeFile($this->write->getRelativePath($envPath), $contents);
if (function_exists('opcache_invalidate')) {
opcache_invalidate($this->write->getAbsolutePath($envPath));
}
}
}
示例3: launch
/**
* Run application
*
* @return Response
* @throws \LogicException
*/
public function launch()
{
if ($this->mediaDirectoryPath !== $this->directory->getAbsolutePath()) {
// Path to media directory changed or absent - update the config
/** @var \Magento\MediaStorage\Model\File\Storage\Config $config */
$config = $this->configFactory->create(['cacheFile' => $this->configCacheFile]);
$config->save();
$this->mediaDirectoryPath = $config->getMediaDirectory();
$allowedResources = $config->getAllowedResources();
$isAllowed = $this->isAllowed;
if (!$isAllowed($this->relativeFileName, $allowedResources)) {
throw new \LogicException('The specified path is not allowed.');
}
}
/** @var \Magento\MediaStorage\Model\File\Storage\Synchronization $sync */
$sync = $this->syncFactory->create(['directory' => $this->directory]);
$sync->synchronize($this->relativeFileName);
if ($this->directory->isReadable($this->relativeFileName)) {
$this->response->setFilePath($this->directory->getAbsolutePath($this->relativeFileName));
} else {
$this->response->setHttpResponseCode(404);
}
return $this->response;
}
示例4: isReadableDirectory
/**
* Checks if directory exists and is readable
*
* @param \Magento\Framework\Filesystem\Directory\WriteInterface $directory
* @return bool
*/
protected function isReadableDirectory($directory)
{
if (!$directory->isExist() || !$directory->isDirectory() || !$directory->isReadable()) {
return false;
}
return true;
}
示例5: _isCanProcessed
/**
* @param string $relativePath
* @return bool
*/
protected function _isCanProcessed($relativePath)
{
$filePath = $this->_rootDir->getAbsolutePath($relativePath);
return strpos($this->_rootDir->getDriver()->getRealPath($filePath), $relativePath) !== false && $this->_rootDir->isFile($relativePath) && $this->_rootDir->isReadable($relativePath) || $this->_processDatabaseFile($filePath, $relativePath);
}
示例6: isDbAvailable
/**
* @param string $dbCode
* @return bool
*/
public function isDbAvailable($dbCode)
{
$dbPath = $this->getDbPath($dbCode);
return $dbPath && $this->directory->isFile($dbPath) && $this->directory->isReadable($dbPath);
}
示例7: _isCanProcessed
/**
* @param string $relativePath
* @return bool
*/
protected function _isCanProcessed($relativePath)
{
$filePath = $this->_rootDir->getAbsolutePath($relativePath);
return (!$this->_rootDir->isFile($relativePath) || !$this->_rootDir->isReadable($relativePath)) && !$this->_processDatabaseFile($filePath);
}
示例8: _isCanProcessed
/**
* @param string $relativePath
* @return bool
*/
protected function _isCanProcessed($relativePath)
{
$filePath = $this->_rootDir->getAbsolutePath($relativePath);
$pathWithFixedSeparator = str_replace('\\', '/', $this->_rootDir->getDriver()->getRealPath($filePath));
return strpos($pathWithFixedSeparator, $relativePath) !== false && $this->_rootDir->isFile($relativePath) && $this->_rootDir->isReadable($relativePath) || $this->_processDatabaseFile($filePath, $relativePath);
}