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


PHP Varien_Io_File::cp方法代码示例

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


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

示例1: rotateLogs

 /**
  * Rotate all files in var/log which ends with .log
  */
 public function rotateLogs()
 {
     $var = Mage::getBaseDir('log');
     $logDir = new Varien_Io_File();
     $logDir->cd($var);
     $logFiles = $logDir->ls(Varien_Io_File::GREP_FILES);
     foreach ($logFiles as $logFile) {
         if ($logFile['filetype'] == 'log') {
             $filename = $logFile['text'];
             if (extension_loaded('zlib')) {
                 $zipname = $var . DS . $this->getArchiveName($filename);
                 $zip = gzopen($zipname, 'wb9');
                 gzwrite($zip, $logDir->read($filename));
                 gzclose($zip);
             } else {
                 $logDir->cp($filename, $this->getArchiveName($filename));
             }
             foreach ($this->getFilesOlderThan(self::MAX_FILE_DAYS, $var, $filename) as $oldFile) {
                 $logDir->rm($oldFile['text']);
             }
             $logDir->rm($filename);
         }
     }
     $logDir->close();
 }
开发者ID:kirchbergerknorr,项目名称:firegento-logger,代码行数:28,代码来源:Observer.php

示例2: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $fixtureDir = dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files';
     Mage::app()->getConfig()->getOptions()->setDesignDir($fixtureDir . DIRECTORY_SEPARATOR . 'design');
     Varien_Io_File::rmdirRecursive(Mage::app()->getConfig()->getOptions()->getMediaDir() . '/skin');
     $ioAdapter = new Varien_Io_File();
     $ioAdapter->cp(Mage::app()->getConfig()->getOptions()->getJsDir() . '/prototype/prototype.js', Mage::app()->getConfig()->getOptions()->getJsDir() . '/prototype/prototype.min.js');
     self::$_developerMode = Mage::getIsDeveloperMode();
 }
开发者ID:rorteg,项目名称:magento2,代码行数:9,代码来源:PackageTest.php

示例3: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $mediaDir = Mage::app()->getConfig()->getOptions()->getMediaDir();
     $filesystem = Mage::getObjectManager()->create('Magento_Filesystem');
     $filesystem->delete($mediaDir . '/theme/frontend');
     $filesystem->delete($mediaDir . '/theme/_merged');
     $ioAdapter = new Varien_Io_File();
     $ioAdapter->cp(Mage::app()->getConfig()->getOptions()->getJsDir() . '/prototype/prototype.js', Mage::app()->getConfig()->getOptions()->getJsDir() . '/prototype/prototype.min.js');
     self::$_developerMode = Mage::getIsDeveloperMode();
 }
开发者ID:natxetee,项目名称:magento2,代码行数:10,代码来源:PackageTest.php

示例4: 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

示例5: _copyImage

 protected function _copyImage($file)
 {
     try {
         $ioObject = new Varien_Io_File();
         $destDirectory = dirname($this->_getConfig()->getMediaPath($file));
         $ioObject->open(array('path' => $destDirectory));
         $destFile = $this->_getUniqueFileName($file, $ioObject->dirsep());
         if (!$ioObject->fileExists($this->_getConfig()->getMediaPath($file), true)) {
             throw new Exception('File not exists');
         }
         if ($this->_checkDb()) {
             Mage::helper('core/file_storage_database')->copyFile($this->_getConfig()->getMediaShortUrl($file), $this->_getConfig()->getMediaShortUrl($destFile));
             $ioObject->rm($this->_getConfig()->getMediaPath($destFile));
         } else {
             $ioObject->cp($this->_getConfig()->getMediaPath($file), $this->_getConfig()->getMediaPath($destFile));
         }
     } catch (Exception $e) {
         $file = $this->_getConfig()->getMediaPath($file);
         Mage::throwException(Mage::helper('ampaction')->__('Failed to copy file %s. Please, delete media with non-existing images and try again.', $file));
         $e = $e;
         // for zend debugger
     }
     return str_replace($ioObject->dirsep(), '/', $destFile);
 }
开发者ID:jokusafet,项目名称:MagentoSource,代码行数:24,代码来源:Copyimg.php

