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


PHP Varien_Io_File::mkdir方法代码示例

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


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

示例1: _prepareDestination

 /**
  * Create destination folder if not exists and return full file path
  *
  * @throws Exception
  * @param string $destination
  * @param string $newName
  * @return string
  */
 protected function _prepareDestination($destination = null, $newName = null)
 {
     if (empty($destination)) {
         $destination = $this->_fileSrcPath;
     } else {
         if (empty($newName)) {
             $info = pathinfo($destination);
             $newName = $info['basename'];
             $destination = $info['dirname'];
         }
     }
     if (empty($newName)) {
         $newFileName = $this->_fileSrcName;
     } else {
         $newFileName = $newName;
     }
     $fileName = $destination . DIRECTORY_SEPARATOR . $newFileName;
     if (!is_writable($destination)) {
         try {
             $result = $this->_ioFile->mkdir($destination);
         } catch (Exception $e) {
             $result = false;
         }
         if (!$result) {
             throw new Exception('Unable to write file into directory ' . $destination . '. Access forbidden.');
         }
     }
     return $fileName;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:37,代码来源:Abstract.php

示例2: _loadFiles

 protected function _loadFiles()
 {
     if (!$this->_isLoaded) {
         $readPath = Mage::getBaseDir("var") . DS . "backups";
         $ioProxy = new Varien_Io_File();
         try {
             $ioProxy->open(array('path' => $readPath));
         } catch (Exception $e) {
             $ioProxy->mkdir($readPath, 0755);
             $ioProxy->chmod($readPath, 0755);
             $ioProxy->open(array('path' => $readPath));
         }
         if (!is_file($readPath . DS . ".htaccess")) {
             // Deny from reading in browser
             $ioProxy->write(".htaccess", "deny from all", 0644);
         }
         $list = $ioProxy->ls(Varien_Io_File::GREP_FILES);
         $fileExtension = constant($this->_itemObjectClass . "::BACKUP_EXTENSION");
         foreach ($list as $entry) {
             if ($entry['filetype'] == $fileExtension) {
                 $item = new $this->_itemObjectClass();
                 $item->load($entry['text'], $readPath);
                 if ($this->_checkCondition($item)) {
                     $this->addItem($item);
                 }
             }
         }
         $this->_totalRecords = count($this->_items);
         if ($this->_totalRecords > 1) {
             usort($this->_items, array(&$this, 'compareByTypeOrDate'));
         }
         $this->_isLoaded = true;
     }
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:35,代码来源:Collection.php

示例3: save

 /**
  * Write file to file system.
  *
  * @param null $destination
  * @param null $newName
  * @throws Exception
  */
 public function save($destination = null, $newName = null)
 {
     Varien_Profiler::start(__METHOD__);
     if (isset($destination) && isset($newName)) {
         $fileName = $destination . "/" . $newName;
     } elseif (isset($destination) && !isset($newName)) {
         $info = pathinfo($destination);
         $fileName = $destination;
         $destination = $info['dirname'];
     } elseif (!isset($destination) && isset($newName)) {
         $fileName = $this->_fileSrcPath . "/" . $newName;
     } else {
         $fileName = $this->_fileSrcPath . $this->_fileSrcName;
     }
     $destinationDir = isset($destination) ? $destination : $this->_fileSrcPath;
     if (!is_writable($destinationDir)) {
         try {
             $io = new Varien_Io_File();
             $io->mkdir($destination);
         } catch (Exception $e) {
             Varien_Profiler::stop(__METHOD__);
             throw new Exception("Unable to write into directory '{$destinationDir}'.");
         }
     }
     //set compression quality
     $this->getImageMagick()->setImageCompressionQuality($this->getQuality());
     //remove all underlying information
     $this->getImageMagick()->stripImage();
     //write to file system
     $this->getImageMagick()->writeImage($fileName);
     //clear data and free resources
     $this->getImageMagick()->clear();
     $this->getImageMagick()->destroy();
     Varien_Profiler::stop(__METHOD__);
 }
开发者ID:erlisdhima,项目名称:Perfect_Watermarks,代码行数:42,代码来源:Imagemagic.php

示例4: save

 public function save($destination = null, $newName = null)
 {
     $fileName = !isset($destination) ? $this->_fileName : $destination;
     if (isset($destination) && isset($newName)) {
         $fileName = $destination . "/" . $fileName;
     } elseif (isset($destination) && !isset($newName)) {
         $info = pathinfo($destination);
         $fileName = $destination;
         $destination = $info['dirname'];
     } elseif (!isset($destination) && isset($newName)) {
         $fileName = $this->_fileSrcPath . "/" . $newName;
     } else {
         $fileName = $this->_fileSrcPath . $this->_fileSrcName;
     }
     $destinationDir = isset($destination) ? $destination : $this->_fileSrcPath;
     if (!is_writable($destinationDir)) {
         try {
             $io = new Varien_Io_File();
             $io->mkdir($destination);
         } catch (Exception $e) {
             throw new Exception("Unable to write file into directory '{$destinationDir}'. Access forbidden.");
         }
     }
     // keep alpha transparency
     $isAlpha = false;
     $this->_getTransparency($this->_imageHandler, $this->_fileType, $isAlpha);
     if ($isAlpha) {
         $this->_fillBackgroundColor($this->_imageHandler);
     }
     call_user_func($this->_getCallback('output'), $this->_imageHandler, $fileName);
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:31,代码来源:Gd2.php

示例5: writeSampleDataFile

 /**
  * Write Sample Data to File. Store in folder: "skin/frontend/default/ves theme name/import/"
  */
 public function writeSampleDataFile($importDir, $file_name, $content = "")
 {
     $file = new Varien_Io_File();
     //Create import_ready folder
     $error = false;
     if (!file_exists($importDir)) {
         $importReadyDirResult = $file->mkdir($importDir);
         $error = false;
         if (!$importReadyDirResult) {
             //Handle error
             $error = true;
             Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ves_tempcp')->__('Can not create folder "%s".', $importDir));
         }
     } else {
         $file->open(array('path' => $importDir));
     }
     if (!$file->write($importDir . $file_name, $content)) {
         //Handle error
         $error = true;
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ves_tempcp')->__('Can not save import sample file "%s".', $file_name));
     }
     if (!$error) {
         Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('cms')->__('Successfully, Stored sample data file "%s".', $file_name));
     }
     return !$error;
 }
开发者ID:quanghuynt93,项目名称:VesSmartshop,代码行数:29,代码来源:ExportSample.php

示例6: save

 public function save($destination = null, $newName = null)
 {
     $fileName = !isset($destination) ? $this->_fileName : $destination;
     if (isset($destination) && isset($newName)) {
         $fileName = $destination . "/" . $newName;
     } elseif (isset($destination) && !isset($newName)) {
         $info = pathinfo($destination);
         $fileName = $destination;
         $destination = $info['dirname'];
     } elseif (!isset($destination) && isset($newName)) {
         $fileName = $this->_fileSrcPath . "/" . $newName;
     } else {
         $fileName = $this->_fileSrcPath . $this->_fileSrcName;
     }
     $destinationDir = isset($destination) ? $destination : $this->_fileSrcPath;
     if (!is_writable($destinationDir)) {
         try {
             $io = new Varien_Io_File();
             $io->mkdir($destination);
         } catch (Exception $e) {
             throw new Exception("Unable to write file into directory '{$destinationDir}'. Access forbidden.");
         }
     }
     if (!$this->_resized) {
         // keep alpha transparency
         $isAlpha = false;
         $isTrueColor = false;
         $this->_getTransparency($this->_imageHandler, $this->_fileType, $isAlpha, $isTrueColor);
         if ($isAlpha) {
             if ($isTrueColor) {
                 $newImage = imagecreatetruecolor($this->_imageSrcWidth, $this->_imageSrcHeight);
             } else {
                 $newImage = imagecreate($this->_imageSrcWidth, $this->_imageSrcHeight);
             }
             $this->_fillBackgroundColor($newImage);
             imagecopy($newImage, $this->_imageHandler, 0, 0, 0, 0, $this->_imageSrcWidth, $this->_imageSrcHeight);
             $this->_imageHandler = $newImage;
         }
     }
     $functionParameters = array();
     $functionParameters[] = $this->_imageHandler;
     $functionParameters[] = $fileName;
     // set quality param for JPG file type
     if (!is_null($this->quality()) && $this->_fileType == IMAGETYPE_JPEG) {
         $functionParameters[] = $this->quality();
     }
     // set quality param for PNG file type
     if (!is_null($this->quality()) && $this->_fileType == IMAGETYPE_PNG) {
         $quality = round($this->quality() / 100 * 10);
         if ($quality < 1) {
             $quality = 1;
         } elseif ($quality > 10) {
             $quality = 10;
         }
         $quality = 10 - $quality;
         $functionParameters[] = $quality;
     }
     call_user_func_array($this->_getCallback('output'), $functionParameters);
 }
开发者ID:Airmal,项目名称:Magento-Em,代码行数:59,代码来源:Gd2.php

示例7: editadditionalinfoAction

 public function editadditionalinfoAction()
 {
     $data = $this->getRequest()->getPost();
     if ($data) {
         $customerid = $data["customerid"];
         $collection = Mage::getModel("additionalinfo/additionalinfofields")->getCollection()->addFieldToFilter("status", 1);
         $store_id = Mage::app()->getStore()->getId();
         if (count($collection)) {
             foreach ($collection as $record) {
                 $store = $record->getStore();
                 $store = explode(",", $store);
                 if (in_array($store_id, $store)) {
                     $additionaldatas = Mage::getModel("additionalinfo/additionalinfodata")->getCollection();
                     $additionaldatas->addFieldToFilter("customer_id", $customerid);
                     $additionaldatas->addFieldToFilter("field_id", $record->getId());
                     $additionaldatas->addFieldToFilter("store", $store_id);
                     $fieldid = 0;
                     foreach ($additionaldatas as $additionaldata) {
                         $fieldid = $additionaldata->getId();
                     }
                     if ($record->getInputtype() == "file") {
                         $upload_dir = Mage::getBaseDir() . "/media/customeradditionalinfo/" . $customerid . "/";
                         $file = new Varien_Io_File();
                         $file->mkdir($upload_dir);
                         $new_file_name = $_FILES[$record->getInputname()]["name"];
                         $imagename = time() . $new_file_name;
                         if ($new_file_name) {
                             move_uploaded_file($_FILES[$record->getInputname()]["tmp_name"], $upload_dir . $new_file_name);
                             $newfile = $upload_dir . $imagename;
                             $oldfile = $upload_dir . $new_file_name;
                             copy($oldfile, $newfile);
                             unlink($oldfile);
                             $addtionaldata = array("field_id" => $record->getId(), "value" => $imagename, "customer_id" => $customerid, "store" => $store_id);
                         } else {
                             $addtionaldata = array("field_id" => $record->getId(), "customer_id" => $customerid, "store" => $store_id);
                         }
                     } elseif ($record->getInputtype() == "multiselect") {
                         $addtionaldata = array("field_id" => $record->getId(), "value" => implode($data[$record->getInputname()], ","), "customer_id" => $customerid, "store" => $store_id);
                     } else {
                         $addtionaldata = array("field_id" => $record->getId(), "value" => $data[$record->getInputname()], "customer_id" => $customerid, "store" => $store_id);
                     }
                     if ($fieldid) {
                         $model = Mage::getModel("additionalinfo/additionalinfodata")->load($fieldid)->addData($addtionaldata);
                         $model->setId($fieldid)->save();
                         $fieldid = 0;
                     } else {
                         Mage::getModel("additionalinfo/additionalinfodata")->setData($addtionaldata)->save();
                     }
                 }
             }
         }
         $this->_getSession()->addSuccess(Mage::helper("additionalinfo")->__("Info was successfully updated"));
     }
     $this->_redirect("additionalinfo/index/additionalinfo/");
 }
开发者ID:sshegde123,项目名称:wmp8,代码行数:55,代码来源:IndexController.php

示例8: customersaveafter

 public function customersaveafter($observer)
 {
     $data = Mage::getSingleton("core/app")->getRequest()->getParams();
     $store_id = $data["store"];
     $customer = $observer->getCustomer();
     if ($data) {
         $customerid = $customer->getId();
         $collection = Mage::getModel("additionalinfo/additionalinfofields")->getCollection()->addFieldToFilter("status", 1);
         if (count($collection)) {
             foreach ($collection as $record) {
                 $store = $record->getStore();
                 $store = explode(",", $store);
                 if (in_array($store_id, $store)) {
                     $additionaldatas = Mage::getModel("additionalinfo/additionalinfodata")->getCollection();
                     $additionaldatas->addFieldToFilter("customer_id", $customerid);
                     $additionaldatas->addFieldToFilter("field_id", $record->getId());
                     $additionaldatas->addFieldToFilter("store", $store_id);
                     $fieldid = 0;
                     foreach ($additionaldatas as $additionaldata) {
                         $fieldid = $additionaldata->getId();
                     }
                     if ($record->getInputtype() == "file") {
                         $upload_dir = Mage::getBaseDir() . "/media/customeradditionalinfo/" . $customerid . "/";
                         $file = new Varien_Io_File();
                         $file->mkdir($upload_dir);
                         $new_file_name = $_FILES[$record->getInputname()]["name"];
                         $imagename = time() . $new_file_name;
                         if ($new_file_name) {
                             move_uploaded_file($_FILES[$record->getInputname()]["tmp_name"], $upload_dir . $new_file_name);
                             $newfile = $upload_dir . $imagename;
                             $oldfile = $upload_dir . $new_file_name;
                             copy($oldfile, $newfile);
                             unlink($oldfile);
                             $addtionaldata = array("field_id" => $record->getId(), "value" => $imagename, "customer_id" => $customerid, "store" => $store_id);
                         } else {
                             $addtionaldata = array("field_id" => $record->getId(), "customer_id" => $customerid, "store" => $store_id);
                         }
                     } elseif ($record->getInputtype() == "multiselect") {
                         $addtionaldata = array("field_id" => $record->getId(), "value" => implode($data[$record->getInputname()], ","), "customer_id" => $customerid, "store" => $store_id);
                     } else {
                         $addtionaldata = array("field_id" => $record->getId(), "value" => $data[$record->getInputname()], "customer_id" => $customerid, "store" => $store_id);
                     }
                     if ($fieldid) {
                         $model = Mage::getModel("additionalinfo/additionalinfodata")->load($fieldid)->addData($addtionaldata);
                         $model->setId($fieldid)->save();
                         $fieldid = 0;
                     } else {
                         Mage::getModel("additionalinfo/additionalinfodata")->setData($addtionaldata)->save();
                     }
                 }
             }
         }
     }
 }
开发者ID:sshegde123,项目名称:wmp8,代码行数:54,代码来源:Observer.php

示例9: _getCacheDir

 /**
  * Returns path to cash dir
  *
  * @param array $options
  *
  * @return string
  */
 protected function _getCacheDir($options)
 {
     $cacheDir = isset($options['cache_dir']) ? $options['cache_dir'] : self::DEFAULT_CACHE_DIR;
     $cacheDir = SELENIUM_TESTS_BASEDIR . DIRECTORY_SEPARATOR . $cacheDir;
     if (!is_dir($cacheDir)) {
         $io = new Varien_Io_File();
         if (!$io->mkdir($cacheDir, 0777, true)) {
             throw new Exception('Cache dir is not defined');
         }
     }
     return $cacheDir;
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:19,代码来源:Cache.php

示例10: __construct

 public function __construct()
 {
     parent::__construct();
     $this->_baseDir = Mage::getBaseDir('export');
     // check for valid base dir
     $ioProxy = new Varien_Io_File();
     $ioProxy->mkdir($this->_baseDir);
     if (!is_file($this->_baseDir . DS . '.htaccess')) {
         $ioProxy->open(array('path' => $this->_baseDir));
         $ioProxy->write('.htaccess', 'deny from all', 0644);
     }
     $this->setOrder('file_created', self::SORT_ORDER_DESC)->addTargetDir($this->_baseDir)->setCollectRecursively(false);
 }
开发者ID:helirexi,项目名称:DataflowExportDownloads,代码行数:13,代码来源:Collection.php

示例11: __construct

 /**
  * Set collection specific parameters and make sure backups folder will exist
  */
 public function __construct()
 {
     parent::__construct();
     $this->_baseDir = Mage::getBaseDir('var') . DS . Ebizmarts_Mailchimp_Model_BulkSynchro::FLDR;
     // check for valid base dir
     $ioProxy = new Varien_Io_File();
     $ioProxy->mkdir($this->_baseDir);
     if (!is_file($this->_baseDir . DS . '.htaccess')) {
         $ioProxy->open(array('path' => $this->_baseDir));
         $ioProxy->write('.htaccess', 'deny from all', 0644);
     }
     // set collection specific params
     $this->setOrder('time', self::SORT_ORDER_DESC)->addTargetDir($this->_baseDir)->setFilesFilter('/^[a-z0-9\\-\\_]+\\.' . preg_quote(Ebizmarts_Mailchimp_Model_BulkSynchro::FILE_EXTENSION . "." . Ebizmarts_Mailchimp_Model_BulkSynchro::BULK_EXTENSION, '/') . '$/')->setCollectRecursively(false);
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:17,代码来源:Collection.php

示例12: save

 /**
  * Hijacks the normal GD2 save method to add ImageCDN hooks. Fails back to parent method
  * as appropriate.
  *
  * @param string $destination
  * @param string $newName
  * @return none
  */
 public function save($destination = null, $newName = null)
 {
     $cds = Mage::Helper('imagecdn')->factory();
     $compression = Mage::getStoreConfig('imagecdn/general/compression');
     if ($cds->useCdn()) {
         $temp = tempnam(sys_get_temp_dir(), 'cds');
         parent::save($temp);
         //Compress images?
         if ($this->_fileType == IMAGETYPE_JPEG && $compression > 0) {
             $convert = round((9 - $compression) * (100 / 8));
             //convert to imagejpeg's scale
             call_user_func('imagejpeg', $this->_imageHandler, $temp, $convert);
         } elseif ($this->_fileType == IMAGETYPE_PNG && $compression > 0) {
             $convert = round(($compression - 1) * (9 / 8));
             //convert to imagepng's scale
             call_user_func('imagepng', $this->_imageHandler, $temp, $convert);
         }
         $filename = !isset($destination) ? $this->_fileName : $destination;
         if (isset($destination) && isset($newName)) {
             $filename = $destination . "/" . $filename;
         } elseif (isset($destination) && !isset($newName)) {
             $info = pathinfo($destination);
             $filename = $destination;
             $destination = $info['dirname'];
         } elseif (!isset($destination) && isset($newName)) {
             $filename = $this->_fileSrcPath . "/" . $newName;
         } else {
             $filename = $this->_fileSrcPath . $this->_fileSrcName;
         }
         if ($cds->save($filename, $temp)) {
             @unlink($temp);
         } else {
             if (!is_writable($destination)) {
                 try {
                     $io = new Varien_Io_File();
                     $io->mkdir($destination);
                 } catch (Exception $e) {
                     throw new Exception("Unable to write file into directory '{$destinationDir}'. Access forbidden.");
                 }
             }
             @rename($temp, $filename);
             @chmod($filename, 0644);
         }
     } else {
         return parent::save($destination, $newName);
     }
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:55,代码来源:Gd2.php

示例13: moveImageFromTemp

 /**
  *
  * Move option image from Temp directory to Media directory
  *
  * @param string $fileName
  * @param int $attributeId
  * @param int $optionId
  * @return string
  */
 public function moveImageFromTemp($fileName, $attributeId, $optionId)
 {
     $ioObject = new Varien_Io_File();
     $targetDirectory = $this->_optionImageBasePath . $attributeId . DS . $optionId;
     try {
         $ioObject->rmdir($targetDirectory, true);
         $ioObject->mkdir($targetDirectory, 0777, true);
         $ioObject->open(array('path' => $targetDirectory));
     } catch (Exception $e) {
         return false;
     }
     $fileName = trim($fileName, '.tmp');
     $targetFile = Varien_File_Uploader::getNewFileName($fileName);
     $path = $targetDirectory . DS . $targetFile;
     $ioObject->mv(Mage::getSingleton('catalog/product_media_config')->getTmpMediaPath($fileName), $path);
     return $targetFile;
 }
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:26,代码来源:Data.php

示例14: _validateUploadedFile

 /**
  * Validate uploaded file
  *
  * @throws Mage_Core_Exception
  * @return Mage_Catalog_Model_Product_Option_Type_File
  */
 protected function _validateUploadedFile()
 {
     $option = $this->getOption();
     if (Mage::helper('aitcg/options')->checkAitOption($option)) {
         $values = Mage::app()->getRequest()->getParam('options');
         $optionValue = $values[$option->getId()];
         $runValidation = ($option->getIsRequire() || $this->_validateValue($option)) && !is_null($optionValue);
         if (!$runValidation) {
             $this->setUserValue(null);
             return $this;
         }
         $optionValue = Mage::helper('core')->jsonDecode($optionValue);
         $this->_initFilesystem();
         $model = Mage::getModel('aitcg/image');
         $src = Mage::getBaseDir('media') . DS . $model->getFullTempPath() . DS . $optionValue['config']['rand'] . '.' . Aitoc_Aitcg_Model_Image::FORMAT_PNG;
         $fileName = Mage_Core_Model_File_Uploader::getCorrectFileName(pathinfo(strtolower($src), PATHINFO_FILENAME));
         $dispersion = Mage_Core_Model_File_Uploader::getDispretionPath($fileName);
         $filePath = $dispersion;
         $fileHash = md5(file_get_contents($src));
         $filePath .= DS . $fileHash . '.' . Aitoc_Aitcg_Model_Image::FORMAT_PNG;
         $fileFullPath = $this->getQuoteTargetDir() . $filePath;
         $_width = 0;
         $_height = 0;
         $_fileSize = 0;
         if (is_readable($src)) {
             $_imageSize = getimagesize($src);
             if ($_imageSize) {
                 $_width = $_imageSize[0];
                 $_height = $_imageSize[1];
             }
             $_fileSize = filesize($src);
         }
         $manager = Mage::getModel('aitcg/image_manager');
         $template_id = $manager->addImage($values[$option->getId()], Mage::app()->getRequest()->getParam('product'), $option->getId(), $option);
         $this->setUserValue(array('type' => 'image/png', 'title' => 'custom_product_preview.png', 'quote_path' => $this->getQuoteTargetDir(true) . $filePath, 'order_path' => $this->getOrderTargetDir(true) . $filePath, 'fullpath' => $fileFullPath, 'size' => $_fileSize, 'width' => $_width, 'height' => $_height, 'secret_key' => substr($fileHash, 0, 20), Aitoc_Aitcg_Helper_Options::OPTION_DATA_KEY => array('template_id' => $template_id, Aitoc_Aitcg_Model_Sales_Order_Item_Converter::CUSTOMER_IMAGE_META_VERSION_KEY => Aitoc_Aitcg_Model_Sales_Order_Item_Converter::CUSTOMER_IMAGE_META_VERSION)));
         $path = dirname($fileFullPath);
         $io = new Varien_Io_File();
         if (!$io->isWriteable($path) && !$io->mkdir($path, 0777, true)) {
             Mage::throwException(Mage::helper('catalog')->__("Cannot create writeable directory '%s'.", $path));
         }
         @copy($src, $fileFullPath);
         return $this;
     } else {
         return parent::_validateUploadedFile();
     }
 }
开发者ID:Eximagen,项目名称:BulletMagento,代码行数:52,代码来源:File.php

示例15: _moveFileFromTmp

 /**
  * Move file from tmp path to base path
  *
  * @param string $baseTmpPath
  * @param string $basePath
  * @param string $file
  * @return string
  */
 protected function _moveFileFromTmp($baseTmpPath, $basePath, $file)
 {
     $ioObject = new Varien_Io_File();
     $destDirectory = dirname($this->getFilePath($basePath, $file));
     try {
         $ioObject->open(array('path' => $destDirectory));
     } catch (Exception $e) {
         $ioObject->mkdir($destDirectory, 0777, true);
         $ioObject->open(array('path' => $destDirectory));
     }
     if (strrpos($file, '.tmp') == strlen($file) - 4) {
         $file = substr($file, 0, strlen($file) - 4);
     }
     $destFile = dirname($file) . $ioObject->dirsep() . Varien_File_Uploader::getNewFileName($this->getFilePath($basePath, $file));
     $result = $ioObject->mv($this->getFilePath($baseTmpPath, $file), $this->getFilePath($basePath, $destFile));
     return str_replace($ioObject->dirsep(), '/', $destFile);
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:25,代码来源:File.php


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