/** * Get backup-specific data from model for each row * * @param string $filename * @return array */ protected function _generateRow($filename) { $row = parent::_generateRow($filename); foreach (Mage::getSingleton('Mage_Backup_Model_Backup')->load($row['basename'], $this->_baseDir)->getData() as $key => $value) { $row[$key] = $value; } $row['size'] = $this->_filesystem->getFileSize($filename); $row['id'] = $row['time'] . '_' . $row['type']; return $row; }
/** * @return int|mixed */ public function getSize() { if (!is_null($this->getData('size'))) { return $this->getData('size'); } if ($this->exists()) { $this->setData('size', $this->_filesystem->getFileSize($this->_getFilePath())); return $this->getData('size'); } return 0; }
/** * Validation callback for checking max file size * * @param string $filePath Path to temporary uploaded file * @throws Mage_Core_Exception */ public function validateMaxSize($filePath) { if ($this->_maxFileSize > 0 && $this->_filesystem->getFileSize($filePath, dirname($filePath)) > $this->_maxFileSize * 1024) { throw Mage::exception('Mage_Core', Mage::helper('Mage_Backend_Helper_Data')->__('Uploaded file is larger than %.2f kilobytes allowed by server', $this->_maxFileSize)); } }