当前位置: 首页>>代码示例>>PHP>>正文


PHP sfSympalConfig::writeSetting方法代码示例

本文整理汇总了PHP中sfSympalConfig::writeSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP sfSympalConfig::writeSetting方法的具体用法?PHP sfSympalConfig::writeSetting怎么用?PHP sfSympalConfig::writeSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfSympalConfig的用法示例。


在下文中一共展示了sfSympalConfig::writeSetting方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: install

 public function install()
 {
     if ($this->getOption('uninstall_first')) {
         $uninstall = new sfSympalPluginManagerUninstall($this->_pluginName, $this->_configuration, $this->_formatter);
         $uninstall->setOption('publish_assets', false);
         $uninstall->uninstall();
     }
     $this->logSection('sympal', sprintf('Installing Sympal plugin named "%s"', $this->_pluginName));
     try {
         if ($this->getOption('create_tables')) {
             $this->_createDatabaseTables();
         }
         if ($this->getOption('load_data')) {
             $this->_loadData();
         }
         if ($this->getOption('publish_assets')) {
             $this->_publishAssets();
         }
         if ($this->getOption('clear_cache')) {
             $this->_clearCache();
         }
         sfSympalConfig::writeSetting($this->_pluginName, 'installed', true);
     } catch (Exception $e) {
         $uninstall = new sfSympalPluginManagerUninstall($this->_pluginName, $this->_configuration);
         $uninstall->uninstall();
         throw $e;
     }
 }
开发者ID:sympal,项目名称:sympal,代码行数:28,代码来源:sfSympalPluginManagerInstall.class.php

示例2: uninstall

 public function uninstall($delete = null)
 {
     if ($delete !== null) {
         $this->setOption('delete_plugin_files', $delete);
     }
     $this->logSection('sympal', sprintf('Uninstalling Sympal plugin named "%s"', $this->_pluginName));
     if ($this->hasModels()) {
         if ($this->getOption('build_all_classes')) {
             $this->_buildAllClasses();
         }
         if ($this->getOption('delete_related_data')) {
             $this->_deleteRelatedData();
         }
         if ($this->getOption('delete_other_data')) {
             $this->_deleteOtherData();
         }
         if ($this->getOption('drop_database_tables')) {
             $this->_dropDatabaseTables();
         }
     }
     if ($this->getOption('run_custom_install')) {
         $this->_runCustomUninstall();
     }
     if ($this->getOption('delete_plugin_files')) {
         $this->_deletePluginFiles();
     }
     if ($this->getOption('publish_assets')) {
         $this->_publishAssets();
     }
     $this->_clearCache();
     sfSympalConfig::writeSetting($this->_pluginName, 'installed', false);
 }
开发者ID:sympal,项目名称:sympal,代码行数:32,代码来源:sfSympalPluginManagerUninstall.class.php

示例3: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     foreach ($arguments['configure'] as $value) {
         list($key, $value) = explode('=', $value);
         $e = explode('.', $key);
         $group = isset($e[1]) ? $e[0] : null;
         $key = isset($e[1]) ? $e[1] : $e[0];
         $value = is_numeric($value) ? (int) $value : $value;
         $value = $value == 'false' ? false : $value;
         $value = $value == 'true' ? true : $value;
         $infoValue = $value;
         if (in_array(substr($value, 0, 1), array('[', '{'))) {
             $value = sfYamlInline::load($value);
             $infoValue = 'YAML: ' . $infoValue;
         }
         $writeToApp = isset($options['application']) && $options['application'] ? true : false;
         if ($group) {
             $this->logSection('sympal', sprintf('Writing setting "%s" with a value of "%s" under the "%s" group.', $key, $infoValue, $group));
             sfSympalConfig::writeSetting($group, $key, $value, $writeToApp);
         } else {
             $this->logSection('sympal', sprintf('Writing setting "%s" with a value of "%s".', $key, $infoValue, $group));
             sfSympalConfig::writeSetting($key, $value, null, $writeToApp);
         }
     }
 }
开发者ID:sympal,项目名称:sympal,代码行数:28,代码来源:sfSympalConfigureTask.class.php

