本文整理汇总了PHP中Configure::dump方法的典型用法代码示例。如果您正苦于以下问题:PHP Configure::dump方法的具体用法?PHP Configure::dump怎么用?PHP Configure::dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configure
的用法示例。
在下文中一共展示了Configure::dump方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reset
function reset()
{
Configure::write('Authake.baseUrl', Router::url('/', true));
// set the full application url
Configure::write('Authake.service', 'Authake');
//Name of the service i.e. "Super Authake"
Configure::write('Authake.loginAction', array('plugin' => 'authake', 'controller' => 'user', 'action' => 'login', 'admin' => 0));
Configure::write('Authake.loggedAction', Configure::read('Authake.baseUrl'));
Configure::write('Authake.sessionTimeout', 3600 * 24 * 7);
Configure::write('Authake.defaultDeniedAction', array('plugin' => 'authake', 'controller' => 'user', 'action' => 'denied', 'admin' => 0));
Configure::write('Authake.rulesCacheTimeout', 300);
Configure::write('Authake.systemEmail', 'noreply@example.com');
Configure::write('Authake.systemReplyTo', 'noreply@example.com');
Configure::write('Authake.passwordVerify', true);
Configure::write('Authake.registration', true);
//or false
Configure::write('Authake.defaultGroup', 2);
//could be array or single number
Configure::write('Authake.useDefaultLayout', false);
//could be true or false
Configure::write('Authake.useEmailAsUsername', false);
//could be true or false
Configure::dump('authake_config.php', 'Authake', array('Authake'));
$this->Session->setFlash(__('Authake Reset'), 'success');
$this->redirect(array('action' => 'index'));
}
示例2: initialImport
/**
* initialImport methode
* import the data initial in the table
*/
protected function initialImport()
{
if (Configure::read('historic_behavior.' . $this->config()['class'] . '.initialImport')) {
return;
} elseif (!$this->_table->find()->count() || $this->_table->Historics->find()->count()) {
return;
} else {
$fields = $this->config()['fields'];
$tableEntities = $this->_table->find()->toArray();
foreach ($tableEntities as $key => $entity) {
foreach ($fields as $key => $value) {
$historic[$value] = $entity->get($value);
}
$historicData[] = $historic;
}
$historicEntities = $this->_table->Historics->newEntities($historicData);
debug($historicEntities);
Configure::write('historic_behavior.' . $this->config()['class'] . '.initialImport', false);
foreach ($historicEntities as $key => $historicEntity) {
if (!$this->_table->Historics->save($historicEntity)) {
Configure::write('historic_behavior.' . $this->config()['class'] . '.initialImport', true);
Configure::dump('historic', 'default', ['historic_behavior']);
return;
}
}
Configure::dump('historic', 'default', ['historic_behavior']);
}
}
示例3: testDump
public function testDump()
{
$this->_configTestFile(TMP);
Configure::write('TestYaml', 'test');
$result = Configure::dump('YamlReaderTest', 'YamlTestConfig', array('TestYaml'));
$this->assertTrue(!empty($result));
$fileExpected = TMP . 'YamlReaderTest.yml';
$result = file_exists($fileExpected);
$this->assertTrue($result);
if ($result) {
unlink($fileExpected);
}
}
示例4: testDumpPartial
/**
* Test dumping only some of the data.
*
* @return void
*/
public function testDumpPartial()
{
Configure::config('test_reader', new PhpReader(TMP));
$result = Configure::dump('config_test.php', 'test_reader', array('Error'));
$this->assertTrue($result > 0);
$result = file_get_contents(TMP . 'config_test.php');
$this->assertContains('<?php', $result);
$this->assertContains('$config = ', $result);
$this->assertContains('Error', $result);
$this->assertNotContains('debug', $result);
if (file_exists(TMP . 'config_test.php')) {
unlink(TMP . 'config_test.php');
}
}
示例5: serverSettingsSaveValue
public function serverSettingsSaveValue($setting, $value)
{
Configure::write($setting, $value);
Configure::dump('config.php', 'default', array('MISP', 'GnuPG', 'Proxy', 'SecureAuth', 'Security', 'debug', 'Plugin'));
}
示例6: index
public function index()
{
if (!empty($this->request->data['Setting'])) {
$this->Setting->setOption('title', $this->request->data['Setting']['title']);
$this->Setting->setOption('homePage', $this->request->data['Setting']['homePage']);
if (!empty($this->request->data['Setting']['notifications'])) {
$notifications = array();
$notifications['enabled'] = $this->request->data['Setting']['notifications']['enabled'];
$notifications['signup'] = $this->request->data['Setting']['notifications']['signup'];
$notifications['comments'] = $this->request->data['Setting']['notifications']['comments'];
$notifications['contact'] = $this->request->data['Setting']['notifications']['contact'];
$this->Setting->setOption('notifications', json_encode($notifications));
}
$this->Cookie->write('Lang', $this->request->data['Setting']['sitelang'], false, '+4 weeks');
$databaseConfig = Configure::read('Database');
$settingsConfig = Configure::read('Settings');
$settingsConfig['language'] = $this->request->data['Setting']['sitelang'];
// Site lang
Configure::write('Database', $this->Tools->quoteArray($databaseConfig));
Configure::write('Settings', $this->Tools->quoteArray($settingsConfig));
Configure::dump('config.ini', 'configini', array('Database', 'Settings'));
if (!empty($this->request->data['Setting']['email'])) {
$email = array();
$email['name'] = $this->request->data['Setting']['email']['name'];
$email['from'] = $this->request->data['Setting']['email']['from'];
$email['encoding'] = $this->request->data['Setting']['email']['utf8'] ? 'utf8' : '';
$email['transport'] = $this->request->data['Setting']['email']['transport'];
$email['host'] = $this->request->data['Setting']['email']['host'];
$email['port'] = $this->request->data['Setting']['email']['port'];
$email['username'] = $this->request->data['Setting']['email']['username'];
$email['password'] = $this->request->data['Setting']['email']['password'];
$this->Setting->setOption('email', json_encode($email));
}
$this->Setting->setOption('timezone', $this->request->data['Setting']['timezone']);
$this->Session->setFlash(__('Settings have been updated'), 'flash_success');
return $this->redirect('/admin/settings');
}
// General
$this->request->data['Setting']['title'] = $this->Setting->getOption('title');
$this->request->data['Setting']['homePage'] = $this->Setting->getOption('homePage');
$pagesList = $this->Page->find('list', array('order' => 'title'));
$this->set('pagesList', $pagesList);
$notifications = json_decode($this->Setting->getOption('notifications'));
if (!empty($notifications)) {
$this->request->data['Setting']['notifications']['enabled'] = $notifications->enabled;
$this->request->data['Setting']['notifications']['signup'] = $notifications->signup;
$this->request->data['Setting']['notifications']['comments'] = $notifications->comments;
$this->request->data['Setting']['notifications']['contact'] = $notifications->contact;
}
// Langs
$this->request->data['Setting']['sitelang'] = Configure::read('Settings.language');
// Timezone
$this->request->data['Setting']['timezone'] = $this->Setting->getOption('timezone');
// Emails
$email = json_decode($this->Setting->getOption('email'));
if (!empty($email)) {
$this->request->data['Setting']['email']['name'] = $email->name;
$this->request->data['Setting']['email']['from'] = $email->from;
$this->request->data['Setting']['email']['utf8'] = $email->encoding == 'utf8' ? true : false;
$this->request->data['Setting']['email']['transport'] = $email->transport;
$this->request->data['Setting']['email']['host'] = $email->host;
$this->request->data['Setting']['email']['port'] = $email->port;
$this->request->data['Setting']['email']['username'] = $email->username;
$this->request->data['Setting']['email']['password'] = $email->password;
} else {
$host = substr_count($_SERVER['HTTP_HOST'], '.') > 1 ? substr($_SERVER['HTTP_HOST'], strpos($_SERVER['HTTP_HOST'], '.') + 1) : $_SERVER['HTTP_HOST'];
$host = strpos($host, ':') !== false ? substr($host, 0, strpos($host, ':')) : $host;
// Remove port if present on unusual configurations
$this->request->data['Setting']['email']['name'] = 'MushRaider';
$this->request->data['Setting']['email']['from'] = 'mushraider@' . $host;
$this->request->data['Setting']['email']['utf8'] = false;
}
}
示例7: updateJson
/**
* Find list and save yaml dump in app/Config/settings.json file.
* Data required in bootstrap.
*
* @return void
*/
public function updateJson()
{
$settings = $this->find('all', array('fields' => array('key', 'value'), 'order' => array('Setting.key' => 'ASC')));
$settings = array_combine(Hash::extract($settings, '{n}.Setting.key'), Hash::extract($settings, '{n}.Setting.value'));
Configure::write($settings);
foreach ($settings as $key => $setting) {
list($key, $ignore) = explode('.', $key, 2);
$keys[] = $key;
}
$keys = array_unique($keys);
Configure::dump('settings.json', 'settings', $keys);
}
示例8: step4
public function step4()
{
$siteSettings = $this->Session->read('siteSettings');
App::uses('User', 'Model');
$userModel = new User();
$toSave = array();
$toSave['role_id'] = 1;
$toSave['username'] = $siteSettings['siteInfos']['adminlogin'];
$toSave['password'] = $siteSettings['siteInfos']['adminpassword'];
$toSave['email'] = $siteSettings['siteInfos']['adminemail'];
$toSave['status'] = 1;
$toSave['activation_key'] = md5(uniqid());
$toSave['calendar_key'] = uniqid();
$userModel->create();
if ($userModel->save($toSave)) {
$this->postInstallData($siteSettings['siteInfos']['siteTitle']);
$settingsConfig['installed'] = true;
$siteSettings['siteInfos']['settingsConfig']['installed'] = true;
Configure::write('Database', $this->Tools->quoteArray($this->Session->read('database')));
Configure::write('Settings', $this->Tools->quoteArray($siteSettings['siteInfos']['settingsConfig']));
Configure::dump('config.ini', 'configini', array('Database', 'Settings'));
$this->Session->delete('Settings');
$this->Session->delete('database');
$this->Session->delete('siteSettings');
$this->Session->setFlash(__('MushRaider successfully install !'), 'flash_success');
$this->redirect('/auth/login');
} else {
$this->Session->setFlash(__('MushRaider can\'t create admin user, please try again.'), 'flash_error');
$flashed = true;
}
}