当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Io_File::fileExists方法代码示例

本文整理汇总了PHP中Varien_Io_File::fileExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Io_File::fileExists方法的具体用法?PHP Varien_Io_File::fileExists怎么用?PHP Varien_Io_File::fileExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Io_File的用法示例。


在下文中一共展示了Varien_Io_File::fileExists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: open

 protected function open($write = false)
 {
     $ioAdapter = new Varien_Io_File();
     try {
         $path = $ioAdapter->getCleanPath($this->getPath());
         $ioAdapter->checkAndCreateFolder($path);
         $filePath = $path . DS . $this->getFileName();
     } catch (Exception $e) {
         Mage::helper('mailchimp')->addException($e);
     }
     if ($write && $ioAdapter->fileExists($filePath)) {
         $ioAdapter->rm($filePath);
     }
     if (!$write && !$ioAdapter->fileExists($filePath)) {
         $message = Mage::helper('mailchimp')->__('File "%s" does not exist.', $this->getFileName());
         Mage::getSingleton('adminhtml/session')->addError($this->__('Mailchimp General Error: ') . $message);
     }
     $mode = $write ? 'wb' . self::COMPRESS_RATE : 'rb';
     try {
         $this->_handler = gzopen($filePath, $mode);
     } catch (Exception $e) {
         Mage::helper('mailchimp')->addException($e);
     }
     return $this;
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:25,代码来源:BulkSynchro.php

示例2: createIndexSitemapFile

 /**
  * Create additional xml index file with links to other xml files (if number of them more than 1)
  */
 public function createIndexSitemapFile()
 {
     if (sizeof($this->filenamesForIndexSitemap) > 1) {
         $io = new Varien_Io_File();
         $io->setAllowCreateFolders(true);
         $io->open(array('path' => $this->getPath()));
         $fileToCreate = Mage::helper('ascurl')->insertStringToFilename($this->getSitemapFilename(), '_index');
         if ($io->fileExists($fileToCreate) && !$io->isWriteable($fileToCreate)) {
             Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $fileToCreate, $this->getPath()));
         }
         $io->streamOpen($fileToCreate);
         $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
         $io->streamWrite('<sitemapindex ' . self::URLSET . '>');
         $storeId = $this->getStoreId();
         $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
         $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
         $path = $this->getSitemapPath();
         $fullPath = preg_replace('/(?<=[^:])\\/{2,}/', '/', $baseUrl . $path);
         foreach ($this->filenamesForIndexSitemap as $item) {
             $xml = sprintf('<sitemap><loc>%s</loc><lastmod>%s</lastmod></sitemap>', htmlspecialchars($fullPath . $item), $date);
             $io->streamWrite($xml);
         }
         $io->streamWrite('</sitemapindex>');
         $io->streamClose();
     }
 }
开发者ID:rubenjohne,项目名称:ts-echo,代码行数:29,代码来源:Sitemap.php

示例3: _beforeSave

 protected function _beforeSave()
 {
     $io = new Varien_Io_File();
     $realPath = $io->getCleanPath($this->getPath());
     /**
      * Check path is allow
      */
     if (!$io->allowedPath($realPath, Mage::getBaseDir())) {
         Mage::throwException(Mage::helper('sitemap')->__('Please define correct path'));
     }
     /**
      * Check exists and writeable path
      */
     if (!$io->fileExists($realPath, false)) {
         Mage::throwException(Mage::helper('sitemap')->__('Please create the specified folder "%s" before saving the sitemap.', Mage::helper('core')->htmlEscape($this->getPreparedFilename())));
     }
     if (!$io->isWriteable($realPath)) {
         Mage::throwException(Mage::helper('sitemap')->__('Please make sure that "%s" is writable by web-server.', $this->getPreparedFilename()));
     }
     /**
      * Check allow filename
      */
     if (!preg_match('#\\.xml$#', $this->getSitemapFilename())) {
         $this->setSitemapFilename($this->getSitemapFilename() . '.xml');
     }
     $this->setSitemapPath(rtrim(str_replace(str_replace('\\', '/', Mage::getBaseDir()), '', $realPath), '/') . '/');
     return parent::_beforeSave();
 }