示例4: upgrade

 public function upgrade()
 {
     $result = parent::upgrade();
     $versionHistory = sfSympalConfig::get('upgrade_version_history', null, array());
     $versionHistory[] = $this->_version . '__' . $this->_number;
     sfSympalConfig::writeSetting('upgrade_version_history', $versionHistory);
     return $result;
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:8,代码来源:sfSympalVersionUpgrade.class.php

示例5: install

 /**
  * Actually runs the installation - this is the main entry point for
  * installing sympal
  */
 public function install()
 {
     // set params as sfConfig variables for global access
     $this->_prepareParams();
     // throw a sympal.pre_install event
     $this->_dispatcher->notify(new sfEvent($this, 'sympal.pre_install', array('configuration' => $this->_configuration, 'dispatcher' => $this->_dispatcher, 'formatter' => $this->_formatter)));
     // The main installation stream
     $tasks = array('_setupDatabase', '_buildAllClasses', '_copyFixtures', '_createSite', '_loadData', '_installAddonPlugins', '_executePostInstallSql', '_executePostInstallHooks', '_publishAssets', '_clearCache', '_primeCache');
     foreach ($tasks as $task) {
         $this->logBlank();
         $this->{$task}();
     }
     sfSympalConfig::writeSetting('installed', true);
     sfSympalConfig::writeSetting('current_version', sfSympalPluginConfiguration::VERSION);
     $this->_dispatcher->notify(new sfEvent($this, 'sympal.post_install', array('configuration' => $this->_configuration, 'dispatcher' => $this->_dispatcher, 'formatter' => $this->_formatter)));
     // Run fix permissions to ensure a 100% ready to go environment
     $this->_fixPerms();
 }
开发者ID:sympal,项目名称:sympal,代码行数:22,代码来源:sfSympalInstall.class.php

示例6: executeMake_default

 public function executeMake_default(sfWebRequest $request)
 {
     $theme = $request->getParameter('name');
     if ($request->getParameter('site')) {
         $site = $this->getSympalContext()->getService('site_manager')->getSite();
         $this->askConfirmation(__('Are you sure?'), sprintf(__('This action will change the default theme to "%s" for the "%s" site.'), $theme, $site->getTitle()));
         if ($site->getTheme() == $theme) {
             $site->setTheme(null);
         } else {
             $site->setTheme($theme);
         }
         $site->save();
     } else {
         $this->askConfirmation(__('Are you sure?'), sprintf(__('This action will change the global default theme to "%s"'), $theme));
         sfSympalConfig::writeSetting('theme', 'default_theme', $theme);
     }
     $this->clearCache();
     $this->getUser()->setFlash('notice', __('Theme successfully changed!'));
     $this->redirect('@sympal_themes');
 }
开发者ID:sympal,项目名称:sympal,代码行数:20,代码来源:Basesympal_themesActions.class.php

示例7: dirname

<?php

$app = 'sympal';
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new lime_test(6);
sfSympalConfig::set('test', true);
$t->is(sfSympalConfig::get('test'), true, '->get() works with just one argument');
sfSympalConfig::set('group', 'test', true);
$t->is(sfSympalConfig::get('group', 'test'), true, '->get() works using the group arugment');
$t->is(sfSympalConfig::get('doesnt_exists', null, 'default_value'), 'default_value', '->get() returns a default value if the key does not exist');
sfSympalConfig::writeSetting('test_write_value', 1);
$path = sfConfig::get('sf_config_dir') . '/app.yml';
$array = (array) sfYaml::load(file_get_contents($path));
$t->is(isset($array['all']['sympal_config']['test_write_value']), true, '->writeSetting() writes out correctly to the config/app.yml file');
$t->is(sfSympalConfig::isI18nEnabled(), false, '->isI18nEnabled() correctly returns false');
$t->is(sfSympalConfig::isI18nEnabled('sfSympalContent'), false, '->isI18nEnabled($modelName) correctly returns false');
开发者ID:sympal,项目名称:sympal,代码行数:16,代码来源:sfSympalConfigTest.php

示例8: _doUpgrade

 /**
  * Runs the upgrade and then writes the latest version to config
  */
 protected function _doUpgrade()
 {
     parent::_doUpgrade();
     sfSympalConfig::writeSetting('current_version', $this->getLatestVersion());
 }
开发者ID:sympal,项目名称:sympal,代码行数:8,代码来源:sfSympalUpgradeFromWeb.class.php

示例9: dirname

<?php

if (!isset($app)) {
    $app = 'sympal';
}
require_once dirname(__FILE__) . '/../fixtures/project/config/ProjectConfiguration.class.php';
$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true);
require_once dirname(__FILE__) . '/../bootstrap/cleanup.php';
sfSympalConfig::writeSetting('installed', false);
sfContext::createInstance($configuration);
$browser = new sfSympalTestFunctional(new sfBrowser());
$browser->get('/install');
$install = array('install' => array('user' => array('first_name' => 'Jonathan', 'last_name' => 'Wage', 'email_address' => 'jonwage@gmail.com', 'username' => 'jwage', 'password' => 'changeme', 'password_again' => 'changeme')));
$browser->click('Install Now', $install)->with('response')->begin()->isRedirected()->followRedirect()->end()->with('request')->begin()->isParameter('module', 'sympal_dashboard')->end()->with('user')->begin()->isAuthenticated()->end();
sfSympalConfig::writeSetting('installed', true);
开发者ID:slemoigne,项目名称:sympal,代码行数:15,代码来源:InstallTest.php

