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


PHP Varien_Io_File::createDestinationDir方法代码示例

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


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

示例1: prepareFeed

 /**
  * Prepare the feed file and returns its path
  *
  * @param array $productsData
  * @param int $storeId
  * @return string
  */
 public function prepareFeed(array $productsData, $storeId)
 {
     $mId = $this->getVendorConfig('merchant_id', $storeId);
     $company = $this->getVendorConfig('company', $storeId);
     if (!$mId || !$company) {
         Mage::throwException(Mage::helper('productfeed')->__('LinkShare Merchant ID and Company Name must be set.'));
     }
     Varien_Profiler::start('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
     $content = implode(self::DELIMITER, array('HDR', $mId, $company, Mage::getModel('core/date')->date('Y-m-d/H:i:s'))) . self::EOL;
     foreach ($productsData as $row) {
         $content .= $row . self::EOL;
     }
     $filename = $mId . '_nmerchandis' . Mage::getModel('core/date')->date('Ymd') . '.txt';
     $filepath = $this->getFeedStorageDir() . $filename;
     try {
         $ioAdapter = new Varien_Io_File();
         $ioAdapter->setAllowCreateFolders(true);
         $ioAdapter->createDestinationDir($this->getFeedStorageDir());
         $ioAdapter->cd($this->getFeedStorageDir());
         $ioAdapter->streamOpen($filename);
         $ioAdapter->streamWrite($content);
         Varien_Profiler::stop('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
         return $filepath;
     } catch (Exception $e) {
         Varien_Profiler::stop('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
         Mage::throwException(Mage::helper('productfeed')->__('Could not write feed file to path: %s, %s', $filepath, $e->getMessage()));
     }
 }
开发者ID:adrian-green,项目名称:productfeed,代码行数:35,代码来源:LinkShare.php

示例2: prepareFeed

 /**
  * Prepare the feed file and returns its path
  *
  * @param array $productsData
  * @param int $storeId
  * @return string
  */
 public function prepareFeed(array $productsData, $storeId)
 {
     $mId = $this->getVendorConfig('merchant_id', $storeId);
     if (!$mId) {
         Mage::throwException(Mage::helper('productfeed')->__('Rakuten Seller ID must be set.'));
     }
     $filename = 'rakuten_product_' . Mage::getModel('core/date')->date('Ymd') . '.txt';
     $filepath = $this->getFeedStorageDir() . $filename;
     try {
         $ioAdapter = new Varien_Io_File();
         $ioAdapter->setAllowCreateFolders(true);
         $ioAdapter->createDestinationDir($this->getFeedStorageDir());
         $ioAdapter->cd($this->getFeedStorageDir());
         $ioAdapter->streamOpen($filename);
         $ioAdapter->streamWrite(implode(self::DELIMITER, $this->getHeaders()) . "\n");
         foreach ($productsData as $productId => $row) {
             array_unshift($row, $mId);
             $this->prepareRow($row, $productId);
             $ioAdapter->streamWrite(implode(self::DELIMITER, $row) . "\n");
             // because a CSV enclosure is not supported
         }
         return $filepath;
     } catch (Exception $e) {
         Mage::throwException(Mage::helper('productfeed')->__('Could not write feed file to path: %s, %s', $filepath, $e->getMessage()));
     }
 }
开发者ID:adrian-green,项目名称:productfeed,代码行数:33,代码来源:Product.php

示例3: __construct

 /**
  * Set base dir
  *
  * @access public
  * @author Marius Strajeru <ultimate.module.creator@gmail.com>
  */
 public function __construct()
 {
     $this->_baseDir = Mage::getBaseDir('var') . DS . 'modulecreator' . DS . 'package';
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->createDestinationDir($this->_baseDir);
     $this->addTargetDir($this->_baseDir);
 }
开发者ID:cojaco,项目名称:UltimateModuleCreator,代码行数:14,代码来源:Collection.php

示例4: write

 /**
  * Write xml nfe in folder
  *
  * @return true
  */
 public function write()
 {
     // load template array, fill data and convert to XML
     $this->_init()->_addCustomer()->_addItens()->_addOtherInfo()->_toXML();
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->createDestinationDir($this->_path);
     $return = $io->write($this->_path . $this->_getFileName(), $this->_stringFinalXML);
     return true;
 }
开发者ID:robsonximenes,项目名称:magento-nfe-bling,代码行数:15,代码来源:TransformToXML.php

示例5: publish

 /**
  * Publish the specified feed file.
  *
  * @param string $filepath
  * @param array $params
  * @return Grommet_ProductFeed_Model_Feed_Publisher_File
  */
 public function publish($filepath, array $params = array())
 {
     if (empty($params['destination_path'])) {
         throw new Mage_Core_Exception('Invalid parameters - destination_path must be set.');
     }
     $ioAdapter = new Varien_Io_File();
     $ioAdapter->setAllowCreateFolders(true);
     $ioAdapter->createDestinationDir(pathinfo($params['destination_path'], PATHINFO_DIRNAME));
     $writeResult = $ioAdapter->cp($filepath, $params['destination_path']);
     if (!$writeResult) {
         throw new Mage_Core_Exception('Unable to write file ' . $params['destination_path'] . ' to FTP.');
     }
     return $this;
 }
开发者ID:adrian-green,项目名称:productfeed,代码行数:21,代码来源:File.php

示例6: processDailyRefunds

 /**
  * Submit refunds back to LinkShare for reimbursement.
  *
  * @param int $storeId
  * @return Grommet_ProductFeed_Model_Vendor_LinkShare_Refund
  */
 public function processDailyRefunds($storeId)
 {
     $rows = array();
     $ordersProcessed = array();
     // add credit memos to the feed
     $creditmemos = $this->_getCreditMemos($storeId);
     if (count($creditmemos)) {
         foreach ($creditmemos as $creditmemo) {
             $rows = array_merge($rows, $this->creditmemoToFeed($creditmemo));
             $ordersProcessed[] = $creditmemo->getOrderId();
         }
     }
     // add cancelations to the feed
     $orders = $this->_getOrders($storeId, $ordersProcessed);
     if (count($orders)) {
         foreach ($orders as $order) {
             $rows = array_merge($rows, $this->orderToFeed($order));
         }
     }
     if (count($rows)) {
         $mId = $this->getVendorConfig('merchant_id', $storeId);
         if (!$mId) {
             Mage::throwException(Mage::helper('productfeed')->__('LinkShare Merchant ID must be set.'));
         }
         $content = '';
         foreach ($rows as $row) {
             $content .= implode(self::DELIMITER, array_values($row)) . self::EOL;
         }
         $filename = $mId . '_trans' . Mage::getModel('core/date')->date('Ymd') . '.txt';
         $filepath = $this->getFeedStorageDir() . $filename;
         try {
             $ioAdapter = new Varien_Io_File();
             $ioAdapter->setAllowCreateFolders(true);
             $ioAdapter->createDestinationDir($this->getFeedStorageDir());
             $ioAdapter->cd($this->getFeedStorageDir());
             $ioAdapter->streamOpen($filename);
             $ioAdapter->streamWrite($content);
         } catch (Exception $e) {
             Mage::throwException(Mage::helper('productfeed')->__('Could not write refund file to path: %s, %s', $filepath, $e->getMessage()));
         }
         $publisher = $this->getPublisher();
         $publisher->publish($filepath, $this->getPublishParams($storeId));
     }
     return $this;
 }
开发者ID:adrian-green,项目名称:productfeed,代码行数:51,代码来源:Refund.php

示例7: prepareFeed

 /**
  * Prepare the feed file and returns its path
  *
  * @param array $productsData
  * @param int $storeId
  * @return string
  */
 public function prepareFeed(array $productsData, $storeId)
 {
     $filename = 'mediaforge_' . Mage::getModel('core/date')->date('Ymd') . '.csv';
     $filepath = $this->getFeedStorageDir() . $filename;
     try {
         $ioAdapter = new Varien_Io_File();
         $ioAdapter->setAllowCreateFolders(true);
         $ioAdapter->createDestinationDir($this->getFeedStorageDir());
         $ioAdapter->cd($this->getFeedStorageDir());
         $ioAdapter->streamOpen($filename);
         $ioAdapter->streamWriteCsv($this->_fields, self::DELIMITER);
         foreach ($productsData as $row) {
             $ioAdapter->streamWriteCsv($row, self::DELIMITER);
         }
         return $filepath;
     } catch (Exception $e) {
         Mage::throwException(Mage::helper('productfeed')->__('Could not write feed file to path: %s, %s', $filepath, $e->getMessage()));
     }
 }
开发者ID:adrian-green,项目名称:productfeed,代码行数:26,代码来源:MediaForge.php

示例8: prepareFeed

 /**
  * Prepare the feed file and returns its path
  *
  * @param array $productsData
  * @param int $storeId
  * @return string
  */
 public function prepareFeed(array $productsData, $storeId)
 {
     Varien_Profiler::start('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
     $filename = $this->getVendorCode() . '_' . Mage::getModel('core/date')->date('Ymd') . '.json';
     $filepath = $this->getFeedStorageDir() . $filename;
     try {
         $ioAdapter = new Varien_Io_File();
         $ioAdapter->setAllowCreateFolders(true);
         $ioAdapter->createDestinationDir($this->getFeedStorageDir());
         $ioAdapter->cd($this->getFeedStorageDir());
         $ioAdapter->streamOpen($filename);
         $ioAdapter->streamWrite(json_encode($productsData));
         Varien_Profiler::stop('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
         return $filepath;
     } catch (Exception $e) {
         Varien_Profiler::stop('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
         Mage::throwException(Mage::helper('productfeed')->__('Could not write feed file to path: %s, %s', $filepath, $e->getMessage()));
     }
 }
开发者ID:adrian-green,项目名称:productfeed,代码行数:26,代码来源:Tidal.php

示例9: _copy

 protected function _copy($file)
 {
     $ioAdapter = new Varien_Io_File();
     if (!$ioAdapter->fileExists($file)) {
         Mage::throwException(Mage::helper('dataflow')->__('File "%s" does not exist.', $file));
     }
     $ioAdapter->setAllowCreateFolders(true);
     $ioAdapter->createDestinationDir($this->getBatchModel()->getIoAdapter()->getPath());
     return $ioAdapter->cp($file, $this->getBatchModel()->getIoAdapter()->getFile(true));
 }
开发者ID:Airmal,项目名称:Magento-Em,代码行数:10,代码来源:Abstract.php


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