开发者ID:xiaoguizhidao,项目名称:cupboardglasspipes.ecomitize.com,代码行数:28,代码来源:Sitemap.php

示例4: photoExists

 /**
  * @param $orderId
  * @return boolean
  */
 public function photoExists($orderId)
 {
     $dir = $this->getBaseDir();
     $filename = $dir . $orderId . self::TIMION_ORDERPHOTO_EXT;
     $io = new Varien_Io_File();
     return $io->fileExists($filename);
 }
开发者ID:mtimion,项目名称:Timion_Orderphoto,代码行数:11,代码来源:Data.php

示例5: toOptionArray

 public function toOptionArray($exclude = true)
 {
     $result = array();
     $result['Magento'] = array('label' => 'Magento');
     $path = Mage::getModuleDir('', 'Mirasvit_SearchIndex') . DS . 'Model' . DS . 'Index';
     $io = new Varien_Io_File();
     $io->open();
     $io->cd($path);
     foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $space) {
         $io->cd($space['id']);
         foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $module) {
             $io->cd($module['id']);
             foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $entity) {
                 if ($io->fileExists($entity['id'] . DS . 'Index.php', true)) {
                     $indexCode = $space['text'] . '_' . $module['text'] . '_' . $entity['text'];
                     $index = Mage::helper('searchindex/index')->getIndexModel($indexCode);
                     if (is_object($index)) {
                         if ($index->canUse()) {
                             if (!isset($result[$index->getBaseGroup()])) {
                                 $result[$index->getBaseGroup()] = array('label' => $index->getBaseGroup(), 'value' => array());
                             }
                             $result[$index->getBaseGroup()]['value'][] = array('value' => $index->getCode(), 'label' => $index->getBaseTitle());
                         }
                     } else {
                         Mage::throwException('Wrong model for index ' . $indexCode);
                     }
                 }
             }
         }
     }
     return $result;
 }
开发者ID:vishalpatel14,项目名称:indiankalaniketan,代码行数:32,代码来源:Index.php

示例6: uploadFile

 /**
  * Upload file to CDN async
  */
 public function uploadFile()
 {
     $adapter = Mage::getModel('mycdn/adapter');
     if (!$adapter) {
         return;
     }
     $ioObject = new Varien_Io_File();
     $ioObject->setAllowCreateFolders(true);
     $ioObject->open(array('path' => $ioObject->dirname($this->getData('filename'))));
     if (!$ioObject->fileExists($this->getData('filename'), true)) {
         Mage::helper('mycdn')->addLog('[CRON] No file ' . $this->getData('filename'));
         $this->delete();
         return;
     }
     //Mage::helper('mycdn')->addLog('[CRON] processing id = ' . $this->getId());
     //Mage::helper('mycdn')->addLog($this->getData());
     $result = $adapter->uploadFile($this->getData('filename'), $this->getData('uploadname'), $this->getData('content_type'));
     if ($result && $this->getData('delete')) {
         $ioObject->rm($this->getData('filename'));
         Mage::helper('mycdn')->addLog('[DELETE] CRON delete for ' . $this->getData('filename'));
     }
     if ($result) {
         Mage::helper('mycdn')->addLog('[JOB] CRON delete job for ' . $this->getData('filename') . "\n");
         $this->delete();
     }
 }
开发者ID:mygento,项目名称:cdn,代码行数:29,代码来源:Job.php

示例7: generateXml

 public function generateXml()
 {
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $this->getPath()));
     if ($io->fileExists($this->getSitemapFilename()) && !$io->isWriteable($this->getSitemapFilename())) {
         Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getSitemapFilename(), $this->getPath()));
     }
     $io->streamOpen($this->getSitemapFilename());
     $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
     $io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
     $storeId = $this->getStoreId();
     $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
     // Generate filterurl sitemap
     $changefreq = (string) Mage::getStoreConfig('sitemap/category/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/category/priority', $storeId);
     /* @var $collection Flagbit_FilterUrls_Model_Resource_Mysql4_Url_Collection */
     $collection = Mage::getModel('filterurls/url')->getCollection();
     $collection->addFieldToFilter('store_id', $storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getRequestPath()), $date, $changefreq, $priority);
         $io->streamWrite($xml . PHP_EOL);
     }
     $io->streamWrite('</urlset>');
     $io->streamClose();
     $this->setSitemapTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
     $this->save();
     return $this;
 }
