本文整理汇总了PHP中Akeeba\Engine\Factory::getConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getConfiguration方法的具体用法?PHP Factory::getConfiguration怎么用?PHP Factory::getConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akeeba\Engine\Factory
的用法示例。
在下文中一共展示了Factory::getConfiguration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAdd
protected function onAdd($tpl = null)
{
/** @var AkeebaModelCpanels $model */
$model = $this->getModel();
$aeconfig = Factory::getConfiguration();
// Load the helper classes
$this->loadHelper('utils');
$this->loadHelper('status');
$statusHelper = AkeebaHelperStatus::getInstance();
// Load the model
if (!class_exists('AkeebaModelStatistics')) {
JLoader::import('models.statistics', JPATH_COMPONENT_ADMINISTRATOR);
}
$statmodel = new AkeebaModelStatistics();
$this->profileid = $model->getProfileID();
// Active profile ID
$this->profilelist = $model->getProfilesList();
// List of available profiles
$this->statuscell = $statusHelper->getStatusCell();
// Backup status
$this->detailscell = $statusHelper->getQuirksCell();
// Details (warnings)
$this->statscell = $statmodel->getLatestBackupDetails();
$this->fixedpermissions = $model->fixMediaPermissions();
// Fix media/com_akeeba permissions
$this->needsdlid = $model->needsDownloadID();
$this->needscoredlidwarning = $model->mustWarnAboutDownloadIDInCore();
$this->extension_id = $model->getState('extension_id', 0, 'int');
// Should I ask for permission to display desktop notifications?
JLoader::import('joomla.application.component.helper');
$this->desktop_notifications = \Akeeba\Engine\Util\Comconfig::getValue('desktop_notifications', '0') ? 1 : 0;
$this->statsIframe = F0FModel::getTmpInstance('Stats', 'AkeebaModel')->collectStatistics(true);
return $this->onDisplay($tpl);
}
示例2: execute
/**
* Execute the JSON API task
*
* @param array $parameters The parameters to this task
*
* @return mixed
*
* @throws \RuntimeException In case of an error
*/
public function execute(array $parameters = array())
{
// Get the passed configuration values
$defConfig = array('profile' => -1, 'engineconfig' => array());
$defConfig = array_merge($defConfig, $parameters);
$profile = (int) $defConfig['profile'];
$data = $defConfig['engineconfig'];
if (empty($profile)) {
throw new \RuntimeException('Invalid profile ID', 404);
}
// 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 = Factory::getFilesystemTools()->translateStockDirs($folder, true, true);
$check = Factory::getFilesystemTools()->translateStockDirs('[SITEROOT]', true, true);
if ($check == $folder) {
$data['akeeba.basic.output_directory'] = '[DEFAULT_OUTPUT]';
}
}
// Merge it
$config = Factory::getConfiguration();
$protectedKeys = $config->getProtectedKeys();
$config->resetProtectedKeys();
$config->mergeArray($data, false, false);
$config->setProtectedKeys($protectedKeys);
// Save configuration
return Platform::getInstance()->save_configuration($profile);
}
示例3: getLogFiles
/**
* Get an array with the names of all log files in this backup profile
*
* @return string[]
*/
public function getLogFiles()
{
$configuration = Factory::getConfiguration();
$outdir = $configuration->get('akeeba.basic.output_directory');
$files = Factory::getFileLister()->getFiles($outdir);
$ret = array();
if (!empty($files) && is_array($files)) {
foreach ($files as $filename) {
$basename = basename($filename);
if (substr($basename, 0, 7) == 'akeeba.' && substr($basename, -4) == '.log' && $basename != 'akeeba.log') {
$tag = str_replace('akeeba.', '', str_replace('.log', '', $basename));
if (!empty($tag)) {
$parts = explode('.', $tag);
$key = array_pop($parts);
$key = str_replace('id', '', $key);
$key = is_numeric($key) ? sprintf('%015u', $key) : $key;
if (empty($parts)) {
$key = str_repeat('0', 15) . '.' . $key;
} else {
$key .= '.' . implode('.', $parts);
}
$ret[$key] = $tag;
}
}
}
}
krsort($ret);
return $ret;
}
示例4: onBeforeBrowse
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 = Factory::getConfiguration();
// Invalidate stale backups
Factory::resetState(array('global' => true, 'log' => false, 'maxrun' => $params->get('failure_timeout', 180)));
// Just in case the reset() loaded a stale configuration...
Platform::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();
}
return $result;
}
示例5: is_excluded_by_api
protected function is_excluded_by_api($test, $root)
{
static $from_datetime;
$config = Factory::getConfiguration();
if (is_null($from_datetime)) {
$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;
}
示例6: scanFolder
protected function scanFolder($folder, &$position, $forFolders = true, $threshold_key = 'dir', $threshold_default = 50)
{
$registry = Factory::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 ? Factory::getFilesystemTools()->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;
}
示例7: __construct
public function __construct()
{
$this->object = 'file';
$this->subtype = 'all';
$this->method = 'direct';
$this->filter_name = 'Excludefiles';
// We take advantage of the filter class magic to inject our custom filters
$allFiles = explode('|', Factory::getConfiguration()->get('akeeba.basic.exclude_files'));
$this->filter_data['[SITEROOT]'] = array_unique($allFiles);
parent::__construct();
}
示例8: __construct
public function __construct()
{
$this->object = 'file';
$this->subtype = 'all';
$this->method = 'regex';
$this->filter_name = 'Regexfilesext';
$extensions = Factory::getConfiguration()->get('akeeba.basic.file_extensions', 'php|phps|php3|inc');
$extensions = str_replace('.', '\\.', $extensions);
$this->filter_data['[SITEROOT]'] = array("!#\\.(" . $extensions . ")\$#");
parent::__construct();
}
示例9: __construct
public function __construct($config = array())
{
parent::__construct($config);
// Load the Akeeba Engine autoloader
define('AKEEBAENGINE', 1);
require_once JPATH_ADMINISTRATOR . '/components/com_admintools/engine/Autoloader.php';
// Load the platform
\Akeeba\Engine\Platform::addPlatform('filescan', JPATH_ADMINISTRATOR . '/components/com_admintools/platform/Filescan');
// Load the engine configuration
\Akeeba\Engine\Platform::getInstance()->load_configuration(1);
$this->aeconfig = \Akeeba\Engine\Factory::getConfiguration();
}
示例10: onBeforeBrowse
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 = Factory::getConfiguration();
// Invalidate stale backups
Factory::resetState(array('global' => true, 'log' => false, 'maxrun' => $params->get('failure_timeout', 180)));
// Just in case the reset() loaded a stale configuration...
Platform::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 JRegistry($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;
}
示例11: save_configuration
/**
* Saves the current configuration to the database table
*
* @param int $profile_id The profile where to save the configuration to, defaults to current profile
*
* @return bool True if everything was saved properly
*/
public function save_configuration($profile_id = null)
{
// If there is no embedded installer or the wrong embedded installer is selected, fix it automatically
$config = Factory::getConfiguration();
$embedded_installer = $config->get('akeeba.advanced.embedded_installer', null);
if (empty($embedded_installer) || $embedded_installer == 'angie-joomla') {
$protectedKeys = $config->getProtectedKeys();
$config->setProtectedKeys(array());
$config->set('akeeba.advanced.embedded_installer', 'angie');
$config->setProtectedKeys($protectedKeys);
}
// Save the configuration
return parent::save_configuration($profile_id);
// TODO: Change the autogenerated stub
}
示例12: get_storage_filename
/**
* Returns the fully qualified path to the storage file
*
* @param string $tag
*
* @return string
*/
public function get_storage_filename($tag = null)
{
static $basepath = null;
if ($this->storageEngine == 'db') {
return empty($tag) ? 'storage' : $tag;
} else {
if (is_null($basepath)) {
$registry = Factory::getConfiguration();
$basepath = $registry->get('akeeba.basic.output_directory') . DIRECTORY_SEPARATOR;
}
if (empty($tag)) {
$tag = 'storage';
}
return $basepath . 'akeeba_' . $tag;
}
}
示例13: onBeforeDispatch
/**
* Executes before dispatching the request to the appropriate controller
*/
public function onBeforeDispatch()
{
$this->onBeforeDispatchViewAliases();
// Load the FOF language
$lang = $this->container->platform->getLanguage();
$lang->load('lib_fof30', JPATH_SITE, 'en-GB', true, true);
$lang->load('lib_fof30', JPATH_SITE, null, true, false);
// Necessary defines for Akeeba Engine
if (!defined('AKEEBAENGINE')) {
define('AKEEBAENGINE', 1);
define('AKEEBAROOT', $this->container->backEndPath . '/BackupEngine');
define('ALICEROOT', $this->container->backEndPath . '/AliceEngine');
}
// Make sure we have a profile set throughout the component's lifetime
$session = $this->container->session;
$profile_id = $session->get('profile', null, 'akeeba');
if (is_null($profile_id)) {
$session->set('profile', 1, 'akeeba');
}
// Load Akeeba Engine
$basePath = $this->container->backEndPath;
require_once $basePath . '/BackupEngine/Factory.php';
// Load the Akeeba Engine configuration
Platform::addPlatform('joomla3x', JPATH_COMPONENT_ADMINISTRATOR . '/BackupPlatform/Joomla3x');
$akeebaEngineConfig = Factory::getConfiguration();
Platform::getInstance()->load_configuration();
unset($akeebaEngineConfig);
// Prevents the "SQLSTATE[HY000]: General error: 2014" due to resource sharing with Akeeba Engine
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// !!!!! WARNING: ALWAYS GO THROUGH JFactory; DO NOT GO THROUGH $this->container->db !!!!!
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$jDbo = JFactory::getDbo();
if ($jDbo->name == 'pdomysql') {
@JFactory::getDbo()->disconnect();
}
// Load the utils helper library
Platform::getInstance()->load_version_defines();
// Make sure we have a version loaded
@(include_once $this->container->backEndPath . '/components/com_akeeba/version.php');
if (!defined('AKEEBA_VERSION')) {
define('AKEEBA_VERSION', 'dev');
define('AKEEBA_DATE', date('Y-m-d'));
}
// Create a media file versioning tag
$this->container->mediaVersion = md5(AKEEBA_VERSION . AKEEBA_DATE);
}
示例14: __construct
public function __construct()
{
$this->object = 'dir';
$this->subtype = 'all';
$this->method = 'direct';
$this->filter_name = 'Excludefolders';
// Get the site's root
$configuration = Factory::getConfiguration();
if ($configuration->get('akeeba.platform.override_root', 0)) {
$root = $configuration->get('akeeba.platform.newroot', '[SITEROOT]');
} else {
$root = '[SITEROOT]';
}
// We take advantage of the filter class magic to inject our custom filters
$this->filter_data[$root] = array('awstats', 'cgi-bin');
parent::__construct();
}
示例15: onAdd
protected function onAdd($tpl = null)
{
/** @var AkeebaModelCpanels $model */
$model = $this->getModel();
/**
$selfhealModel = F0FModel::getTmpInstance('Selfheal','AkeebaModel');
$schemaok = $selfhealModel->healSchema();
/**/
$schemaok = true;
$this->schemaok = $schemaok;
$aeconfig = Factory::getConfiguration();
if ($schemaok) {
// Load the helper classes
$this->loadHelper('utils');
$this->loadHelper('status');
$statusHelper = AkeebaHelperStatus::getInstance();
// Load the model
if (!class_exists('AkeebaModelStatistics')) {
JLoader::import('models.statistics', JPATH_COMPONENT_ADMINISTRATOR);
}
$statmodel = new AkeebaModelStatistics();
$this->icondefs = $model->getIconDefinitions();
// Icon definitions
$this->profileid = $model->getProfileID();
// Active profile ID
$this->profilelist = $model->getProfilesList();
// List of available profiles
$this->statuscell = $statusHelper->getStatusCell();
// Backup status
$this->detailscell = $statusHelper->getQuirksCell();
// Details (warnings)
$this->statscell = $statmodel->getLatestBackupDetails();
$this->fixedpermissions = $model->fixMediaPermissions();
// Fix media/com_akeeba permissions
$this->update_plugin = $model->isUpdatePluginEnabled();
$this->needsdlid = $model->needsDownloadID();
$this->needscoredlidwarning = $model->mustWarnAboutDownloadIDInCore();
$this->hasPostInstallationMessages = $model->hasPostInstallMessages();
$this->extension_id = $model->getState('extension_id', 0, 'int');
// Add live help
AkeebaHelperIncludes::addHelp('cpanel');
$this->statsIframe = F0FModel::getTmpInstance('Stats', 'AkeebaModel')->collectStatistics(true);
}
return $this->onDisplay($tpl);
}