示例6: getCustomSizeImageUrl

 /**
  * Retrieve custom size image url
  *
  * @param string $imageFile
  * @param int $width
  * @param int $height
  * @return string|bool
  */
 public function getCustomSizeImageUrl($imageFile, $width = 100, $height = 100)
 {
     /** @var $imageHelper Mage_XmlConnect_Helper_Image */
     $imageHelper = Mage::helper('xmlconnect/image');
     $screenSize = $width . 'x' . $height;
     $customDir = $imageHelper->getMediaPath('custom' . DS . $screenSize);
     $ioFile = new Varien_Io_File();
     $ioFile->checkAndCreateFolder($customDir);
     $filePath = self::getBasePath() . DS . $imageFile;
     $isImagePng = true;
     if (!$ioFile->fileExists($filePath)) {
         return false;
     }
     $originalImageType = $this->_getImageType($filePath);
     if ($originalImageType !== IMAGETYPE_PNG) {
         $imageFile = $this->_convertFileExtensionToPng($imageFile);
         $isImagePng = false;
     }
     $customSizeFile = $customDir . DS . $imageFile;
     if (!file_exists($customSizeFile)) {
         if (!$isImagePng) {
             $filePath = $this->_forcedConvertPng($filePath, $customSizeFile, $originalImageType);
         }
         $image = new Varien_Image($filePath);
         $widthOriginal = $image->getOriginalWidth();
         $heightOriginal = $image->getOriginalHeight();
         if ($width != $widthOriginal) {
             $widthOriginal = $width;
         }
         if ($height != $heightOriginal) {
             $heightOriginal = $height;
         }
         if ($widthOriginal != $image->getOriginalWidth() || $heightOriginal != $image->getOriginalHeight()) {
             $image->keepTransparency(true);
             $image->keepFrame(true);
             $image->keepAspectRatio(true);
             $image->backgroundColor(array(0, 0, 0));
             $image->resize($widthOriginal, $heightOriginal);
             $image->save($customDir, basename($imageFile));
         } else {
             $ioFile->cp($filePath, $customSizeFile);
         }
     }
     return $imageHelper->getMediaUrl("custom/{$screenSize}/" . basename($imageFile));
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:53,代码来源:Images.php

示例7: _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

示例8: saveRow


//.........这里部分代码省略.........
        #print_r($filearrayforimport);
        if (isset($filearrayforimport)) {
            $filecounterinternall = 1;
            foreach ($filearrayforimport as $fileinfo) {
                $document_directory = Mage::getBaseDir('media') . DS . 'import' . DS;
                $files = $fileinfo['file'];
                #echo "FILE: " . $fileinfo['file'];
                #echo "ID: " . $product->getId();
                $resource = Mage::getSingleton('core/resource');
                $prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
                $write = $resource->getConnection('core_write');
                $read = $resource->getConnection('core_read');
                $select_qry = $read->query("SHOW TABLE STATUS LIKE '" . $prefix . "downloadable_link' ");
                $row = $select_qry->fetch();
                $next_id = $row['Auto_increment'];
                $okvalueformodelID = $next_id - $filecounterinternall;
                #echo "next_id: " . $okvalueformodelID;
                $linkModel = Mage::getModel('downloadable/link')->load($okvalueformodelID);
                $link_file = $document_directory . $files;
                $file = realpath($link_file);
                if (!$file || !file_exists($file)) {
                    Mage::throwException(Mage::helper('catalog')->__('Link  file ' . $file . ' not exists'));
                }
                $pathinfo = pathinfo($file);
                $linkfile = Varien_File_Uploader::getCorrectFileName($pathinfo['basename']);
                $dispretionPath = Varien_File_Uploader::getDispretionPath($linkfile);
                $linkfile = $dispretionPath . DS . $linkfile;
                $linkfile = $dispretionPath . DS . Varien_File_Uploader::getNewFileName(Mage_Downloadable_Model_Link::getBasePath() . DS . $linkfile);
                $ioAdapter = new Varien_Io_File();
                $ioAdapter->setAllowCreateFolders(true);
                $distanationDirectory = dirname(Mage_Downloadable_Model_Link::getBasePath() . DS . $linkfile);
                try {
                    $ioAdapter->open(array('path' => $distanationDirectory));
                    $ioAdapter->cp($file, Mage_Downloadable_Model_Link::getBasePath() . DS . $linkfile);
                    $ioAdapter->chmod(Mage_Downloadable_Model_Link::getBasePath() . DS . $linkfile, 0777);
                } catch (Exception $e) {
                    Mage::throwException(Mage::helper('catalog')->__('Failed to move file: %s', $e->getMessage()));
                    Mage::log(sprintf('failed to move file: %s', $e->getMessage()), null, 'ce_product_import_export_errors.log');
                }
                $linkfile = str_replace(DS, '/', $linkfile);
                #echo "SET: " . $linkfile;
                $linkModel->setLinkFile($linkfile);
                $linkModel->save();
                $intesdf = $next_id - $filecounterinternall;
                $write->query("UPDATE `" . $prefix . "downloadable_link_title` SET title = '" . $fileinfo['name'] . "' WHERE link_id = '" . $intesdf . "'");
                $write->query("UPDATE `" . $prefix . "downloadable_link_price` SET price = '" . $fileinfo['price'] . "' WHERE link_id = '" . $intesdf . "'");
                #$product->setLinksPurchasedSeparately(false);
                #$product->setLinksPurchasedSeparately(0);
                $filecounterinternall++;
            }
        }
        /* END DOWNLOADBLE METHOD */
        /* SAMPLE FILE DOWNLOADBLE PRODUCT SAMPLE FILE METHOD START */
        #print_r($filenameforsamplearrayforimport);
        if (isset($filenameforsamplearrayforimport)) {
            $filecounterinternall = 1;
            foreach ($filenameforsamplearrayforimport as $fileinfo) {
                $document_directory = Mage::getBaseDir('media') . DS . 'import';
                $samplefiles = $fileinfo['file'];
                #print_r($filenameforsamplearrayforimport);
                #echo "ID: " . $fileinfo['name'] ."<br/>";
                $resource = Mage::getSingleton('core/resource');
                $prefix = Mage::getConfig()->getNode('global/resources/db/table_prefix');
                $write = $resource->getConnection('core_write');
                $read = $resource->getConnection('core_read');
                $select_qry = $read->query("SHOW TABLE STATUS LIKE '" . $prefix . "downloadable_link' ");
开发者ID:,项目名称:,代码行数:67,代码来源:

示例9: addImage

 /**
  * Add image to media gallery and return new filename
  *
  * @param Mage_Catalog_Model_Product $product
  * @param string                     $file              file path of image in file system
  * @param string|array               $mediaAttribute    code of attribute with type 'media_image',
  *                                                      leave blank if image should be only in gallery
  * @param boolean                    $move              if true, it will move source file
  * @param boolean                    $exclude           mark image as disabled in product page view
  * @return string
  */
 public function addImage(Mage_Catalog_Model_Product $product, $file, $mediaAttribute = null, $move = false, $exclude = true)
 {
     $file = realpath($file);
     if (!$file || !file_exists($file)) {
         Mage::throwException(Mage::helper('catalog')->__('Image does not exist.'));
     }
     Mage::dispatchEvent('catalog_product_media_add_image', array('product' => $product, 'image' => $file));
     $pathinfo = pathinfo($file);
     $imgExtensions = array('jpg', 'jpeg', 'gif', 'png');
     if (!isset($pathinfo['extension']) || !in_array(strtolower($pathinfo['extension']), $imgExtensions)) {
         Mage::throwException(Mage::helper('catalog')->__('Invalid image file type.'));
     }
     $fileName = Mage_Core_Model_File_Uploader::getCorrectFileName($pathinfo['basename']);
     $dispretionPath = Mage_Core_Model_File_Uploader::getDispretionPath($fileName);
     $fileName = $dispretionPath . DS . $fileName;
     $fileName = $this->_getNotDuplicatedFilename($fileName, $dispretionPath);
     $ioAdapter = new Varien_Io_File();
     $ioAdapter->setAllowCreateFolders(true);
     $distanationDirectory = dirname($this->_getConfig()->getTmpMediaPath($fileName));
     try {
         $ioAdapter->open(array('path' => $distanationDirectory));
         /** @var $storageHelper Mage_Core_Helper_File_Storage_Database */
         $storageHelper = Mage::helper('core/file_storage_database');
         if ($move) {
             $ioAdapter->mv($file, $this->_getConfig()->getTmpMediaPath($fileName));
             //If this is used, filesystem should be configured properly
             $storageHelper->saveFile($this->_getConfig()->getTmpMediaShortUrl($fileName));
         } else {
             $ioAdapter->cp($file, $this->_getConfig()->getTmpMediaPath($fileName));
             $storageHelper->saveFile($this->_getConfig()->getTmpMediaShortUrl($fileName));
             $ioAdapter->chmod($this->_getConfig()->getTmpMediaPath($fileName), 0777);
         }
     } catch (Exception $e) {
         Mage::throwException(Mage::helper('catalog')->__('Failed to move file: %s', $e->getMessage()));
     }
     $fileName = str_replace(DS, '/', $fileName);
     $attrCode = $this->getAttribute()->getAttributeCode();
     $mediaGalleryData = $product->getData($attrCode);
     $position = 0;
     if (!is_array($mediaGalleryData)) {
         $mediaGalleryData = array('images' => array());
     }
     foreach ($mediaGalleryData['images'] as &$image) {
         if (isset($image['position']) && $image['position'] > $position) {
             $position = $image['position'];
         }
     }
     $position++;
     $mediaGalleryData['images'][] = array('file' => $fileName, 'position' => $position, 'label' => '', 'disabled' => (int) $exclude, 'defaultimg' => (int) $exclude);
     $product->setData($attrCode, $mediaGalleryData);
     if (!is_null($mediaAttribute)) {
         $this->setMediaAttribute($product, $mediaAttribute, $fileName);
     }
     return $fileName;
 }
开发者ID:Madhurabhat,项目名称:test,代码行数:66,代码来源:Media.php

示例10: _copyImage

 /**
  * Copy image and return new filename.
  *
  * @param string $file
  * @return string
  */
 protected function _copyImage($file)
 {
     try {
         $ioObject = new Varien_Io_File();
         $destDirectory = dirname($this->_getConfig()->getMediaPath($file));
         $ioObject->open(array('path' => $destDirectory));
         $destFile = dirname($file) . $ioObject->dirsep() . Varien_File_Uploader::getNewFileName($this->_getConfig()->getMediaPath($file));
         if (!$ioObject->fileExists($this->_getConfig()->getMediaPath($file), true)) {
             throw new Exception();
         }
         $ioObject->cp($this->_getConfig()->getMediaPath($file), $this->_getConfig()->getMediaPath($destFile));
     } catch (Exception $e) {
         Mage::throwException(Mage::helper('catalog')->__('Failed to copy file %s. Please, delete media with non-existing images and try again.', $this->_getConfig()->getMediaPath($file)));
     }
     return str_replace($ioObject->dirsep(), '/', $destFile);
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:22,代码来源:Media.php

示例11: _uploadFile

 /**
  * Decode file from base64 and upload it to donwloadable 'tmp' folder
  *
  * @param array $fileInfo
  * @param string $type
  * @return string
  */
 protected function _uploadFile($fileInfo, $type)
 {
     $tmpPath = '';
     if ($type == 'sample') {
         $tmpPath = Mage_Downloadable_Model_Sample::getBaseTmpPath();
     } elseif ($type == 'link') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseTmpPath();
     } elseif ($type == 'link_samples') {
         $tmpPath = Mage_Downloadable_Model_Link::getBaseSampleTmpPath();
     }
     $result = array();
     $url = $fileInfo['url'];
     $remoteFileName = $fileInfo['name'];
     $ioAdapter = new Varien_Io_File();
     $ioAdapter->checkAndCreateFolder($tmpPath);
     $ioAdapter->open(array('path' => $tmpPath));
     $fileName = $tmpPath . DS . Varien_File_Uploader::getCorrectFileName($remoteFileName);
     if ($ioAdapter->cp($url, $fileName)) {
         Mage::helper('core/file_storage_database')->saveFile($fileName);
     }
     $result['file'] = $remoteFileName;
     $result['status'] = 'new';
     $result['name'] = $remoteFileName;
     return Mage::helper('core')->jsonEncode(array($result));
 }
开发者ID:ksawh,项目名称:retailops_magento,代码行数:32,代码来源:Downloadable.php

示例12: _copyTrustedratingRateusButtonImageToMediaDir

 /**
  * Copying rating button images from skin to media folder
  *
  * @param string      $image    Button image file name
  * @param null|string $language For language specific rating button images
  *
  * @return void
  */
 protected function _copyTrustedratingRateusButtonImageToMediaDir($image, $language = null)
 {
     $src = '';
     $dest = '';
     $src .= $this->_getTrustedratingRateusButtonImageSkinImageDir($language);
     $src .= DS;
     $src .= $image;
     $dest .= $this->_getTrustedratingRateusButtonImageMediaDir();
     $dest .= DS;
     $dest .= $image;
     if (!is_file($dest) && is_file($src)) {
         $ioF = new Varien_Io_File();
         Mage::getSingleton('adminhtml/session')->addNotice($this->getHelper()->__('%s has been copied to the media folder (%s)!', $image, 'media/' . Symmetrics_TrustedRating_Model_Trustedrating::RATEUS_BUTTON_IMAGE_SUBPATH));
         $ioF->cp($src, $dest);
     }
 }
开发者ID:notimplementedyet,项目名称:trustedshops_trustedrating,代码行数:24,代码来源:Button.php

示例13: _processDownloadableProduct

 protected function _processDownloadableProduct($product, &$importData)
 {
     // comment if --------------------------
     //if ($new) {
     $filearrayforimports = array();
     $downloadableitems = array();
     $downloadableitemsoptionscount = 0;
     //THIS IS FOR DOWNLOADABLE OPTIONS
     $commadelimiteddata = explode('|', $importData['downloadable_options']);
     foreach ($commadelimiteddata as $data) {
         $configBundleOptionsCodes = $this->userCSVDataAsArray($data);
         $downloadableitems['link'][$downloadableitemsoptionscount]['is_delete'] = 0;
         $downloadableitems['link'][$downloadableitemsoptionscount]['link_id'] = 0;
         $downloadableitems['link'][$downloadableitemsoptionscount]['title'] = $configBundleOptionsCodes[0];
         $downloadableitems['link'][$downloadableitemsoptionscount]['price'] = $configBundleOptionsCodes[1];
         $downloadableitems['link'][$downloadableitemsoptionscount]['number_of_downloads'] = $configBundleOptionsCodes[2];
         $downloadableitems['link'][$downloadableitemsoptionscount]['is_shareable'] = 2;
         if (isset($configBundleOptionsCodes[5])) {
             #$downloadableitems['link'][$downloadableitemsoptionscount]['sample'] = '';
             $downloadableitems['link'][$downloadableitemsoptionscount]['sample'] = array('file' => '[]', 'type' => 'url', 'url' => '' . $configBundleOptionsCodes[5] . '');
         } else {
             $downloadableitems['link'][$downloadableitemsoptionscount]['sample'] = '';
         }
         $downloadableitems['link'][$downloadableitemsoptionscount]['file'] = '';
         $downloadableitems['link'][$downloadableitemsoptionscount]['type'] = $configBundleOptionsCodes[3];
         #$downloadableitems['link'][$downloadableitemsoptionscount]['link_url'] = $configBundleOptionsCodes[4];
         if ($configBundleOptionsCodes[3] == "file") {
             #$filearrayforimport = array('file'  => 'media/import/mypdf.pdf' , 'name'  => 'asdad.txt', 'size'  => '316', 'status'  => 'old');
             #$document_directory =  Mage :: getBaseDir( 'media' ) . DS . 'import' . DS;
             #echo "DIRECTORY: " . $document_directory;
             #$filearrayforimport = '[{"file": "/home/discou33/public_html/media/import/mypdf.pdf", "name": "mypdf.pdf", "status": "new"}]';
             #$filearrayforimport = '[{"file": "mypdf.pdf", "name": "quickstart.pdf", "size": 324075, "status": "new"}]';
             #$product->setLinksPurchasedSeparately(0);
             #$product->setLinksPurchasedSeparately(false);
             #$files = Zend_Json::decode($filearrayforimport);
             #$files = "mypdf.pdf";
             //--------------- upload file ------------------
             $document_directory = Mage::getBaseDir('media') . DS . 'import' . DS . $this->__vendorName . DS;
             $files = '' . $configBundleOptionsCodes[4] . '';
             $link_file = $document_directory . $files;
             $file = realpath($link_file);
             if (!$file || !file_exists($file)) {
                 Mage::throwException(Mage::helper('catalog')->__($rowInfo . 'Link  file ' . $file . ' not exists'));
             }
             $pathinfo = pathinfo($file);
             $linkfile = Varien_File_Uploader::getCorrectFileName($pathinfo['basename']);
             $dispretionPath = Varien_File_Uploader::getDispretionPath($linkfile);
             $linkfile = $dispretionPath . DS . $linkfile;
             $linkfile = $dispretionPath . DS . Varien_File_Uploader::getNewFileName(Mage_Downloadable_Model_Link::getBaseTmpPath() . DS . $linkfile);
             $ioAdapter = new Varien_Io_File();
             $ioAdapter->setAllowCreateFolders(true);
             $distanationDirectory = dirname(Mage_Downloadable_Model_Link::getBaseTmpPath() . DS . $linkfile);
             try {
                 $ioAdapter->open(array('path' => $distanationDirectory));
                 $ioAdapter->cp($file, Mage_Downloadable_Model_Link::getBaseTmpPath() . DS . $linkfile);
                 $ioAdapter->chmod(Mage_Downloadable_Model_Link::getBaseTmpPath() . DS . $linkfile, 0777);
             } catch (exception $e) {
                 Mage::throwException(Mage::helper('catalog')->__('Failed to move file: %s', $e->getMessage()));
             }
             //{"file": "/2/_/2.jpg", "name": "2.jpg", "size": 23407, "status": "new"}
             $linkfile = str_replace(DS, '/', $linkfile);
             $filearrayforimports = array(array('file' => $linkfile, 'name' => $pathinfo['filename'] . '.' . $pathinfo['extension'], 'status' => 'new', 'size' => filesize($file)));
             if (isset($configBundleOptionsCodes[5])) {
                 if ($configBundleOptionsCodes[5] == 0) {
                     $linkspurchasedstatus = 0;
                     $linkspurchasedstatustext = false;
                 } else {
                     $linkspurchasedstatus = 1;
                     $linkspurchasedstatustext = true;
                 }
                 $product->setLinksPurchasedSeparately($linkspurchasedstatus);
                 $product->setLinksPurchasedSeparately($linkspurchasedstatustext);
             }
             //$downloadableitems['link'][$downloadableitemsoptionscount]['link_file'] = $linkfile;
             $downloadableitems['link'][$downloadableitemsoptionscount]['file'] = Mage::helper('core')->jsonEncode($filearrayforimports);
         } else {
             if ($configBundleOptionsCodes[3] == "url") {
                 $downloadableitems['link'][$downloadableitemsoptionscount]['link_url'] = $configBundleOptionsCodes[4];
             }
         }
         $downloadableitems['link'][$downloadableitemsoptionscount]['sort_order'] = 0;
         $product->setDownloadableData($downloadableitems);
         $downloadableitemsoptionscount += 1;
     }
     #print_r($downloadableitems);
     //}
 }
开发者ID:hyhoocchan,项目名称:extension,代码行数:87,代码来源:Productimport.php

示例14: _testFileSize

 protected function _testFileSize($testFile, $line)
 {
     $mediaDir = Mage::getBaseDir('media') . '/';
     $fileName = 'am_sitemap_test' . rand(1, 1000) . '.xml';
     $io = new Varien_Io_File();
     $io->cp($testFile, $mediaDir . $fileName);
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $mediaDir));
     $io->streamOpen($fileName, 'a+');
     $io->streamWrite($line);
     $io->streamWrite('</urlset>');
     $io->streamClose();
     $fileSize = filesize($mediaDir . $fileName);
     unlink($mediaDir . $fileName);
     return $fileSize;
 }
开发者ID:xiaoguizhidao,项目名称:cupboardglasspipes.ecomitize.com,代码行数:16,代码来源:Sitemap.php

示例15: resetTheme

 /**
  * Reset themes color changes
  * Copy /xmlconnect/etc/themes/* to media/xmlconnect/themes/*
  *
  * @throws Mage_Core_Exception
  * @param null $theme
  * @return null
  */
 public function resetTheme($theme = null)
 {
     $themeDir = $this->getMediaThemePath();
     $defaultThemeDir = $this->_getDefaultThemePath();
     $ioFile = new Varien_Io_File();
     $ioFile->open(array('path' => $defaultThemeDir));
     $fileList = $ioFile->ls(Varien_Io_File::GREP_FILES);
     foreach ($fileList as $file) {
         $f = $file['text'];
         $src = $defaultThemeDir . DS . $f;
         $dst = $themeDir . DS . $f;
         if ($theme && $theme . '.xml' != $f) {
             continue;
         }
         if (!$ioFile->cp($src, $dst)) {
             Mage::throwException(Mage::helper('xmlconnect')->__('Can\'t copy file "%s" to "%s".', $src, $dst));
         } else {
             $ioFile->chmod($dst, 0755);
         }
     }
 }
开发者ID:quyip8818,项目名称:Mag,代码行数:29,代码来源:Theme.php


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