开发者ID:konstantins90,项目名称:Magento-FilterUrls,代码行数:30,代码来源:Sitemap.php

示例8: generateXml

 /**
  * Generate XML file
  *
  * @return Mage_Sitemap_Model_Sitemap
  */
 public function generateXml()
 {
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $this->getPath()));
     if ($io->fileExists($this->getSitemapFilename()) && !$io->isWriteable($this->getSitemapFilename())) {
         Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getSitemapFilename(), $this->getPath()));
     }
     $io->streamOpen($this->getSitemapFilename());
     $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
     $io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:content="http://www.google.com/schemas/sitemap-content/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">' . "\n");
     $storeId = $this->getStoreId();
     $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
     // Hans2103 change -> set mediaUrl
     $mediaUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
     $mediaUrl = preg_replace('/^https/', 'http', $mediaUrl);
     /**
      * Generate categories sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/category/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/category/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/catalog_category')->getCollection($storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>' . "\n", htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
         $this->check_counter($io);
     }
     unset($collection);
     /**
      * Generate products sitemap
      */
     /**
      * override to include images in sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/product/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/product/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/catalog_product')->getCollection($storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><image:image><image:loc>%s</image:loc><image:title>%s</image:title></image:image><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority><PageMap xmlns="http://www.google.com/schemas/sitemap-pagemap/1.0"><DataObject type="thumbnail"><Attribute name="name" value="%s"/><Attribute name="src" value="%s"/></DataObject></PageMap></url>' . "\n", htmlspecialchars($baseUrl . $item->getUrl()), htmlspecialchars($mediaUrl . 'catalog/product' . $item->getMedia()), htmlspecialchars($item->getName()), $date, $changefreq, $priority, htmlspecialchars($item->getName()), htmlspecialchars($mediaUrl . 'catalog/product' . $item->getMedia()));
         $io->streamWrite($xml);
     }
     unset($collection);
     /**
      * Generate cms pages sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/page/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/page/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/cms_page')->getCollection($storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>' . "\n", htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
     }
     unset($collection);
     $io->streamWrite('</urlset>');
     $io->streamClose();
     $this->setSitemapTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
     $this->save();
     return $this;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:65,代码来源:Sitemap.php

示例9: generateXml

 /**
  * Generate sitemap XML file - override to dispatch more events
  *
  * @return $this|Mage_Sitemap_Model_Sitemap
  */
 public function generateXml()
 {
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $this->getPath()));
     if ($io->fileExists($this->getSitemapFilename()) && !$io->isWriteable($this->getSitemapFilename())) {
         Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getSitemapFilename(), $this->getPath()));
     }
     $io->streamOpen($this->getSitemapFilename());
     $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
     $io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
     $storeId = $this->getStoreId();
     $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
     /**
      * Generate categories sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/category/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/category/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/catalog_category')->getCollection($storeId);
     $categories = new Varien_Object();
     $categories->setItems($collection);
     Mage::dispatchEvent('sitemap_categories_generating_before', array('collection' => $categories));
     foreach ($categories->getItems() as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
     }
     unset($collection);
     /**
      * Generate products sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/product/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/product/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/catalog_product')->getCollection($storeId);
     $products = new Varien_Object();
     $products->setItems($collection);
     Mage::dispatchEvent('sitemap_products_generating_before', array('collection' => $products));
     foreach ($products->getItems() as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
     }
     unset($collection);
     /**
      * Generate cms pages sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/page/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/page/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/cms_page')->getCollection($storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
     }
     unset($collection);
     $io->streamWrite('</urlset>');
     $io->streamClose();
     $this->setSitemapTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
     $this->save();
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:64,代码来源:Sitemap.php

示例10: viewfileAction

 public function viewfileAction()
 {
     $file = null;
     $plain = false;
     if ($this->getRequest()->getParam('file')) {
         // download file
         $file = Mage::helper('core')->urlDecode($this->getRequest()->getParam('file'));
     } else {
         if ($this->getRequest()->getParam('image')) {
             // show plain image
             $file = Mage::helper('core')->urlDecode($this->getRequest()->getParam('image'));
             $plain = true;
         } else {
             return $this->norouteAction();
         }
     }
     if (strpos($file, 'medma_avatar') !== false) {
         $path = Mage::getBaseDir('media') . DS . 'medma_avatar' . DS;
     } else {
         $path = Mage::getBaseDir('media') . DS . 'customer';
     }
     $ioFile = new Varien_Io_File();
     $ioFile->open(array('path' => $path));
     $fileName = $ioFile->getCleanPath($path . $file);
     $path = $ioFile->getCleanPath($path);
     if ((!$ioFile->fileExists($fileName) || strpos($fileName, $path) !== 0) && !Mage::helper('core/file_storage')->processStorageFile(str_replace('/', DS, $fileName))) {
         return $this->norouteAction();
     }
     if ($plain) {
         $extension = pathinfo($fileName, PATHINFO_EXTENSION);
         switch (strtolower($extension)) {
             case 'gif':
                 $contentType = 'image/gif';
                 break;
             case 'jpg':
                 $contentType = 'image/jpeg';
                 break;
             case 'png':
                 $contentType = 'image/png';
                 break;
             default:
                 $contentType = 'application/octet-stream';
                 break;
         }
         $ioFile->streamOpen($fileName, 'r');
         $contentLength = $ioFile->streamStat('size');
         $contentModify = $ioFile->streamStat('mtime');
         $this->getResponse()->setHttpResponseCode(200)->setHeader('Pragma', 'public', true)->setHeader('Content-type', $contentType, true)->setHeader('Content-Length', $contentLength)->setHeader('Last-Modified', date('r', $contentModify))->clearBody();
         $this->getResponse()->sendHeaders();
         while (false !== ($buffer = $ioFile->streamRead())) {
             echo $buffer;
         }
     } else {
         $name = pathinfo($fileName, PATHINFO_BASENAME);
         $this->_prepareDownloadResponse($name, array('type' => 'filename', 'value' => $fileName));
     }
     exit;
 }
开发者ID:monarcmoso,项目名称:beta2,代码行数:58,代码来源:CustomerController.php

示例11: isFileExists

 public function isFileExists($fileName)
 {
     $ioObject = new Varien_Io_File();
     $ioObject->setAllowCreateFolders(true);
     $ioObject->open(array('path' => $ioObject->dirname($fileName)));
     if ($ioObject->fileExists($fileName, true)) {
         return true;
     }
     return false;
 }
开发者ID:mygento,项目名称:cdn,代码行数:10,代码来源:Data.php

示例12: _rewriteGrid

    protected function _rewriteGrid($blcgClass, $originalClass, $gridType)
    {
        $classParts = explode('_', str_replace($this->_getBlcgClassPrefix(), '', $blcgClass));
        $fileName = array_pop($classParts) . '.php';
        $rewriteDir = dirname(__FILE__) . '/../../../Block/Rewrite/' . implode('/', $classParts);
        $ioFile = new Varien_Io_File();
        $ioFile->setAllowCreateFolders(true);
        $ioFile->checkAndCreateFolder($rewriteDir);
        $ioFile->cd($rewriteDir);
        // Use open() to initialize Varien_Io_File::$_iwd
        // Prevents a warning when chdir() is used without error control in Varien_Io_File::read()
        if ($ioFile->fileExists($fileName, true) && $ioFile->open()) {
            if ($content = $ioFile->read($fileName)) {
                $lines = preg_split('#\\R#', $content, 3);
                $isUpToDate = false;
                if (isset($lines[0]) && isset($lines[1]) && $lines[0] == '<?php' && preg_match('#^// BLCG_REWRITE_CODE_VERSION\\=([0-9]+)$#', $lines[1], $matches)) {
                    if ($matches[1] === strval(self::REWRITE_CODE_VERSION)) {
                        $isUpToDate = true;
                    }
                }
            }
            $ioFile->close();
            if ($isUpToDate) {
                return $this;
            }
        }
        $content = '<?php
// BLCG_REWRITE_CODE_VERSION=' . self::REWRITE_CODE_VERSION . '
// This file was generated automatically. Do not alter its content.

/**
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 *
 * @category   BL
 * @package    BL_CustomGrid
 * @copyright  Copyright (c) ' . date('Y') . ' Benoît Leulliette <benoit.leulliette@gmail.com>
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

';
        $content .= $this->_getRewriteCode($blcgClass, $originalClass, $gridType);
        if (!$ioFile->write($fileName, $content)) {
            Mage::throwException();
        }
        return $this;
    }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:51,代码来源:File.php

示例13: _loadPatchFile

 /**
  * Use to load the patches array with applied patches.
  *
  * @return void
  */
 protected function _loadPatchFile()
 {
     $ioAdapter = new Varien_Io_File();
     if (!$ioAdapter->fileExists($this->patchFile)) {
         return;
     }
     $ioAdapter->open(array('path' => $ioAdapter->dirname($this->patchFile)));
     $ioAdapter->streamOpen($this->patchFile, 'r');
     while ($buffer = $ioAdapter->streamRead()) {
         if (stristr($buffer, '|')) {
             list($date, $patch) = array_map('trim', explode('|', $buffer));
             $this->appliedPatches[] = $patch;
         }
     }
     $ioAdapter->streamClose();
 }
