public function __construct() { // This is a directory inclusion filter. $this->object = 'db'; $this->subtype = 'inclusion'; $this->method = 'direct'; $this->filter_name = 'PlatformSitedb'; // Add a new record for the core Joomla! database // Get core database options $options = AEPlatform::getInstance()->get_platform_database_options(); $host = $options['host']; $port = NULL; $socket = NULL; $targetSlot = substr(strstr($host, ":"), 1); if (!empty($targetSlot)) { // Get the port number or socket name if (is_numeric($targetSlot)) { $port = $targetSlot; } else { $socket = $targetSlot; } // Extract the host name only $host = substr($host, 0, strlen($host) - (strlen($targetSlot) + 1)); // This will take care of the following notation: ":3306" if ($host == '') { $host = 'localhost'; } } // This is the format of the database inclusion filters $entry = array('host' => $host, 'port' => is_null($socket) ? is_null($port) ? '' : $port : $socket, 'username' => $options['user'], 'password' => $options['password'], 'database' => $options['database'], 'prefix' => $options['prefix'], 'dumpFile' => 'joomla.sql', 'driver' => AEPlatform::getInstance()->get_default_database_driver(true)); // We take advantage of the filter class magic to inject our custom filters $configuration =& AEFactory::getConfiguration(); $this->filter_data['[SITEDB]'] = $entry; parent::__construct(); }
function display() { $registry =& AEFactory::getConfiguration(); // Set the toolbar title JToolBarHelper::title(JText::_('AKEEBA').':: <small>'.JText::_('SITETRANSFERWIZARD').'</small>','akeeba'); JToolBarHelper::back('AKEEBA_CONTROLPANEL', 'index.php?option='.JRequest::getCmd('option')); // Add references to CSS and JS files AkeebaHelperIncludes::includeMedia(false); // Add live help AkeebaHelperIncludes::addHelp(); $model = $this->getModel(); $task = JRequest::getCmd('task','default'); switch($task) { case 'step1': case 'default': default: $cpanelmodel = JModel::getInstance('Cpanel','AkeebaModel'); $this->assign('profilelist', $cpanelmodel->getProfilesList()); $this->assign('stw_profile_id', $model->getSTWProfileID()); break; case 'step2': $this->assignRef('opts', $model->getTransferSettings()); break; case 'step3': break; } parent::display(); }
public function check() { $db = AEFactory::getDatabase(); // Can I execute SHOW statements? try { $result = $db->setQuery('SHOW TABLES')->query(); } catch (Exception $e) { AliceUtilLogger::WriteLog(_AE_LOG_INFO, $this->checkName . " Test failed, can't execute SHOW TABLES statement"); $this->setResult(-1); throw new Exception(JText::_('ALICE_ANALYZE_REQUIREMENTS_DBPERMISSIONS_ERROR')); } if (!$result) { AliceUtilLogger::WriteLog(_AE_LOG_INFO, $this->checkName . " Test failed, can't execute SHOW TABLES statement"); $this->setResult(-1); throw new Exception(JText::_('ALICE_ANALYZE_REQUIREMENTS_DBPERMISSIONS_ERROR')); } try { $result = $db->setQuery('SHOW CREATE TABLE ' . $db->nameQuote('#__ak_profiles'))->query(); } catch (Exception $e) { AliceUtilLogger::WriteLog(_AE_LOG_INFO, $this->checkName . " Test failed, can't execute SHOW CREATE TABLE statement"); $this->setResult(-1); throw new Exception(JText::_('ALICE_ANALYZE_REQUIREMENTS_DBPERMISSIONS_ERROR')); } if (!$result) { AliceUtilLogger::WriteLog(_AE_LOG_INFO, $this->checkName . " Test failed, can't execute SHOW CREATE TABLE statement"); $this->setResult(-1); throw new Exception(JText::_('ALICE_ANALYZE_REQUIREMENTS_DBPERMISSIONS_ERROR')); } return true; }
/** * Initialises the archiver class, seeding the remote installation * from an existent installer's JPA archive. * * @param string $sourceJPAPath Absolute path to an installer's JPA archive * @param string $targetArchivePath Absolute path to the generated archive (ignored in this class) * @param array $options A named key array of options (optional) * @access public */ public function initialize($targetArchivePath, $options = array()) { AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: new instance"); $registry = AEFactory::getConfiguration(); $this->_host = $registry->get('engine.archiver.directsftp.host', ''); $this->_port = $registry->get('engine.archiver.directsftp.port', '22'); $this->_user = $registry->get('engine.archiver.directsftp.user', ''); $this->_pass = $registry->get('engine.archiver.directsftp.pass', ''); $this->_privkey = $registry->get('engine.archiver.directsftp.privkey', ''); $this->_pubkey = $registry->get('engine.archiver.directsftp.pubkey', ''); $this->_initdir = $registry->get('engine.archiver.directsftp.initial_directory', ''); if (isset($options['host'])) { $this->_host = $options['host']; } if (isset($options['port'])) { $this->_port = $options['port']; } if (isset($options['user'])) { $this->_user = $options['user']; } if (isset($options['pass'])) { $this->_pass = $options['pass']; } if (isset($options['privkey'])) { $this->_privkey = $options['privkey']; } if (isset($options['pubkey'])) { $this->_pubkey = $options['pubkey']; } if (isset($options['initdir'])) { $this->_initdir = $options['initdir']; } $this->connect_ok = $this->_connectSFTP(); AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: SFTP connection status: " . ($this->connect_ok ? 'success' : 'FAIL')); }
public function processPart($absolute_filename) { // Retrieve engine configuration data $config = AEFactory::getConfiguration(); $address = trim($config->get('engine.postproc.email.address', '')); $subject = $config->get('engine.postproc.email.subject', '0'); // Sanity checks if (empty($address)) { $this->setError('You have not set up a recipient\'s email address for the backup files'); return false; } // Send the file $basename = basename($absolute_filename); AEUtilLogger::WriteLog(_AE_LOG_INFO, "Preparing to email {$basename} to {$address}"); if (empty($subject)) { $subject = JText::_('AKEEBA_DEFAULT_EMAIL_SUBJECT'); } $body = "Emailing {$basename}"; AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Subject: {$subject}"); AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Body: {$body}"); $result = AEPlatform::getInstance()->send_email($address, $subject, $body, $absolute_filename); // Return the result if ($result !== true) { // An error occured $this->setError($result); // Notify that we failed return false; } else { // Return success AEUtilLogger::WriteLog(_AE_LOG_INFO, "Email sent successfully"); return true; } }
protected function _prepare() { AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Processing parameters"); // Get the DB connection parameters if (is_array($this->_parametersArray)) { $driver = array_key_exists('driver', $this->_parametersArray) ? $this->_parametersArray['driver'] : 'mysql'; $host = array_key_exists('host', $this->_parametersArray) ? $this->_parametersArray['host'] : ''; $port = array_key_exists('port', $this->_parametersArray) ? $this->_parametersArray['port'] : ''; $username = array_key_exists('username', $this->_parametersArray) ? $this->_parametersArray['username'] : ''; $username = array_key_exists('user', $this->_parametersArray) ? $this->_parametersArray['user'] : $username; $password = array_key_exists('password', $this->_parametersArray) ? $this->_parametersArray['password'] : ''; $database = array_key_exists('database', $this->_parametersArray) ? $this->_parametersArray['database'] : ''; $prefix = array_key_exists('prefix', $this->_parametersArray) ? $this->_parametersArray['prefix'] : ''; } $options = array('driver' => $driver, 'host' => $host . ($port != '' ? ':' . $port : ''), 'user' => $username, 'password' => $password, 'database' => $database, 'prefix' => is_null($prefix) ? '' : $prefix); $db = AEFactory::getDatabase($options); $driverType = $db->getDriverType(); $className = 'AEDumpNative' . ucfirst($driverType); // Check if we have a native dump driver if (!class_exists($className, true)) { AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Native database dump engine {$className} not found; trying Reverse Engineering instead"); // Native driver nor found, I will try falling back to reverse engineering $className = 'AEDumpReverse' . ucfirst($driverType); } if (!class_exists($className, true)) { $this->setState('error', 'Akeeba Engine does not have a native dump engine for ' . $driverType . ' databases'); } else { AEUtilLogger::WriteLog(_AE_LOG_DEBUG, __CLASS__ . " :: Instanciating new native database dump engine {$className}"); $this->_engine = new $className(); $this->_engine->setup($this->_parametersArray); $this->_engine->callStage('_prepare'); $this->setState($this->_engine->getState(), $this->_engine->getError()); } }
/** * Handle the apply task which saves settings and shows the editor again * */ public function apply() { // CSRF prevention if (!JRequest::getVar(JUtility::getToken(), false, 'POST')) { JError::raiseError('403', JText::_(version_compare(JVERSION, '1.6.0', 'ge') ? 'JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN' : 'Request Forbidden')); } // Get the var array from the request $var = JRequest::getVar('var', array(), 'default', 'array'); // Make it into Akeeba Engine array format $data = array(); foreach ($var as $key => $value) { $data[$key] = $value; } // Forbid stupidly selecting the site's root as the output or temporary directory if (array_key_exists('akeeba.basic.output_directory', $data)) { $folder = $data['akeeba.basic.output_directory']; $folder = AEUtilFilesystem::translateStockDirs($folder, true, true); $check = AEUtilFilesystem::translateStockDirs('[SITEROOT]', true, true); if ($check == $folder) { JError::raiseWarning(503, JText::_('CONFIG_OUTDIR_ROOT')); $data['akeeba.basic.output_directory'] = '[DEFAULT_OUTPUT]'; } } // Merge it $config = AEFactory::getConfiguration(); $config->mergeArray($data, false, false); // Save configuration AEPlatform::getInstance()->save_configuration(); $this->setRedirect(JURI::base() . 'index.php?option=' . JRequest::getCmd('option') . '&view=config', JText::_('CONFIG_SAVE_OK')); }
protected function is_excluded_by_api($test, $root) { static $from_datetime; $config =& AEFactory::getConfiguration(); if (is_null($from_datetime) && $filter_switch) { $user_setting = $config->get('core.filters.dateconditional.start'); $from_datetime = strtotime($user_setting); } // Get the filesystem path for $root $fsroot = $config->get('volatile.filesystem.current_root', ''); $ds = $fsroot == '' || $fsroot == '/' ? '' : DIRECTORY_SEPARATOR; $filename = $fsroot . $ds . $test; // Get the timestamp of the file $timestamp = @filemtime($filename); // If we could not get this information, include the file in the archive if ($timestamp === false) { return false; } // Compare it with the user-defined minimum timestamp and exclude if it's older than that if ($timestamp <= $from_datetime) { return true; } // No match? Just include the file! return false; }
public function step() { // Check permissions $this->_checkPermissions(); // Set the profile $this->_setProfile(); $kettenrad =& AECoreKettenrad::load(AKEEBA_BACKUP_ORIGIN); $array = $kettenrad->tick(); AECoreKettenrad::save(AKEEBA_BACKUP_ORIGIN); if ($array['Error'] != '') { @ob_end_clean(); echo '500 ERROR -- ' . $array['Error']; flush(); JFactory::getApplication()->close(); } elseif ($array['HasRun'] == false) { // All done AEFactory::nuke(); AEUtilTempvars::reset(); @ob_end_clean(); echo '200 OK'; flush(); JFactory::getApplication()->close(); } else { $noredirect = JRequest::getInt('noredirect', 0); if ($noredirect != 0) { @ob_end_clean(); echo "301 More work required"; flush(); JFactory::getApplication()->close(); } else { $this->setRedirect(JURI::base() . 'index.php?option=com_akeeba&view=backup&task=step&key=' . JRequest::getVar('key') . '&profile=' . JRequest::getInt('profile', 1)); } } }
private static function loadConfig() { if (defined('JVERSION')) { $j16 = version_compare(JVERSION, '1.6.0', 'ge'); } else { $j16 = false; } $db =& AEFactory::getDatabase(); if (!$j16) { $sql = "SELECT " . $db->nameQuote('params') . " FROM " . $db->nameQuote('#__components') . " WHERE (" . $db->nameQuote('link') . " = " . $db->Quote('option=com_akeeba') . ") AND (" . $db->nameQuote('parent') . " = " . $db->Quote('0') . ")"; $db->setQuery($sql); $config_ini = $db->loadResult(); } else { $config_ini = null; } if ($db->getErrorNum() || is_null($config_ini)) { // Maybe it's Joomla! 1.6? $sql = "SELECT " . $db->nameQuote('params') . " FROM " . $db->nameQuote('#__extensions') . " WHERE (" . $db->nameQuote('type') . ' = ' . $db->Quote('component') . ') AND (' . $db->nameQuote('element') . " = " . $db->Quote('com_akeeba') . ")"; $db->setQuery($sql); $config_ini = $db->loadResult(); // OK, Joomla! 1.6 stores values JSON-encoded so, what do I do? Right! $config_ini = json_decode($config_ini, true); return $config_ini; } return AEUtilINI::parse_ini_file($config_ini, false, true); }
public function display($tpl = null) { $task = JRequest::getCmd('task','default'); switch($task) { case 'step': $kettenrad =& AEFactory::getKettenrad(); $array = $kettenrad->getStatusArray(); $this->assign('array', $array); break; case 'error': $this->assign('errormessage', JRequest::getVar('error','')); break; case 'done': break; case 'default': default: $model =& $this->getModel(); $this->assignRef('profilelist', $model->getProfiles()); break; } parent::display(JRequest::getCmd('tpl',null)); }
public function &getExtraSQL($root) { $empty = ''; if ($root != '[SITEDB]') { return $empty; } $sql = ''; $db = AEFactory::getDatabase(); $this->getFilters(null); // Forcibly reload the filter data // Loop all components and add SQL statements if (!empty($this->filter_data)) { foreach ($this->filter_data as $type => $items) { if (!empty($items)) { // Make sure that DB only backups get the correct prefix $configuration = AEFactory::getConfiguration(); $abstract = AEUtilScripting::getScriptingParameter('db.abstractnames', 1); if ($abstract) { $prefix = '#__'; } else { $prefix = $db->getPrefix(); } foreach ($items as $item) { $client = $type == 'frontend' ? 0 : 1; $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'modules_menu') . ' WHERE ' . $db->quoteName('moduleid') . ' IN (' . 'SELECT ' . $db->quoteName('id') . ' FROM ' . $db->quoteName($prefix . 'modules') . ' WHERE ' . '(' . $db->quoteName('module') . ' = ' . $db->Quote($item) . ')' . ' AND (' . $db->quoteName('client_id') . ' = ' . $db->Quote($client) . ')' . ");\n"; $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'modules') . ' WHERE ' . '(' . $db->quoteName('module') . ' = ' . $db->Quote($item) . ')' . ' AND (' . $db->quoteName('client_id') . ' = ' . $db->Quote($client) . ')' . ";\n"; $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'extensions') . ' WHERE ' . $db->quoteName('element') . ' = ' . $db->Quote($item) . " AND " . $db->quoteName('type') . ' = ' . $db->Quote('module') . ";\n"; } } } } return $sql; }
protected function init() { // Fetch the configuration $config = AEFactory::getConfiguration(); $this->params = (object) array('type' => $config->get('core.filters.srp.type', 'component'), 'group' => $config->get('core.filters.srp.group', 'group'), 'name' => $config->get('core.filters.srp.name', 'name'), 'customdirs' => $config->get('core.filters.srp.customdirs', array()), 'customfiles' => $config->get('core.filters.srp.customfiles', array()), 'langfiles' => $config->get('core.filters.srp.langfiles', array())); $this->alloweddirs = array(); // Process custom directories if (is_array($this->params->customdirs)) { foreach ($this->params->customdirs as $dir) { $dir = $this->treatDirectory($dir); $this->alloweddirs[] = $dir; } } // Process custom files if (is_array($this->params->customfiles)) { foreach ($this->params->customfiles as $file) { $dir = dirname($file); $dir = $this->treatDirectory($dir); if (!in_array($dir, $this->strictalloweddirs)) { $this->strictalloweddirs[] = $dir; } if (!in_array($dir, $this->alloweddirs)) { $this->alloweddirs[] = $dir; } } } $this->alloweddirs[] = 'language'; $this->alloweddirs[] = 'administrator/language'; // Process core directorires switch ($this->params->type) { case 'component': $this->alloweddirs[] = 'components/com_' . $this->params->name; $this->alloweddirs[] = 'administrator/components/com_' . $this->params->name; $this->alloweddirs[] = 'media/com_' . $this->params->name; $this->alloweddirs[] = 'media/' . $this->params->name; break; case 'plugin': // This is required for Joomla! 1.5 compatibility $this->alloweddirs[] = 'plugins/' . $this->params->group; // This is required for Joomla! 1.6 compatibility $this->alloweddirs[] = 'plugins/' . $this->params->group . '/' . $this->params->name; break; case 'module': if ($this->params->group == 'admin') { $this->alloweddirs[] = 'administrator/modules/mod_' . $this->params->name; } else { $this->alloweddirs[] = 'modules/mod_' . $this->params->name; } break; case 'template': if ($this->params->group == 'admin') { $this->alloweddirs[] = 'administrator/templates/' . $this->params->name; } else { $this->alloweddirs[] = 'templates/' . $this->params->name; } break; default: $this->alloweddirs = array(); } }
public function &getExtraSQL($root) { $empty = ''; if ($root != '[SITEDB]') { return $empty; } $sql = ''; $db = AEFactory::getDatabase(); $this->getFilters(null); // Forcibly reload the filter data // Loop all components and add SQL statements if (!empty($this->filter_data)) { foreach ($this->filter_data as $type => $items) { if (!empty($items)) { // Make sure that DB only backups get the correct prefix $configuration = AEFactory::getConfiguration(); $abstract = AEUtilScripting::getScriptingParameter('db.abstractnames', 1); if ($abstract) { $prefix = '#__'; } else { $prefix = $db->getPrefix(); } foreach ($items as $item) { if (!$this->joomla16) { $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'components') . ' WHERE ' . $db->quoteName('option') . ' = ' . $db->Quote($item) . ";\n"; } else { $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'extensions') . ' WHERE ' . $db->quoteName('element') . ' = ' . $db->Quote($item) . " AND " . $db->quoteName('type') . ' = ' . $db->Quote('component') . ";\n"; } $sql .= 'DELETE FROM ' . $db->quoteName($prefix . 'menu') . ' WHERE ' . $db->quoteName('type') . ' = ' . $db->Quote('component') . ' AND ' . $db->quoteName('link') . ' LIKE ' . $db->Quote('%option=' . $item . '%') . ";\n"; } } } } return $sql; }
protected function scanFolder($folder, &$position, $forFolders = true, $threshold_key = 'dir', $threshold_default = 50) { $registry = AEFactory::getConfiguration(); // Initialize variables $arr = array(); $false = false; if (!is_dir($folder) && !is_dir($folder . '/')) { return $false; } try { $di = new DirectoryIterator($folder); } catch (Exception $e) { $this->setWarning('Unreadable directory ' . $folder); return $false; } if (!$di->valid()) { $this->setWarning('Unreadable directory ' . $folder); return $false; } if (!empty($position)) { $di->seek($position); if ($di->key() != $position) { $position = null; return $arr; } } $counter = 0; $maxCounter = $registry->get("engine.scan.large.{$threshold_key}_threshold", $threshold_default); while ($di->valid()) { if ($di->isDot()) { $di->next(); continue; } if ($di->isDir() != $forFolders) { $di->next(); continue; } $ds = $folder == '' || $folder == '/' || @substr($folder, -1) == '/' || @substr($folder, -1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR; $dir = $folder . $ds . $di->getFilename(); $data = _AKEEBA_IS_WINDOWS ? AEUtilFilesystem::TranslateWinPath($dir) : $dir; if ($data) { $counter++; $arr[] = $data; } if ($counter == $maxCounter) { break; } else { $di->next(); } } // Determine the new value for the position $di->next(); if ($di->valid()) { $position = $di->key() - 1; } else { $position = null; } return $arr; }
private function init() { // Fetch the configuration $config = AEFactory::getConfiguration(); $this->params = (object)array( 'skiptables' => $config->get('core.filters.srp.skiptables', array()) ); }
function __construct() { $this->object = 'dbobject'; $this->subtype = 'content'; $this->method = 'api'; if (AEFactory::getKettenrad()->getTag() == 'restorepoint') { $this->enabled = false; } }
function display() { $selfhealModel = JModel::getInstance('Selfheal','AkeebaModel'); $schemaok = $selfhealModel->healSchema(); $this->assign('schemaok', $schemaok); $registry =& AEFactory::getConfiguration(); // Set the toolbar title; add a help button JToolBarHelper::title(JText::_('AKEEBA').':: <small>'.JText::_('AKEEBA_CONTROLPANEL').'</small>','akeeba'); //JToolBarHelper::preferences('com_akeeba', '500', '660'); if($schemaok) { // Add submenus (those nifty text links below the toolbar!) // -- Configuration $link = JURI::base().'index.php?option='.JRequest::getCmd('option').'&view=config'; JSubMenuHelper::addEntry(JText::_('CONFIGURATION'), $link); // -- Backup Now $link = JURI::base().'index.php?option='.JRequest::getCmd('option').'&view=backup'; JSubMenuHelper::addEntry(JText::_('BACKUP'), $link); // -- Administer Backup Files $link = JURI::base().'index.php?option='.JRequest::getCmd('option').'&view=buadmin'; JSubMenuHelper::addEntry(JText::_('BUADMIN'), $link); // -- View log $link = JURI::base().'index.php?option='.JRequest::getCmd('option').'&view=log'; JSubMenuHelper::addEntry(JText::_('VIEWLOG'), $link); // Load the helper classes $this->loadHelper('utils'); $this->loadHelper('status'); $statusHelper = AkeebaHelperStatus::getInstance(); // Load the model akimport('models.statistics', true); $model =& $this->getModel(); $statmodel = new AkeebaModelStatistics(); $this->assign('icondefs', $model->getIconDefinitions()); // Icon definitions $this->assign('profileid', $model->getProfileID()); // Active profile ID $this->assign('profilelist', $model->getProfilesList()); // List of available profiles $this->assign('statuscell', $statusHelper->getStatusCell() ); // Backup status $this->assign('newscell', $statusHelper->getNewsCell() ); // News $this->assign('detailscell', $statusHelper->getQuirksCell() ); // Details (warnings) $this->assign('statscell', $statmodel->getLatestBackupDetails() ); $this->assign('fixedpermissions', $model->fixMediaPermissions() ); // Fix media/com_akeeba permissions // Add live help AkeebaHelperIncludes::addHelp(); } // Add references to CSS and JS files AkeebaHelperIncludes::includeMedia(false); parent::display(); }
/** * Creates a new database definition * @param string $uuid * @param array $data * @return bool */ public function setFilter($uuid, $data) { $filter = AEFactory::getFilterObject('extradirs'); $success = $filter->set($uuid, $data); $filters = AEFactory::getFilters(); if ($success) { $filters->save(); } return array('success' => $success, 'newstate' => false); }
/** * Creates a new regec filter * @param string $type Filter type * @param string $root The filter's root * @param string $string The filter string to remove * @return bool True on success */ public function setFilter($type, $root, $string) { $filter = AEFactory::getFilterObject($type); $success = $filter->set($root, $string); if ($success) { $filters = AEFactory::getFilters(); $filters->save(); } return $success; }
public function onAdd($tpl = null) { $aeconfig = AEFactory::getConfiguration(); // Load the Configuration Wizard Javascript file AkeebaStrapper::addJSfile('media://com_akeeba/js/confwiz.js'); // Add live help AkeebaHelperIncludes::addHelp('confwiz'); $this->setLayout('wizard'); return true; }
public function onStep($tpl = null) { $this->setLayout('step'); $kettenrad = AEFactory::getKettenrad(); $array = $kettenrad->getStatusArray(); $model = $this->getModel(); $key = $model->getState('key', ''); $this->array = $array; $this->key = $key; return true; }
function __construct() { $this->object = 'dbobject'; $this->subtype = 'all'; $this->method = 'direct'; if(AEFactory::getKettenrad()->getTag() == 'restorepoint') $this->enabled = false; if(empty($this->filter_name)) $this->filter_name = strtolower(basename(__FILE__,'.php')); parent::__construct(); }
/** * Runs a custom API call for the selected post-processing engine * * @return boolean */ public function dpeCustomAPICall() { $engine = $this->getState('engine'); $method = $this->getState('method'); $params = $this->getState('params', array()); $engine = AEFactory::getPostprocEngine($engine); if ($engine === false) { return false; } return $engine->customApiCall($method, $params); }
function __construct() { $this->object = 'file'; $this->subtype = 'all'; $this->method = 'api'; if (AEFactory::getKettenrad()->getTag() != 'restorepoint') { $this->enabled = false; } else { $this->init(); } }
public function onBeforeBrowse() { $result = parent::onBeforeBrowse(); if ($result) { $params = JComponentHelper::getParams('com_akeeba'); $model = $this->getThisModel(); $view = $this->getThisView(); /** @var AkeebaModelCpanels $model */ $view->setModel($model); $aeconfig = AEFactory::getConfiguration(); // Invalidate stale backups AECoreKettenrad::reset(array('global' => true, 'log' => false, 'maxrun' => $params->get('failure_timeout', 180))); // Just in case the reset() loaded a stale configuration... AEPlatform::getInstance()->load_configuration(); // Let's make sure the temporary and output directories are set correctly and writable... $wizmodel = F0FModel::getAnInstance('Confwiz', 'AkeebaModel'); $wizmodel->autofixDirectories(); // Check if we need to toggle the settings encryption feature $model->checkSettingsEncryption(); // Update the magic component parameters $model->updateMagicParameters(); // Run the automatic database check $model->checkAndFixDatabase(); // Run the automatic update site refresh /** @var AkeebaModelUpdates $updateModel */ $updateModel = F0FModel::getTmpInstance('Updates', 'AkeebaModel'); $updateModel->refreshUpdateSite(); // Check the last installed version and show the post-setup page on Joomla! 3.1 or earlier if (!version_compare(JVERSION, '3.2.0', 'ge')) { $versionLast = null; if (file_exists(JPATH_COMPONENT_ADMINISTRATOR . '/akeeba.lastversion.php')) { include_once JPATH_COMPONENT_ADMINISTRATOR . '/akeeba.lastversion.php'; if (defined('AKEEBA_LASTVERSIONCHECK')) { $versionLast = AKEEBA_LASTVERSIONCHECK; } } if (is_null($versionLast)) { $component = JComponentHelper::getComponent('com_akeeba'); if (is_object($component->params) && $component->params instanceof JRegistry) { $params = $component->params; } else { $params = new JParameter($component->params); } $versionLast = $params->get('lastversion', ''); } if (version_compare(AKEEBA_VERSION, $versionLast, 'ne') || empty($versionLast)) { $this->setRedirect('index.php?option=com_akeeba&view=postsetup'); return true; } } } return $result; }
private function init() { // Fetch the configuration $config = AEFactory::getConfiguration(); $this->params = (object)array( 'name' => $config->get('core.filters.srp.name', 'name'), 'extraprefixes' => $config->get('core.filters.srp.extraprefixes', array()), 'customtables' => $config->get('core.filters.srp.customtables', array()), 'skiptables' => $config->get('core.filters.srp.skiptables', array()) ); }
public function processPart($absolute_filename, $upload_as = null) { // Retrieve engine configuration data $config = AEFactory::getConfiguration(); $account = trim($config->get('engine.postproc.azure.account', '')); $key = trim($config->get('engine.postproc.azure.key', '')); $container = $config->get('engine.postproc.azure.container', 0); $directory = $config->get('volatile.postproc.directory', null); if (empty($directory)) { $directory = $config->get('engine.postproc.azure.directory', 0); } // Sanity checks if (empty($account)) { $this->setWarning('You have not set up your Windows Azure account name'); return false; } if (empty($key)) { $this->setWarning('You have not set up your Windows Azure key'); return false; } if (empty($container)) { $this->setWarning('You have not set up your Windows Azure container'); return false; } // Fix the directory name, if required if (!empty($directory)) { $directory = trim($directory); $directory = ltrim(AEUtilFilesystem::TranslateWinPath($directory), '/'); } else { $directory = ''; } // Parse tags $directory = AEUtilFilesystem::replace_archive_name_variables($directory); $config->set('volatile.postproc.directory', $directory); // Calculate relative remote filename $filename = basename($absolute_filename); if (!empty($directory) && $directory != '/') { $filename = $directory . '/' . $filename; } // Store the absolute remote path in the class property $this->remote_path = $filename; // Connect and send try { $blob = new AEUtilAzure(AEUtilAzureStorage::URL_CLOUD_BLOB, $account, $key); $policyNone = new AEUtilAzureNoRetryPolicy(); $blob->setRetryPolicy($policyNone); $blob->putBlob($container, $filename, $absolute_filename); } catch (Exception $e) { $this->setWarning($e->getMessage()); return false; } return true; }
private static function loadConfig() { $db = AEFactory::getDatabase(); $sql = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('element') . " = " . $db->q('com_akeeba')); $db->setQuery($sql); $config_ini = $db->loadResult(); // OK, Joomla! 1.6 stores values JSON-encoded so, what do I do? Right! $config_ini = json_decode($config_ini, true); if (is_null($config_ini) || empty($config_ini)) { $config_ini = array(); } return $config_ini; }
/** * Returns an array with domain keys and domain class names for the current * backup type. The idea is that shifting this array walks through the backup * process. When the array is empty, the backup is done. * @return array */ public static function getDomainChain() { $configuration = AEFactory::getConfiguration(); $script = $configuration->get('akeeba.basic.backup_type', 'full'); $scripting = self::loadScripting(); $domains = $scripting['domains']; $keys = $scripting['scripts'][$script]['chain']; $result = array(); foreach ($keys as $domain_key) { $result[] = array('domain' => $domains[$domain_key]['domain'], 'class' => $domains[$domain_key]['class']); } return $result; }