/** * Implements the _run() abstract method */ protected function _run() { if ($this->getState() == 'postrun') { AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Already finished"); $this->setStep(''); $this->setSubstep(''); return; } else { $this->setState('running'); } // Load the version defines AEPlatform::getInstance()->load_version_defines(); $registry = AEFactory::getConfiguration(); // Write log file's header AEUtilLogger::WriteLog(_AE_LOG_INFO, "--------------------------------------------------------------------------------"); AEUtilLogger::WriteLog(_AE_LOG_INFO, "Akeeba Backup " . AKEEBA_VERSION . ' (' . AKEEBA_DATE . ')'); AEUtilLogger::WriteLog(_AE_LOG_INFO, "Got backup?"); AEUtilLogger::WriteLog(_AE_LOG_INFO, "--------------------------------------------------------------------------------"); // PHP configuration variables are tried to be logged only for debug and info log levels if ($registry->get('akeeba.basic.log_level') >= _AE_LOG_INFO) { AEUtilLogger::WriteLog(_AE_LOG_INFO, "--- System Information ---"); AEUtilLogger::WriteLog(_AE_LOG_INFO, "PHP Version :" . PHP_VERSION); AEUtilLogger::WriteLog(_AE_LOG_INFO, "PHP OS :" . PHP_OS); AEUtilLogger::WriteLog(_AE_LOG_INFO, "PHP SAPI :" . PHP_SAPI); if (function_exists('php_uname')) { AEUtilLogger::WriteLog(_AE_LOG_INFO, "OS Version :" . php_uname('s')); } $db = AEFactory::getDatabase(); AEUtilLogger::WriteLog(_AE_LOG_INFO, "DB Version :" . $db->getVersion()); if (isset($_SERVER['SERVER_SOFTWARE'])) { $server = $_SERVER['SERVER_SOFTWARE']; } else { if ($sf = getenv('SERVER_SOFTWARE')) { $server = $sf; } else { $server = 'n/a'; } } AEUtilLogger::WriteLog(_AE_LOG_INFO, "Web Server :" . $server); $platform = 'Unknown platform'; $version = '(unknown version)'; $platformData = AEPlatform::getInstance()->getPlatformVersion(); AEUtilLogger::WriteLog(_AE_LOG_INFO, $platformData['name'] . " version :" . $platformData['version']); if (isset($_SERVER['HTTP_USER_AGENT'])) { AEUtilLogger::WriteLog(_AE_LOG_INFO, "User agent :" . phpversion() <= "4.2.1" ? getenv("HTTP_USER_AGENT") : $_SERVER['HTTP_USER_AGENT']); } AEUtilLogger::WriteLog(_AE_LOG_INFO, "Safe mode :" . ini_get("safe_mode")); AEUtilLogger::WriteLog(_AE_LOG_INFO, "Display errors :" . ini_get("display_errors")); AEUtilLogger::WriteLog(_AE_LOG_INFO, "Error reporting :" . self::error2string()); AEUtilLogger::WriteLog(_AE_LOG_INFO, "Error display :" . self::errordisplay()); AEUtilLogger::WriteLog(_AE_LOG_INFO, "Disabled functions :" . ini_get("disable_functions")); AEUtilLogger::WriteLog(_AE_LOG_INFO, "open_basedir restr.:" . ini_get('open_basedir')); AEUtilLogger::WriteLog(_AE_LOG_INFO, "Max. exec. time :" . ini_get("max_execution_time")); AEUtilLogger::WriteLog(_AE_LOG_INFO, "Memory limit :" . ini_get("memory_limit")); if (function_exists("memory_get_usage")) { AEUtilLogger::WriteLog(_AE_LOG_INFO, "Current mem. usage :" . memory_get_usage()); } if (function_exists("gzcompress")) { AEUtilLogger::WriteLog(_AE_LOG_INFO, "GZIP Compression : available (good)"); } else { AEUtilLogger::WriteLog(_AE_LOG_INFO, "GZIP Compression : n/a (no compression)"); } AEPlatform::getInstance()->log_platform_special_directories(); AEUtilLogger::WriteLog(_AE_LOG_INFO, "Output directory :" . $registry->get('akeeba.basic.output_directory')); AEUtilLogger::WriteLog(_AE_LOG_INFO, "--------------------------------------------------------------------------------"); } // Quirks reporting $quirks = AEUtilQuirks::get_quirks(true); if (!empty($quirks)) { AEUtilLogger::WriteLog(_AE_LOG_INFO, "Akeeba Backup has detected the following potential problems:"); foreach ($quirks as $q) { AEUtilLogger::WriteLog(_AE_LOG_INFO, '- ' . $q['code'] . ' ' . $q['description'] . ' (' . $q['severity'] . ')'); } AEUtilLogger::WriteLog(_AE_LOG_INFO, "You probably do not have to worry about them, but you should be aware of them."); AEUtilLogger::WriteLog(_AE_LOG_INFO, "--------------------------------------------------------------------------------"); } if (!version_compare(PHP_VERSION, '5.3.0', 'ge')) { AEUtilLogger::WriteLog(_AE_LOG_WARNING, "You are using an outdated version of PHP. Akeeba Engine may not work properly. Please upgrade to PHP 5.3 or later."); } // Report profile ID $profile_id = AEPlatform::getInstance()->get_active_profile(); AEUtilLogger::WriteLog(_AE_LOG_INFO, "Loaded profile #{$profile_id}"); // Get archive name AEUtilFilesystem::get_archive_name($relativeArchiveName, $absoluteArchiveName); // ==== Stats initialisation === $origin = AEPlatform::getInstance()->get_backup_origin(); // Get backup origin $profile_id = AEPlatform::getInstance()->get_active_profile(); // Get active profile $registry = AEFactory::getConfiguration(); $backupType = $registry->get('akeeba.basic.backup_type'); AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Backup type is now set to '" . $backupType . "'"); // Substitute "variables" in the archive name $description = AEUtilFilesystem::replace_archive_name_variables($this->description); $comment = AEUtilFilesystem::replace_archive_name_variables($this->comment); if ($registry->get('volatile.writer.store_on_server', true)) { // Archive files are stored on our server $stat_relativeArchiveName = $relativeArchiveName; $stat_absoluteArchiveName = $absoluteArchiveName; } else { // Archive files are not stored on our server (FTP backup, cloud backup, sent by email, etc) $stat_relativeArchiveName = ''; $stat_absoluteArchiveName = ''; } $kettenrad = AEFactory::getKettenrad(); $temp = array('description' => $description, 'comment' => $comment, 'backupstart' => AEPlatform::getInstance()->get_timestamp_database(), 'status' => 'run', 'origin' => $origin, 'type' => $backupType, 'profile_id' => $profile_id, 'archivename' => $stat_relativeArchiveName, 'absolute_path' => $stat_absoluteArchiveName, 'multipart' => 0, 'filesexist' => 1, 'tag' => $kettenrad->getTag()); // Save the entry $statistics = AEFactory::getStatistics(); $statistics->setStatistics($temp); if ($statistics->getError()) { $this->setError($statistics->getError()); return; } $statistics->release_multipart_lock(); // Initialize the archive. if (AEUtilScripting::getScriptingParameter('core.createarchive', true)) { AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Expanded archive file name: " . $absoluteArchiveName); AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Initializing archiver engine"); $archiver = AEFactory::getArchiverEngine(); $archiver->initialize($absoluteArchiveName); $archiver->setComment($comment); // Add the comment to the archive itself. $archiver->propagateToObject($this); if ($this->getError()) { return; } } $this->setState('postrun'); }
</div> <div class="span4"> <h3><?php echo JText::_('CPANEL_LABEL_STATUSSUMMARY'); ?> </h3> <div> <?php echo $this->statuscell; ?> <?php $quirks = AEUtilQuirks::get_quirks(); ?> <?php if (!empty($quirks)) { ?> <h4 class="ui-widget-header ui-corner-tl"> <?php echo JText::_('CPANEL_LABEL_STATUSDETAILS'); ?> </h4> <div class="ui-widget-content ui-corner-br"> <?php echo $this->detailscell; ?> </div> <?php
{ akeeba.jQuery('#nojquerywarning').css('display','none'); akeeba.jQuery('#notfixedperms').css('display','none'); } } </script> <div id="cpanel"> <div class="ak_cpanel_modules" id="ak_cpanel_modules"> <fieldset> <legend><?php echo JText::_('CPANEL_LABEL_STATUSSUMMARY')?></legend> <div> <?php echo $this->statuscell ?> <?php $quirks = AEUtilQuirks::get_quirks(); ?> <?php if(!empty($quirks)): ?> <h4 class="ui-widget-header ui-corner-tl"> <?php echo JText::_('CPANEL_LABEL_STATUSDETAILS'); ?> </h4> <div class="ui-widget-content ui-corner-br"> <?php echo $this->detailscell ?> </div> <?php endif; ?> <?php if(!defined('AKEEBA_PRO')) { $show_donation = 1; } else { $show_donation = (AKEEBA_PRO != 1); } ?> <p class="ak_version"><?php echo JText::_('AKEEBA').' '.($show_donation?'':'Professional ').AKEEBA_VERSION.' ('.AKEEBA_DATE.')' ?></p> <?php if($show_donation): ?> <div style="text-align: center;"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick">
/** * This mess of a code is probably not one of my highlights in my code * writing career. It's logically organized, badly architectured but I can * still maintain it - and it works! */ public function onAdd($tpl = null) { /** @var AkeebaModelBackups $model */ $model = $this->getModel(); // Load the Status Helper if (!class_exists('AkeebaHelperStatus')) { JLoader::import('helpers.status', JPATH_COMPONENT_ADMINISTRATOR); } $helper = AkeebaHelperStatus::getInstance(); // Determine default description JLoader::import('joomla.utilities.date'); $jregistry = JFactory::getConfig(); if (version_compare(JVERSION, '3.0', 'ge')) { $tzDefault = $jregistry->get('offset'); } else { $tzDefault = $jregistry->getValue('config.offset'); } $user = JFactory::getUser(); $tz = $user->getParam('timezone', $tzDefault); $dateNow = new JDate('now', $tz); $default_description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true); $default_description = AkeebaHelperEscape::escapeJS($default_description, "'"); $backup_description = $model->getState('description', $default_description); $comment = $model->getState('comment', ''); // Get a potential return URL $returnurl = $model->getState('returnurl'); if (empty($returnurl)) { $returnurl = ''; } // If a return URL is set *and* the profile's name is "Site Transfer // Wizard", we are running the Site Transfer Wizard if (!class_exists('AkeebaModelProfiles')) { JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR); } /** @var AkeebaModelCpanels $cpanelmodel */ $cpanelmodel = F0FModel::getAnInstance('Cpanels', 'AkeebaModel'); $profilemodel = new AkeebaModelProfiles(); $profilemodel->setId($cpanelmodel->getProfileID()); $profile_data = $profilemodel->getProfile(); $isSTW = $profile_data->description == 'Site Transfer Wizard (do not rename)' && !empty($returnurl); $this->isSTW = $isSTW; // Get the domain details from scripting facility $registry = AEFactory::getConfiguration(); $tag = $model->getState('tag'); $script = $tag == 'restorepoint' ? 'full' : $registry->get('akeeba.basic.backup_type', 'full'); $scripting = AEUtilScripting::loadScripting(); $domains = array(); if (!empty($scripting)) { foreach ($scripting['scripts'][$script]['chain'] as $domain) { $description = JText::_($scripting['domains'][$domain]['text']); $domain_key = $scripting['domains'][$domain]['domain']; if ($isSTW && $domain_key == 'Packing') { $description = JText::_('BACKUP_LABEL_DOMAIN_PACKING_STW'); } $domains[] = array($domain_key, $description); } } $json_domains = AkeebaHelperEscape::escapeJS(json_encode($domains), '"\\'); // Get the maximum execution time and bias $maxexec = $registry->get('akeeba.tuning.max_exec_time', 14) * 1000; $bias = $registry->get('akeeba.tuning.run_time_bias', 75); // Check if the output directory is writable $quirks = AEUtilQuirks::get_quirks(); $unwritableOutput = array_key_exists('001', $quirks); // Pass on data $this->haserrors = !$helper->status; $this->hasquirks = $helper->hasQuirks(); $this->quirks = $helper->getQuirksCell(!$helper->status); $this->description = $backup_description; $this->default_descr = $default_description; $this->comment = $comment; $this->domains = $json_domains; $this->maxexec = $maxexec; $this->bias = $bias; $this->useiframe = $registry->get('akeeba.basic.useiframe', 0) ? 'true' : 'false'; $this->returnurl = $returnurl; $this->unwritableoutput = $unwritableOutput; if ($registry->get('akeeba.advanced.archiver_engine', 'jpa') == 'jps') { $this->showjpskey = 1; $this->jpskey = $registry->get('engine.archiver.jps.key', ''); } else { $this->showjpskey = 0; } if (AKEEBA_PRO) { $this->showangiekey = 1; $this->angiekey = $registry->get('engine.installer.angie.key', ''); } else { $this->showangiekey = 0; $this->angiekey = ''; } $this->autostart = $model->getState('autostart'); // Pass on profile info $this->profileid = $cpanelmodel->getProfileID(); // Active profile ID $this->profilelist = $cpanelmodel->getProfilesList(); // List of available profiles // Pass on state information pertaining to SRP $this->srpinfo = $model->getState('srpinfo'); // Add live help AkeebaHelperIncludes::addHelp('backup'); // Set the toolbar title if ($this->srpinfo['tag'] == 'restorepoint') { $subtitle = JText::_('AKEEBASRP'); } elseif ($isSTW) { $subtitle = JText::_('SITETRANSFERWIZARD'); } else { $subtitle = JText::_('BACKUP'); } JToolBarHelper::title(JText::_('AKEEBA') . ':: <small>' . $subtitle . '</small>', 'akeeba'); return true; }
/** * Returns a boolean value, indicating if quirks have been detected * @return bool True if there is at least one quirk detected */ public function hasQuirks() { $quirks = AEUtilQuirks::get_quirks(); return !empty($quirks); }
/** * This mess of a code is probably not one of my highlights in my code * writing career. It's logically organized, badly architectured but I can * still maintain it - and it works! */ function display() { // Add some buttons JToolBarHelper::back('AKEEBA_CONTROLPANEL', 'index.php?option=' . JRequest::getCmd('option')); JToolBarHelper::spacer(); // Load the Status Helper if (!class_exists('AkeebaHelperStatus')) { JLoader::import('helpers.status', JPATH_COMPONENT_ADMINISTRATOR); } $helper =& AkeebaHelperStatus::getInstance(); // Determine default description jimport('joomla.utilities.date'); $jregistry =& JFactory::getConfig(); $tzDefault = $jregistry->getValue('config.offset'); $user =& JFactory::getUser(); $tz = $user->getParam('timezone', $tzDefault); if (AKEEBA_JVERSION == '16') { $dateNow = new JDate('now', $tz); $backup_description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true); } else { $dateNow = new JDate(); $dateNow->setOffset($tz); $backup_description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->toFormat(JText::_('DATE_FORMAT_LC2')); } $backup_description = AkeebaHelperEscape::escapeJS($backup_description, "'"); $default_description = $backup_description; $backup_description = JRequest::getVar('description', $default_description); $comment = JRequest::getVar('comment', '', 'default', 'none', 2); // Get a potential return URL $returnurl = JRequest::getVar('returnurl', null); if (empty($returnurl)) { $returnurl = ''; } // If a return URL is set *and* the profile's name is "Site Transfer // Wizard", we are running the Site Transfer Wizard if (!class_exists('AkeebaModelProfiles')) { JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR); } if (!class_exists('AkeebaModelCpanel')) { JLoader::import('models.cpanel', JPATH_COMPONENT_ADMINISTRATOR); } $cpanelmodel = new AkeebaModelCpanel(); $profilemodel = new AkeebaModelProfiles(); $profilemodel->setId($cpanelmodel->getProfileID()); $profile_data = $profilemodel->getProfile(); $isSTW = $profile_data->description == 'Site Transfer Wizard (do not rename)' && !empty($returnurl); $this->assign('isSTW', $isSTW); // Get the domain details from scripting facility $registry =& AEFactory::getConfiguration(); $script = $registry->get('akeeba.basic.backup_type', 'full'); $scripting = AEUtilScripting::loadScripting(); $domains = array(); if (!empty($scripting)) { foreach ($scripting['scripts'][$script]['chain'] as $domain) { $description = JText::_($scripting['domains'][$domain]['text']); $domain_key = $scripting['domains'][$domain]['domain']; if ($isSTW && $domain_key == 'Packing') { $description = JText::_('BACKUP_LABEL_DOMAIN_PACKING_STW'); } $domains[] = array($domain_key, $description); } } $json_domains = AkeebaHelperEscape::escapeJS(json_encode($domains), '"\\'); // Get the maximum execution time and bias $maxexec = $registry->get('akeeba.tuning.max_exec_time', 14) * 1000; $bias = $registry->get('akeeba.tuning.run_time_bias', 75); // Check if the output directory is writable $quirks = AEUtilQuirks::get_quirks(); $unwritableOutput = array_key_exists('001', $quirks); // Pass on data $this->assign('haserrors', !$helper->status); $this->assign('hasquirks', $helper->hasQuirks()); $this->assign('quirks', $helper->getQuirksCell(!$helper->status)); $this->assign('description', $backup_description); $this->assign('comment', $comment); $this->assign('domains', $json_domains); $this->assign('maxexec', $maxexec); $this->assign('bias', $bias); $this->assign('useiframe', $registry->get('akeeba.basic.useiframe', 0) ? 'true' : 'false'); $this->assign('returnurl', $returnurl); $this->assign('unwritableoutput', $unwritableOutput); if ($registry->get('akeeba.advanced.archiver_engine', 'jpa') == 'jps') { $this->assign('showjpskey', 1); $this->assign('jpskey', $registry->get('engine.archiver.jps.key', '')); } else { $this->assign('showjpskey', 0); } $this->assign('autostart', JRequest::getInt('autostart', 0)); // Pass on profile info $this->assign('profileid', $cpanelmodel->getProfileID()); // Active profile ID $this->assign('profilelist', $cpanelmodel->getProfilesList()); // List of available profiles // Pass on state information pertaining to SRP $srpinfo = array('tag' => JRequest::getCmd('tag', 'backend'), 'type' => JRequest::getCmd('type', ''), 'name' => JRequest::getCmd('name', ''), 'group' => JRequest::getCmd('group', ''), 'customdirs' => JRequest::getVar('customdirs', array(), 'default', 'array', 2), 'extraprefixes' => JRequest::getVar('extraprefixes', array(), 'default', 'array', 2), 'customtables' => JRequest::getVar('customtables', array(), 'default', 'array', 2), 'xmlname' => JRequest::getString('xmlname', '')); $this->assign('srpinfo', $srpinfo); // Add references to CSS and JS files AkeebaHelperIncludes::includeMedia(false); // Add live help AkeebaHelperIncludes::addHelp(); // Set the toolbar title if ($srpinfo['tag'] == 'restorepoint') { $subtitle = JText::_('AKEEBASRP'); } elseif ($isSTW) { $subtitle = JText::_('SITETRANSFERWIZARD'); } else { $subtitle = JText::_('BACKUP'); } JToolBarHelper::title(JText::_('AKEEBA') . ':: <small>' . $subtitle . '</small>', 'akeeba'); parent::display(JRequest::getCmd('tpl', null)); }