本文整理汇总了PHP中Magento\Framework\Filesystem\Directory\Write::read方法的典型用法代码示例。如果您正苦于以下问题:PHP Write::read方法的具体用法?PHP Write::read怎么用?PHP Write::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Filesystem\Directory\Write
的用法示例。
在下文中一共展示了Write::read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeDispatch
/**
* Clear temporary directories
*
* @param \Magento\Install\Controller\Index\Index $subject
* @param \Magento\Framework\App\RequestInterface $request
*
* @return void
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function beforeDispatch(\Magento\Install\Controller\Index\Index $subject, \Magento\Framework\App\RequestInterface $request)
{
if (!$this->appState->isInstalled()) {
foreach ($this->varDirectory->read() as $dir) {
if ($this->varDirectory->isDirectory($dir)) {
try {
$this->varDirectory->delete($dir);
} catch (FilesystemException $exception) {
$this->logger->log($exception->getMessage());
}
}
}
}
}
示例2: _deleteFilesRecursively
/**
* Delete all files in a directory recursively
*
* @param string $targetDir
* @return void
*/
protected function _deleteFilesRecursively($targetDir)
{
if ($this->_directory->isExist($targetDir)) {
foreach ($this->_directory->read($targetDir) as $path) {
$this->_directory->delete($path);
}
}
}