/** * @return Mageplace_Backup_Model_Session */ protected function _getSession() { if ($this->getBackup() instanceof Mageplace_Backup_Model_Backup) { return $this->getBackup()->getSession(); } return $this->_helper->getSession(); }
protected function _packFile($file, $bytes = null) { if (is_string($file)) { if (($v_file = @fopen($file, "rb")) == 0) { $this->_addBackupProcessMessage('Unable to open file "' . $file . '" in binary read mode', Mageplace_Backup_Model_Backup::LOG_LEVEL_WARNING); return true; } } elseif (is_resource($file)) { $v_file = $file; $file = stream_get_meta_data($v_file); $file = $file['uri']; } else { $this->_addBackupProcessMessage('Error input data', Mageplace_Backup_Model_Backup::LOG_LEVEL_WARNING); return false; } $bytes = (double) $bytes; if ($bytes > 0) { $this->fseek($v_file, $bytes); } else { $relDir = strtr($file, array($this->_baseDir => '')); $this->_addBackupProcessMessage($this->_helper->__('Adding "%s" file to archive', $relDir)); } while (($v_buffer = fread($v_file, 512)) != '') { /*if ($bytes > 0 && !isset($first)) { Mage::log('#');Mage::log($v_buffer);Mage::log('#'); $first = true; }*/ $this->_writeBlock(pack("a512", "{$v_buffer}")); $bytes += 512; if ($this->timeIsUp()) { $this->_timeIsUp = true; $this->setStepParams($file, $bytes); /*Mage::log('#');Mage::log($v_buffer);Mage::log('#');*/ break; } } fclose($v_file); if (!$this->_timeIsUp) { $this->setStepParams(null, null); } return true; }
public function resetBackupProcessMessage() { self::$_backupModel = null; }
/** * @deprecated after 2.0.0 * * @param $message * @param bool $error */ protected function _addMessage($message, $error = false) { $this->_helper->addBackupProcessMessage($message, $error); }