log(LogLevel::DEBUG, __CLASS__ . " :: New instance"); } /** * Implements the _prepare abstract method * */ function _prepare() { $archive = Factory::getArchiverEngine(); // Add the backup description and comment in a README.html file in the // installation directory. This makes it the first file in the archive. if ($this->installerSettings->readme) { $data = $this->createReadme(); $archive->addVirtualFile('README.html', $this->installerSettings->installerroot, $data); } if ($this->installerSettings->extrainfo) { $data = $this->createExtrainfo(); $archive->addVirtualFile('extrainfo.ini', $this->installerSettings->installerroot, $data); } if ($this->installerSettings->password) { $data = $this->createPasswordFile(); if (!empty($data)) { $archive->addVirtualFile('password.php', $this->installerSettings->installerroot, $data); } } $this->progress = 0; // Set our state to prepared $this->setState('prepared'); } /** * Implements the _run() abstract method */ function _run() { if ($this->getState() == 'postrun') { Factory::getLog()->log(LogLevel::DEBUG, __CLASS__ . " :: Already finished"); $this->setStep(''); $this->setSubstep(''); } else { $this->setState('running'); } // Try to step the archiver $archive = Factory::getArchiverEngine(); $ret = $archive->transformJPA($this->xformIndex, $this->offset); // Error propagation $this->propagateFromObject($archive); if (($ret !== false) && ($archive->getError() == '')) { $this->offset = $ret['offset']; $this->xformIndex = $ret['index']; $this->setStep($ret['filename']); } // Check for completion if ($ret['done']) { Factory::getLog()->log(LogLevel::DEBUG, __CLASS__ . ":: archive is initialized"); $this->setState('finished'); } // Calculate percentage $this->runningSize += $ret['chunkProcessed']; if ($ret['filesize'] > 0) { $this->progress = $this->runningSize / $ret['filesize']; } } /** * Implements the _finalize() abstract method * */ function _finalize() { $this->setState('finished'); $this->progress = 1; } /** * Creates the contents of an HTML file with the description and comment of * the backup. This file will be saved as README.html in the installer's root * directory, as specified by the embedded installer's settings. * * @return string The contents of the HTML file. */ protected function createReadme() { $config = Factory::getConfiguration(); $lbl_version = AKEEBA_VERSION . ' (' . AKEEBA_DATE . ')'; $lbl_coreorpro = (AKEEBA_PRO == 1) ? 'Professional' : 'Core'; $description = $config->get('volatile.core.description', ''); $comment = $config->get('volatile.core.comment', ''); $config->set('volatile.core.description', null); $config->set('volatile.core.comment', null); return << Akeeba Backup Archive Identity

Backup Description

Backup Comment

$comment

Akeeba Backup $lbl_coreorpro $lbl_version

ENDHTML; } protected function createExtrainfo() { $abversion = AKEEBA_VERSION; $host = Platform::getInstance()->get_host(); $backupdate = gmdate('Y-m-d H:i:s'); $phpversion = PHP_VERSION; $ret = <<get('engine.installer.angie.key', ''); if (empty($password)) { return $ret; } $randVal = Factory::getRandval(); $salt = $randVal->generateString(32); $passhash = md5($password . $salt) . ':' . $salt; $ret = "progress; } }