开发者ID:brentwpeterson,项目名称:Philwinkle_AppliedPatches,代码行数:21,代码来源:Patches.php

示例14: _createSitemap

 /**
  * Create new sitemap file
  *
  * @param string $fileName
  * @param string $type
  * @return void
  */
 protected function _createSitemap($fileName = null, $type = self::TYPE_URL)
 {
     if (!$fileName) {
         $this->_sitemapIncrement++;
         $fileName = $this->_getCurrentSitemapFilename($this->_sitemapIncrement);
     }
     $this->_fileHandler = $this->_getFileObject();
     $this->_fileHandler->setAllowCreateFolders(true);
     $path = $this->_fileHandler->getCleanPath($this->_getBaseDir() . $this->getSitemapPath());
     $this->_fileHandler->open(array('path' => $path));
     if ($this->_fileHandler->fileExists($fileName) && !$this->_fileHandler->isWriteable($fileName)) {
         Mage::throwException(Mage::helper('Mage_Sitemap_Helper_Data')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writable by web server.', $fileName, $path));
     }
     $fileHeader = sprintf($this->_tags[$type][self::OPEN_TAG_KEY], $type);
     $this->_fileHandler->streamOpen($fileName);
     $this->_fileHandler->streamWrite($fileHeader);
     $this->_fileSize = strlen($fileHeader . sprintf($this->_tags[$type][self::CLOSE_TAG_KEY], $type));
 }
开发者ID:natxetee,项目名称:magento2,代码行数:25,代码来源:Sitemap.php

示例15: _deactivateModule

 protected function _deactivateModule()
 {
     $file = Mage::getBaseDir('etc') . DS . 'modules' . DS . 'Netzarbeiter_GroupsCatalog.xml';
     $io = new Varien_Io_File();
     if (!$io->fileExists($file)) {
         $message = Mage::helper('netzarbeiter_groupscatalog2')->__("The file app/etc/modules/Netzarbeiter_GroupsCatalog.xml doesn't exist.");
         Mage::throwException($message);
     }
     $xml = simplexml_load_file($file);
     if (in_array((string) $xml->modules->Netzarbeiter_GroupsCatalog->active, array('true', '1'), true)) {
         if (!$io->isWriteable($file)) {
             $message = Mage::helper('netzarbeiter_groupscatalog2')->__('The file app/etc/modules/Netzarbeiter_GroupsCatalog.xml is not writable.<br/>' . 'Please fix it and flush the configuration cache, or deactivate the module manually in that file.');
             Mage::throwException($message);
         }
         $xml->modules->Netzarbeiter_GroupsCatalog->active = 'false';
         $xml->asXML($file);
         Mage::app()->cleanCache(Mage_Core_Model_Config::CACHE_TAG);
     }
 }
开发者ID:gewaechshaus,项目名称:groupscatalog2,代码行数:19,代码来源:Migration.php


注:本文中的Varien_Io_File::fileExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。