本文整理汇总了PHP中ProjectConfiguration::getApplicationConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectConfiguration::getApplicationConfiguration方法的具体用法?PHP ProjectConfiguration::getApplicationConfiguration怎么用?PHP ProjectConfiguration::getApplicationConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectConfiguration
的用法示例。
在下文中一共展示了ProjectConfiguration::getApplicationConfiguration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute($arguments = array(), $options = array())
{
$configuration = ProjectConfiguration::getApplicationConfiguration($options['application'], $options['env'], true);
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
$oBilling = new BillingClass();
$oBilling->puserDailyPayment();
$q = Doctrine_Query::create()->from('BalanceUser bu')->innerJoin('bu.User u')->where('bu.payable > 0')->andWhere('bu.was_paid = 0')->andWhere('u.active = 1')->andWhere('u.utype = "puser"')->groupBy('bu.id_user')->execute();
$frontendRouting = new sfPatternRouting(new sfEventDispatcher());
$config = new sfRoutingConfigHandler();
$routes = $config->evaluate(array(sfConfig::get('sf_apps_dir') . '/frontend/config/routing.yml'));
$frontendRouting->setRoutes($routes);
foreach ($q as $rec) {
if (!preg_match('/^R[0-9]{12}$/', $rec->getUser()->getAccountNumber())) {
$email = $rec->getUser()->getEmail();
$url = 'http://read2read.ru' . $frontendRouting->generate('profile_p_invoice', array(), true);
$message = $this->getMailer()->compose(sfConfig::get('app_r2r_noreply_email'), $email, 'Read2Read - Напоминание о заполнении номера кошелька', <<<EOF
Вы зарегистрировались на сайте Read2Read.ru и на вашем счету имеется сумма положенная
к выплате в следующем платежном периоде. Для получения этих средств перейдите на сайт
Read2Read.ru и заполните номер кошелька. Ссылка для перехода: {$url}
EOF
);
$this->getMailer()->send($message);
}
}
}
示例2: doRun
/**
* @see sfTask
*/
protected function doRun(sfCommandManager $commandManager, $options)
{
$this->process($commandManager, $options);
$this->checkProjectExists();
$application = $commandManager->getArgumentSet()->hasArgument('application') ? $commandManager->getArgumentValue('application') : null;
$env = $commandManager->getOptionSet()->hasOption('env') ? $commandManager->getOptionValue('env') : 'test';
if (!is_null($application)) {
$this->checkAppExists($application);
require_once sfConfig::get('sf_config_dir') . '/ProjectConfiguration.class.php';
$isDebug = $commandManager->getOptionSet()->hasOption('debug') ? $commandManager->getOptionValue('debug') : true;
$this->configuration = ProjectConfiguration::getApplicationConfiguration($application, $env, $isDebug, null, $this->dispatcher);
} else {
if (file_exists(sfConfig::get('sf_config_dir') . '/ProjectConfiguration.class.php')) {
require_once sfConfig::get('sf_config_dir') . '/ProjectConfiguration.class.php';
$this->configuration = new ProjectConfiguration(null, $this->dispatcher);
} else {
$this->configuration = new sfProjectConfiguration(getcwd(), $this->dispatcher);
}
}
$autoloader = sfSimpleAutoload::getInstance();
foreach ($this->configuration->getModelDirs() as $dir) {
$autoloader->addDirectory($dir);
}
if (!is_null($this->commandApplication) && !$this->commandApplication->withTrace()) {
sfConfig::set('sf_logging_enabled', false);
}
return $this->execute($commandManager->getArgumentValues(), $commandManager->getOptionValues());
}
示例3: execute
protected function execute($arguments = array(), $options = array())
{
$configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true);
$databaseManager = new sfDatabaseManager($configuration);
$databaseManager->initialize($configuration);
$db = Doctrine_Manager::connection();
$models = array('Entity', 'Relationship', 'LsList');
foreach ($models as $model) {
$modelAlias = strtolower($model);
$updateAlias = $model == 'LsList' ? 'ls_list' : $modelAlias;
//get records to update
$q = LsDoctrineQuery::create()->select('id')->from($model . ' ' . $modelAlias)->where($modelAlias . '.last_user_id IS NULL')->limit($options['limit'])->setHydrationMode(Doctrine::HYDRATE_NONE);
if (!count($rows = $q->execute())) {
//nothing to update, go to next model
continue;
}
foreach ($rows as $row) {
$id = $row[0];
//get last_user_id
$result = LsDoctrineQuery::create()->select('m.user_id')->from('Modification m')->where('m.object_model = ? AND m.object_id = ?', array($model, $id))->orderBy('m.id DESC')->setHydrationMode(Doctrine::HYDRATE_NONE)->fetchOne();
if ($lastUserId = $result[0]) {
$query = 'UPDATE ' . $updateAlias . ' SET last_user_id=? WHERE id=?';
//use PDO for speed
$db->execute($query, array($lastUserId, $id));
} else {
throw new Exception("Couldn't find last_user_id for " . $model . ' #' . $id);
}
}
//only update records of one model at a time
break;
}
//DONE
LsCli::beep();
}
示例4: execute
public function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager(sfProjectConfiguration::getApplicationConfiguration('frontend', $options['env'], true));
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', $options['env'], true);
sfContext::createInstance($configuration);
$conn = Doctrine_Manager::connection();
// Récupération de toutes les notices.
$noeuds = $conn->execute("SELECT id, name FROM ei_data_set_structure;");
$this->log('Récupération des noeuds...OK');
// Création de la requête permettant
$this->log('Création de la requête de mise à jour...');
$requeteToUpdate = "UPDATE ei_data_set_structure SET slug = #{NEW_SLUG} WHERE id = #{NODE_ID};";
$requeteGlobale = array();
foreach ($noeuds->fetchAll() as $noeud) {
// Remplacement SLUG.
$tmpRequete = str_replace("#{NEW_SLUG}", $conn->quote(MyFunction::sluggifyForXML($noeud["name"])), $requeteToUpdate);
// Remplacement ID.
$tmpRequete = str_replace("#{NODE_ID}", $noeud["id"], $tmpRequete);
// Ajout dans la requête globale.
$requeteGlobale[] = $tmpRequete;
}
// Préparation de la requête.
$this->log("Préparation de la requête...");
$requete = implode(" ", $requeteGlobale);
try {
// Exécution de la requête.
$this->log("Exécution de la requête...");
$conn->execute($requete);
// Fin.
$this->log("Processus terminé avec succès.");
} catch (Exception $exc) {
$this->log($exc->getMessage());
}
}
示例5: execute
protected function execute($arguments = array(), $options = array())
{
$this->configuration = ProjectConfiguration::getApplicationConfiguration($options['app'], $options['env'], true);
if (!sfConfig::get('app_sf_amazon_plugin_access_key', false)) {
throw new sfException(sprintf('You have not set an amazon access key'));
}
if (!sfConfig::get('app_sf_amazon_plugin_secret_key', false)) {
throw new sfException(sprintf('You have not set an amazon secret key'));
}
$s3 = new AmazonS3(sfConfig::get('app_sf_amazon_plugin_access_key'), sfConfig::get('app_sf_amazon_plugin_secret_key'));
$this->s3_response = $s3->create_bucket($arguments['bucket'], $options['region'], $options['acl']);
if ($this->s3_response->isOk()) {
$this->log('Bucketed is being created...');
/* Since AWS follows an "eventual consistency" model, sleep and poll
until the bucket is available. */
$exists = $s3->if_bucket_exists($arguments['bucket']);
while (!$exists) {
// Not yet? Sleep for 1 second, then check again
sleep(1);
$exists = $s3->if_bucket_exists($arguments['bucket']);
}
$this->logSection('Bucket+', sprintf('"%s" created successfully', $arguments['bucket']));
} else {
throw new sfException($this->s3_response->body->Message);
}
}
示例6: authenticate
public function authenticate(MOXMAN_Auth_User $user)
{
$config = MOXMAN::getConfig();
if ($config->get('SymfonyAuthenticator.application_name') == '') {
die('You should define a SymfonyAuthenticator.application_name name in Moxiemanager config file.');
}
if ($config->get('SymfonyAuthenticator.application_env') == '') {
die('You should define a SymfonyAuthenticator.application_env in Moxiemanager config file.');
}
if ($config->get('SymfonyAuthenticator.project_configuration_path') == '') {
die('You should define a SymfonyAuthenticator.project_configuration_path in Moxiemanager config file.');
}
require_once $config->get('SymfonyAuthenticator.project_configuration_path');
$configuration = ProjectConfiguration::getApplicationConfiguration($config->get('SymfonyAuthenticator.application_name'), $config->get('SymfonyAuthenticator.application_env'), false);
$context = sfContext::createInstance($configuration);
// Is the user authenticated ?
if ($context->getUser()->isAuthenticated()) {
// Do we need a special role to access to the moxiemanager ?
if ($config->get('SymfonyAuthenticator.credential') != '') {
if ($context->getUser()->hasCredential($config->get('SymfonyAuthenticator.credential'))) {
return true;
} else {
return false;
}
}
return true;
}
return false;
}
示例7: execute
protected function execute($arguments = array(), $options = array())
{
$this->configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true);
$this->context = sfContext::createInstance($this->configuration);
$databaseManager = new sfDatabaseManager($this->configuration);
$dbdsn = $databaseManager->getDatabase('propel')->getParameter('dsn');
$dbusername = $databaseManager->getDatabase('propel')->getParameter('username');
$dbpassword = $databaseManager->getDatabase('propel')->getParameter('password');
$dbname = preg_replace('/^.*dbname=([^;=]+).*$/', '${1}', $dbdsn);
ConfigurationHelper::load();
$backup_method = ConfigurationHelper::getParameter('Backup', 'backup_method');
$this->logSection('tempos', sprintf('Backup method: %s', $backup_method), 1024);
if ($backup_method == 'ftp') {
$backupname = 'tempos-backup.sql';
$configname = ConfigurationHelper::getDefaultConfigurationFileName();
$configpath = ConfigurationHelper::getDefaultConfigurationFilePath();
copy($configpath, '/tmp/' . $configname);
chdir('/tmp');
system(sprintf('mysqldump --user=%s --password=%s %s > %s', escapeshellarg($dbusername), escapeshellarg($dbpassword), escapeshellarg($dbname), escapeshellarg($backupname)));
$tmpfilename = 'tempos-backup-' . date('Y-m-d') . '.tar.gz';
system(sprintf('tar zcf %s %s %s', escapeshellarg($tmpfilename), escapeshellarg($backupname), escapeshellarg($configname)));
unlink($backupname);
unlink($configname);
try {
FTPHelper::backupFile($tmpfilename);
} catch (Exception $ex) {
unlink($tmpfilename);
throw $ex;
}
unlink($tmpfilename);
}
}
示例8: execute
protected function execute($arguments = array(), $options = array())
{
$configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true);
$databaseManager = new sfDatabaseManager($configuration);
$databaseManager->initialize($configuration);
$db = Doctrine_Manager::connection();
//get person entities with all-caps names
$sql = 'SELECT e.id, e.name FROM entity e ' . 'WHERE e.name <> \'\' AND e.primary_ext = ? AND CAST(UPPER(e.name) AS BINARY) = CAST(e.name AS BINARY)';
$stmt = $db->execute($sql, array('Person'));
$names = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($names as $ary) {
$new = PersonTable::nameizePersonName($ary['name']);
if ($new != $ary['name']) {
$sql = 'UPDATE entity SET name = ? WHERE id = ?';
$stmt = $db->execute($sql, array($new, $ary['id']));
print "Changed Entity name " . $ary['name'] . " to " . $new . "\n";
}
}
//get aliases with all-caps names
$sql = 'SELECT a.id, a.name FROM alias a LEFT JOIN entity e ON (e.id = a.entity_id) ' . 'WHERE a.name <> \'\' AND a.is_primary = 1 AND e.primary_ext = ? AND ' . 'CAST(UPPER(a.name) AS BINARY) = CAST(a.name AS BINARY)';
$stmt = $db->execute($sql, array('Person'));
$names = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($names as $ary) {
$new = PersonTable::nameizePersonName($ary['name']);
if ($new != $ary['name']) {
$sql = 'UPDATE alias SET name = ? WHERE id = ?';
$stmt = $db->execute($sql, array($new, $ary['id']));
print "Changed Alias " . $ary['name'] . " to " . $new . "\n";
}
}
//DONE
LsCli::beep();
}
示例9: execute
/**
* @see sfTask
*/
protected function execute($arguments = array(), $options = array())
{
require_once dirname(__FILE__) . '/../../../config/ProjectConfiguration.class.php';
$configuration = ProjectConfiguration::getApplicationConfiguration('public', 'prod', true);
sfContext::createInstance($configuration);
$liveLang = $arguments['live_lang'];
$langToDeploy = $arguments['lang_to_deploy'];
$liveLangs = SfConfig::get('app_site_langs');
$langsUnderDev = SfConfig::get('app_site_langsUnderDev');
if (in_array($liveLang, $liveLangs) === false) {
die("The live lang doesn't seem to be live!");
}
if (in_array($langToDeploy, $langsUnderDev) === false) {
die("You can deploy only a language under development");
}
$c = new Criteria();
$c->add(PcTranslationPeer::LANGUAGE_ID, $langToDeploy);
$translationsToDeploy = PcTranslationPeer::doSelect($c);
$i = 0;
foreach ($translationsToDeploy as $translationToDeploy) {
$this->log("Deploying the string " . $translationToDeploy->getStringId() . " from {$langToDeploy} to {$liveLang}");
$liveTranslation = PcTranslationPeer::retrieveByPK($liveLang, $translationToDeploy->getStringId());
$liveTranslation->setString($translationToDeploy->getString())->save();
$translationToDeploy->delete();
$i++;
}
$this->log("All done. {$i} strings deployed.");
}
示例10: execute
protected function execute($arguments = array(), $options = array())
{
$autoloader = sfSimpleAutoload::getInstance();
$autoloader->addDirectory(sfConfig::get('sf_plugins_dir') . '/sfPropelMigrationsLightPlugin/lib');
$configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'],
$options['env'], true);
$databaseManager = new sfDatabaseManager($configuration);
$migrator = new sfMigrator;
if (isset($arguments['schema-version']) && ctype_digit($arguments['schema-version'])) {
$max = $arguments['schema-version'];
} else {
$max = $migrator->getMaxVersion();
}
$migrations = $migrator->getMigrationsToRunUpTo($max);
foreach ($migrations as $migration) {
echo "Marking as Migrated: $migration\n";
$migrator->markMigration($migration);
}
}
开发者ID:nationalfield,项目名称:nfPropelMigrationsLightPlugin,代码行数:25,代码来源:sfPropelMarkAsMigratedTask.class.php
示例11: execute
/**
* Executes the current task.
*
* @param array $arguments An array of arguments
* @param array $options An array of options
*
* @return integer 0 if everything went fine, or an error code
*/
protected function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager(sfProjectConfiguration::getApplicationConfiguration('frontend', $options['env'], true));
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', $options['env'], true);
sfContext::createInstance($configuration);
$conn = Doctrine_Manager::connection();
/** @var $parametres Récupération des paramètres à charger */
$parametres = $conn->execute("\n SELECT *\n FROM ei_function_has_param, ei_fonction\n WHERE param_type = 'OUT'\n AND (param_id, ei_fonction.id) NOT IN (SELECT ei_param_function_id, ei_function_id FROM ei_param_block_function_mapping)\n AND ei_function_has_param.function_ref = ei_fonction.function_ref\n AND ei_function_has_param.function_id = ei_fonction.function_id\n ");
$this->log('Récupération des paramètres...OK');
// Création de la requête permettant
$this->log('Création de la requête d\'insertion...');
$requeteToInsert = "INSERT INTO ei_param_block_function_mapping (ei_param_function_id, created_at, updated_at, ei_function_id) ";
$requeteToInsert .= "VALUES(#{PARAM_ID}, now(), now(), #{FONCTION_ID});";
$pile = array();
foreach ($parametres->fetchAll() as $parametre) {
// Remplacement PARAM ID.
$tmpRequete = str_replace("#{PARAM_ID}", $parametre["param_id"], $requeteToInsert);
// Remplacement FONCTION ID.
$tmpRequete = str_replace("#{FONCTION_ID}", $parametre["id"], $tmpRequete);
// Ajout dans la requête globale.
$pile[] = $tmpRequete;
}
// Préparation de la requête.
$this->log("Préparation de la requête...");
$requete = implode(" ", $pile);
try {
// Exécution de la requête.
$this->log("Exécution de la requête...");
$conn->execute($requete);
// Fin.
$this->log("Processus terminé avec succès.");
} catch (Exception $exc) {
$this->log($exc->getMessage());
}
}
示例12: execute
protected function execute($arguments = array(), $options = array())
{
$configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true);
$databaseManager = new sfDatabaseManager($configuration);
$databaseManager->initialize($configuration);
$this->db = Doctrine_Manager::connection();
if ($options['house_senate'] == 'house') {
$sql = 'select e1.id,e2.id from entity e1 left join political_candidate pc on pc.entity_id = e1.id left join political_candidate pc2 on pc2.house_fec_id = pc.house_fec_id left join entity e2 on e2.id = pc2.entity_id where e1.is_deleted = 0 and e2.is_deleted = 0 and e1.id <> e2.id and pc.id is not null and pc2.id is not null and pc.id <> pc2.id and pc.house_fec_id is not null and pc.house_fec_id <> "" and e1.id < e2.id group by e1.id,e2.id';
} else {
if ($options['house_senate'] == 'senate') {
$sql = 'select e1.id,e2.id from entity e1 left join political_candidate pc on pc.entity_id = e1.id left join political_candidate pc2 on pc2.senate_fec_id = pc.senate_fec_id left join entity e2 on e2.id = pc2.entity_id where e1.is_deleted = 0 and e2.is_deleted = 0 and e1.id <> e2.id and pc.id is not null and pc2.id is not null and pc.id <> pc2.id and pc.senate_fec_id is not null and pc.senate_fec_id <> "" and e1.id < e2.id group by e1.id,e2.id';
} else {
echo 'House or Senate not selected...ending script' . "\n";
die;
}
}
$stmt = $this->db->execute($sql);
$rows = $stmt->fetchAll();
foreach ($rows as $row) {
$e1 = Doctrine::getTable('Entity')->find($row[0]);
$e2 = Doctrine::getTable('Entity')->find($row[1]);
$mergedEntity = EntityTable::mergeAll($e1, $e2);
$e2->setMerge(true);
$e2->clearRelated();
$e2->delete();
echo ' Successfully merged ' . $e2->name . "\n";
if ($options['test_mode']) {
die;
}
}
}
示例13: getApplicationConfiguration
/**
* Returns current sfApplicationConfiguration instance.
* If no configuration does currently exist, a new one will be created.
*
* @return sfApplicationConfiguration
*/
protected function getApplicationConfiguration()
{
if (is_null($this->applicationConfiguration)) {
$this->applicationConfiguration = ProjectConfiguration::getApplicationConfiguration($this->getApplication(), $this->getEnvironment(), true);
}
return $this->applicationConfiguration;
}
示例14: boot
/**
* {@inheritdoc}
*/
public function boot(ContainerInterface $container)
{
if (empty($this->options)) {
throw new \RuntimeException('You must provide options for the Symfony 1.4 kernel.');
}
if ($this->isBooted()) {
return;
}
if ($this->classLoader && !$this->classLoader->isAutoloaded()) {
$this->classLoader->autoload();
}
$dispatcher = $container->get('event_dispatcher');
$event = new LegacyKernelBootEvent($container->get('request'), $this->options);
$dispatcher->dispatch(LegacyKernelEvents::BOOT, $event);
$this->options = $event->getOptions();
require_once $this->rootDir . '/config/ProjectConfiguration.class.php';
$application = $this->options['application'];
$environment = $this->options['environment'];
$debug = $this->options['debug'];
$this->configuration = \ProjectConfiguration::getApplicationConfiguration($application, $environment, $debug, $this->getRootDir());
$this->configuration->loadHelpers(array('Url'));
// Create a context to use with some helpers like Url.
if (!\sfContext::hasInstance()) {
$session = $container->get('session');
if ($session->isStarted()) {
$session->save();
}
ob_start();
\sfContext::createInstance($this->configuration);
ob_end_flush();
$session->migrate();
}
$this->isBooted = true;
}
示例15: getContext
/**
* Returns the current application context.
*
* @param bool $forceReload true to force context reload, false otherwise
*
* @return sfContext
*/
public function getContext($forceReload = false)
{
if (null === $this->context || $forceReload) {
$isContextEmpty = null === $this->context;
$context = $isContextEmpty ? sfContext::getInstance() : $this->context;
// create configuration
$currentConfiguration = $context->getConfiguration();
$configuration = ProjectConfiguration::getApplicationConfiguration($currentConfiguration->getApplication(), $currentConfiguration->getEnvironment(), $currentConfiguration->isDebug());
// connect listeners
$configuration->getEventDispatcher()->connect('application.throw_exception', array($this, 'listenToException'));
foreach ($this->listeners as $name => $listener) {
$configuration->getEventDispatcher()->connect($name, $listener);
}
// create context
$this->context = sfContext::createInstance($configuration);
unset($currentConfiguration);
if (!$isContextEmpty) {
sfConfig::clear();
sfConfig::add($this->rawConfiguration);
} else {
$this->rawConfiguration = sfConfig::getAll();
}
}
return $this->context;
}