Пример #1
0
 /**
  * Create new directory in storage
  *
  * @param string $name New directory name
  * @param string $path Parent directory path
  * @throws Mage_Core_Exception
  * @return array New directory info
  */
 public function createDirectory($name, $path)
 {
     if (!Mage::helper('uaudio_storage')->isEnabled()) {
         return parent::createDirectory($name, $path);
     }
     if (!preg_match(self::DIRECTORY_NAME_REGEXP, $name)) {
         Mage::throwException(Mage::helper('cms')->__('Invalid folder name. Please, use alphanumeric characters, underscores and dashes.'));
     }
     $newPath = $path . DS . $name;
     if ($this->_getStorageModel()->createDir($newPath)) {
         $result = ['name' => $name, 'short_name' => $this->getHelper()->getShortFilename($name), 'path' => $newPath, 'id' => $this->getHelper()->convertPathToId($newPath)];
         return $result;
     }
     Mage::throwException(Mage::helper('cms')->__('Cannot create new directory.'));
 }