示例10: install

 /**
  * Actually runs the installation - this is the main entry point for
  * installing sympal
  */
 public function install()
 {
     $this->_dispatcher->notify(new sfEvent($this, 'sympal.pre_install', array('configuration' => $this->_configuration, 'dispatcher' => $this->_dispatcher, 'formatter' => $this->_formatter)));
     sfSympalConfig::set('installing', true);
     $this->_createWebCacheDirectory();
     $this->_prepareParams();
     if ($this->getOption('build_classes')) {
         $this->_buildAllClasses();
     }
     $dbExists = $this->checkSympalDatabaseExists();
     // If database does not exist or we are forcing a reinstall then lets do a full install
     if (!$dbExists || $this->getOption('force_reinstall')) {
         $this->_setupDatabase();
         $this->_loadData();
         $this->_createSite();
         $this->_installAddonPlugins();
         $this->_executePostInstallSql();
         $this->_executePostInstallHooks();
         $this->_publishAssets();
         $this->_clearCache();
         $this->_primeCache();
         // Delete site and recreate it
     } else {
         Doctrine_Manager::connection()->execute('delete from sf_sympal_site where slug = ?', array($this->_application));
         $this->_createSite();
         $this->_clearCache();
         $this->_primeCache();
     }
     sfSympalConfig::writeSetting('installed', true);
     sfSympalConfig::set('installing', false);
     sfSympalConfig::writeSetting('current_version', sfSympalPluginConfiguration::VERSION);
     $this->_dispatcher->notify(new sfEvent($this, 'sympal.post_install', array('configuration' => $this->_configuration, 'dispatcher' => $this->_dispatcher, 'formatter' => $this->_formatter)));
     // Run fix permissions to ensure a 100% ready to go environment
     $this->_fixPerms();
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:39,代码来源:sfSympalInstall.class.php

示例11: dirname

<?php

require_once dirname(__FILE__) . '/../bootstrap/functional.php';
$browser = new sfSympalTestFunctional(new sfBrowser());
$browser->signInAsAdmin();
$browser->get('/admin/configuration')->click('Save', array('settings' => array('breadcrumbs_separator' => ' / ', 'plugin_api' => array('username' => 'test', 'password' => 'test'))));
$after = sfYaml::load(sfConfig::get('sf_app_dir') . '/config/app.yml');
$t = $browser->test();
$t->is($after['all']['sympal_config']['breadcrumbs_separator'], ' / ', 'Test breadcrumbs separator saved');
$t->is($after['all']['sympal_config']['plugin_api']['username'], 'test', 'Test plugin_api.username saved');
$t->is($after['all']['sympal_config']['plugin_api']['password'], 'test', 'Test plugin_api.password saved');
sfSympalConfig::writeSetting('breadcrumbs_separator', ' / ');
开发者ID:sympal,项目名称:sympal,代码行数:12,代码来源:ConfigurationTest.php


注:本文中的sfSympalConfig::writeSetting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。