當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Write::touch方法代碼示例

本文整理匯總了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);
     }
 }
開發者ID:brentwpeterson,項目名稱:n98-magerun2,代碼行數:15,代碼來源:MaintenanceCommand.php

示例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();
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:26,代碼來源:AbstractAdapter.php

示例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();
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:27,代碼來源:AbstractAdapter.php


注:本文中的Magento\Framework\Filesystem\Directory\Write::touch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。