本文整理汇总了PHP中AEPlatform::save_configuration方法的典型用法代码示例。如果您正苦于以下问题:PHP AEPlatform::save_configuration方法的具体用法?PHP AEPlatform::save_configuration怎么用?PHP AEPlatform::save_configuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AEPlatform
的用法示例。
在下文中一共展示了AEPlatform::save_configuration方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apply
/**
* 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]';
}
}
if( array_key_exists('akeeba.basic.temporary_directory', $data) )
{
$folder = $data['akeeba.basic.temporary_directory'];
$folder = AEUtilFilesystem::translateStockDirs( $folder, true, true );
$check = AEUtilFilesystem::translateStockDirs( '[SITEROOT]', true, true );
if($check == $folder)
{
JError::raiseWarning(503, JText::_('CONFIG_TMPDIR_ROOT'));
$data['akeeba.basic.temporary_directory'] = '[SITETMP]';
}
}
// Merge it
$config =& AEFactory::getConfiguration();
$config->mergeArray($data, false, false);
// Save configuration
AEPlatform::save_configuration();
$this->setRedirect(JURI::base().'index.php?option='.JRequest::getCmd('option').'&view=config', JText::_('CONFIG_SAVE_OK'));
}
示例2: partsize
/**
* Creates a dummy file of a given size. Remember to give the filesize
* query parameter in bytes!
*/
public function partsize()
{
$timer = AEFactory::getTimer();
$blocks = JRequest::getInt('blocks', 1);
$model = JModel::getInstance('Confwiz','AkeebaModel');
$result = $model->createTempFile($blocks);
if($result) {
// Save the setting
if($blocks > 200) $blocks = 16383; // Over 25Mb = 2Gb minus 128Kb limit (safe setting for PHP not running on 64-bit Linux)
$profile_id = AEPlatform::get_active_profile();
$config = AEFactory::getConfiguration();
$config->set('engine.archiver.common.part_size', $blocks * 128 * 1024);
AEPlatform::save_configuration($profile_id);
}
// Enforce the min exec time
$timer->enforce_min_exec_time(false);
return $result;
}
示例3: applyTransferSettings
/**
* Apply the transfer settings to the profile. Returns true if the connection
* and uploading a test file works properly, an error message otherwise
*
* @return bool|string
*/
public function applyTransferSettings()
{
// Get state variables
$method = $this->getState('method');
$hostname = $this->getState('hostname');
$port = $this->getState('port');
$username = $this->getState('username');
$password = $this->getState('password');
$directory = $this->getState('directory');
$passive = $this->getState('passive');
$livesite = $this->getState('livesite');
// Fix the hostname, in case the user added a protocol (grr...)
$protoPos = strpos($hostname,'://');
if($protoPos !== false) {
$proto = substr($hostname, 0, $protoPos-1);
$proto = strtolower($proto);
switch($proto) {
case 'ftp':
$method = 'ftp';
break;
case 'ftps':
case 'ftpes':
$method = 'ftps';
break;
case 'sftp':
$method = 'sftp';
break;
}
$hostname = substr($hostname, $protoPos+3);
}
// Assign default configuration variables
$config = AEFactory::getConfiguration();
$config->set('akeeba.basic.backup_type','full');
$config->set('akeeba.advanced.proc_engine','none');
if( (substr($livesite, 0, 7) != 'http://') && (substr($livesite, 0, 8) != 'https://') ) {
$livesite = 'http://'.$livesite;
}
$livesite = rtrim($livesite,"/\n\r ");
$config->set('akeeba.stw.livesite', $livesite);
// Apply the transfer settings
switch($method) {
case 'ftp':
case 'ftps':
$config->set('akeeba.advanced.archiver_engine', 'directftp');
$config->set('engine.archiver.directftp.host', $hostname);
$config->set('engine.archiver.directftp.port', $port);
$config->set('engine.archiver.directftp.user', $username);
$config->set('engine.archiver.directftp.pass', $password);
$config->set('engine.archiver.directftp.initial_directory', $directory);
$config->set('engine.archiver.directftp.ftps', ($method == 'ftps' ? 1 : 0));
$config->set('engine.archiver.directftp.passive_mode', ($passive ? 1 : 0));
break;
case 'sftp':
$config->set('akeeba.advanced.archiver_engine', 'directsftp');
$config->set('engine.archiver.directsftp.host', $hostname);
$config->set('engine.archiver.directsftp.port', $port);
$config->set('engine.archiver.directsftp.user', $username);
$config->set('engine.archiver.directsftp.pass', $password);
$config->set('engine.archiver.directsftp.initial_directory', $directory);
break;
}
AEPlatform::save_configuration();
// Connection test
switch($method) {
case 'ftp':
case 'ftps':
$config = array(
'host' => $config->get('engine.archiver.directftp.host'),
'port' => $config->get('engine.archiver.directftp.port'),
'user' => $config->get('engine.archiver.directftp.user'),
'pass' => $config->get('engine.archiver.directftp.pass'),
'initdir' => $config->get('engine.archiver.directftp.initial_directory'),
'usessl' => $config->get('engine.archiver.directftp.ftps'),
'passive' => $config->get('engine.archiver.directftp.passive_mode')
);
$test = new AEArchiverDirectftp();
$test->initialize('', $config);
$errors = $test->getError();
break;
case 'sftp':
$config = array(
'host' => $config->get('engine.archiver.directsftp.host'),
'port' => $config->get('engine.archiver.directsftp.port'),
'user' => $config->get('engine.archiver.directsftp.user'),
'pass' => $config->get('engine.archiver.directsftp.pass'),
'initdir' => $config->get('engine.archiver.directsftp.initial_directory')
);
//.........这里部分代码省略.........
示例4: _apiUpdateCleanup
private function _apiUpdateCleanup($config) {
$session =& JFactory::getSession();
$session->set('profile', 1, 'akeeba');
AEPlatform::load_configuration(1);
$config = AEFactory::getConfiguration();
$target = $config->get('remoteupdate.target', '');
$tempdir = $config->get('remoteupdate.tempdir', '');
$session = JFactory::getSession();
$session->set('target', $target, 'liveupdate');
$session->set('tempdir', $tempdir, 'liveupdate');
require_once JPATH_ROOT.'/administrator/components/com_akeeba/liveupdate/liveupdate.php';
require_once JPATH_ROOT.'/administrator/components/com_akeeba/liveupdate/classes/model.php';
$model = new LiveupdateModel();
$ret = $model->cleanup();
jimport('joomla.filesystem.file');
JFile::delete($target);
$config->set('remoteupdate.target', null);
$config->set('remoteupdate.tempdir', null);
AEPlatform::save_configuration(1);
return (object)array(
'cleanup' => 1
);
}