本文整理汇总了PHP中Magento\Framework\Filesystem\Directory\Write::touch方法的典型用法代码示例。如果您正苦于以下问题:PHP Write::touch方法的具体用法?PHP Write::touch怎么用?PHP Write::touch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Filesystem\Directory\Write
的用法示例。
在下文中一共展示了Write::touch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleEnable
/**
* @param \Magento\Framework\Filesystem\Directory\Write $flagDir
* @param OutputInterface $output
* @param null $onOption
*/
protected function handleEnable(\Magento\Framework\Filesystem\Directory\Write $flagDir, OutputInterface $output, $onOption = null)
{
$flagDir->touch(MaintenanceMode::FLAG_FILENAME);
$output->writeln(self::ENABLED_MESSAGE);
if (!is_null($onOption)) {
// Write IPs to exclusion file
$flagDir->writeFile(MaintenanceMode::IP_FILENAME, $onOption);
$output->writeln(self::WROTE_IP_MESSAGE);
}
}
示例2: __construct
/**
* Constructor
*
* @param \Magento\Framework\App\Filesystem $filesystem
* @param string|null $destination
* @throws \Magento\Framework\Model\Exception
*/
public function __construct(\Magento\Framework\App\Filesystem $filesystem, $destination = null)
{
$this->_directoryHandle = $filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem::SYS_TMP_DIR);
if (!$destination) {
$destination = uniqid('importexport_');
$this->_directoryHandle->touch($destination);
}
if (!is_string($destination)) {
throw new \Magento\Framework\Model\Exception(__('Destination file path must be a string'));
}
if (!$this->_directoryHandle->isWritable()) {
throw new \Magento\Framework\Model\Exception(__('Destination directory is not writable'));
}
if ($this->_directoryHandle->isFile($destination) && !$this->_directoryHandle->isWritable($destination)) {
throw new \Magento\Framework\Model\Exception(__('Destination file is not writable'));
}
$this->_destination = $destination;
$this->_init();
}
示例3: __construct
/**
* Constructor
*
* @param Filesystem $filesystem
* @param string|null $destination
* @param string $destinationDirectoryCode
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function __construct(\Magento\Framework\Filesystem $filesystem, $destination = null, $destinationDirectoryCode = DirectoryList::SYS_TMP)
{
$this->_directoryHandle = $filesystem->getDirectoryWrite($destinationDirectoryCode);
if (!$destination) {
$destination = uniqid('importexport_');
$this->_directoryHandle->touch($destination);
}
if (!is_string($destination)) {
throw new \Magento\Framework\Exception\LocalizedException(__('The destination file path must be a string.'));
}
if (!$this->_directoryHandle->isWritable()) {
throw new \Magento\Framework\Exception\LocalizedException(__('The destination directory is not writable.'));
}
if ($this->_directoryHandle->isFile($destination) && !$this->_directoryHandle->isWritable($destination)) {
throw new \Magento\Framework\Exception\LocalizedException(__('Destination file is not writable'));
}
$this->_destination = $destination;
$this->_init();
}