Esempio n. 1
0
 /**
  * Return content of default robot.txt
  *
  * @return bool|string
  */
 protected function _getDefaultValue()
 {
     if ($this->_directory->isFile($this->_file)) {
         return $this->_directory->readFile($this->_file);
     }
     return false;
 }
Esempio n. 2
0
 /**
  * @param string $key
  * @return $this
  */
 public function replaceTmpEncryptKey($key)
 {
     $localXml = $this->_configDirectory->readFile($this->_localConfigFile);
     $localXml = str_replace(self::TMP_ENCRYPT_KEY_VALUE, $key, $localXml);
     $this->_configDirectory->writeFile($this->_localConfigFile, $localXml);
     return $this;
 }
 /**
  * Load composer packages available for update from cache
  *
  * @return bool|string
  */
 private function loadPackagesForUpdateFromCache()
 {
     if ($this->directory->isExist($this->pathToCacheFile) && $this->directory->isReadable($this->pathToCacheFile)) {
         try {
             $data = $this->directory->readFile($this->pathToCacheFile);
             return json_decode($data, true);
         } catch (\Magento\Framework\Exception\FileSystemException $e) {
         }
     }
     return false;
 }
Esempio n. 4
0
 /**
  * Add sitemap file to robots.txt
  *
  * @param string $sitemapFileName
  * @return void
  */
 protected function _addSitemapToRobotsTxt($sitemapFileName)
 {
     $robotsSitemapLine = 'Sitemap: ' . $this->getSitemapUrl($this->getSitemapPath(), $sitemapFileName);
     $filename = 'robots.txt';
     $content = '';
     if ($this->_directory->isExist($filename)) {
         $content = $this->_directory->readFile($filename);
     }
     if (strpos($content, $robotsSitemapLine) === false) {
         if (!empty($content)) {
             $content .= $this->_findNewLinesDelimiter($content);
         }
         $content .= $robotsSitemapLine;
     }
     $this->_directory->writeFile($filename, $content);
 }
Esempio n. 5
0
 /**
  * Get contents of export file
  *
  * @return string
  */
 public function getContents()
 {
     return $this->_directoryHandle->readFile($this->_destination);
 }