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


PHP ProjectConfiguration类代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     if (!sfContext::hasInstance('frontend')) {
         $configuration = new ProjectConfiguration(dirname(__FILE__) . '/../../fixtures/project');
         sfContext::createInstance($configuration->getApplicationConfiguration('frontend', 'test', true));
     }
     if (in_array('sfImageSource', stream_get_wrappers())) {
         stream_wrapper_unregister('sfImageSource');
     }
     stream_wrapper_register('sfImageSource', 'sfImageSourceMock') or die('Failed to register protocol..');
 }
开发者ID:robo47,项目名称:sfImageTransformExtraPlugin,代码行数:11,代码来源:sfImageTransformManagerTest.php

示例2: __construct

 public function __construct(ProjectConfiguration $projectConfiguration)
 {
     /*
      * We disable Symfony autoload again feature because it is too slow in dev mode
      * If you introduce a new class when using sympal you just must clear your
      * cache manually
      */
     sfAutoloadAgain::getInstance()->unregister();
     $this->_projectConfiguration = $projectConfiguration;
     $this->_dispatcher = $projectConfiguration->getEventDispatcher();
     $this->_configureDoctrine();
     // Listen to the sympal.load event to perform some context-dependent tasks
     $this->_dispatcher->connect('sympal.load', array($this, 'bootstrapFromContext'));
     $this->_dispatcher->connect('sympal.cache.prime', array($this, 'listenSympalCachePrime'));
 }
开发者ID:sympal,项目名称:sympal,代码行数:15,代码来源:sfSympalConfiguration.class.php

示例3: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     ProjectConfiguration::setupMailer();
     $queue_table = Doctrine::getTable('MailQueue');
     $queue = $queue_table->getPending($arguments['limit']);
     $done = array();
     $failed = array();
     foreach ($queue as $item) {
         try {
             $mail = new Zend_Mail('utf-8');
             $mail->setSubject($item['subject']);
             $mail->setBodyText($item['body']);
             array_map(array($mail, 'addTo'), explode(',', $item['recipients']));
             $mail->send();
             $done[] = $item['id'];
         } catch (Zend_Exception $e) {
             $failed[] = $item['id'];
         }
     }
     $queue_table->deleteItems($done);
     $queue_table->recordAttemps($failed);
     $this->logSection('mailer', sizeof($done) . ' emails sent');
     $this->logSection('mailer', sizeof($failed) . ' emails failed');
 }
开发者ID:nurihan007,项目名称:amaranto,代码行数:27,代码来源:sendMailsTask.class.php

示例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());
     }
 }
开发者ID:lendji4000,项目名称:compose,代码行数:34,代码来源:SluggifyDataSetStructureNamesTask.class.php

示例5: 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();
     $this->s3 = new S3(sfConfig::get('app_amazon_access_key'), sfConfig::get('app_amazon_secret_key'));
     // hide strict errors
     error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
     $sql = "SELECT DISTINCT(r.source) FROM reference r ORDER BY id ASC LIMIT " . $options["limit"] . " OFFSET " . $options["offset"];
     $stmt = $this->db->execute($sql);
     $sources = $stmt->fetchAll(PDO::FETCH_COLUMN);
     foreach ($sources as $source) {
         if (!$options["localdir"]) {
             $s3path = ReferenceTable::generateS3path($source);
             if (!$options["overwrite"] && $this->s3->getObjectInfo(sfConfig::get('app_amazon_s3_bucket'), $s3path) !== false) {
                 print "ALREADY UPLOADED: " . $s3path . "\n";
                 continue;
             }
         }
         $this->writeTmpFile($source, $options["debug_mode"], $options["localdir"]);
         if (!$options["localdir"]) {
             $this->uploadTmpFile($source, $options["overwrite"], $options["debug_mode"]);
             if (unlink($this->getLocalPath($source, $options["local_dir"])) && $options["debug_mode"]) {
                 print "REMOVED LOCAL: " . $source . " [" . sha1($source) . "]\n";
             }
         }
         print "----------------------------------------------------------------\n";
     }
     //DONE
     LsCli::beep();
 }
开发者ID:silky,项目名称:littlesis,代码行数:32,代码来源:UploadS3ReferencesTask.class.php

示例6: __construct

 /**
  * コンストラクタ
  *
  * @param  string  $app  アプリケーションの種類 (ex. front, dev,... )
  */
 public function __construct($app)
 {
     $this->configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', true);
     new sfDatabaseManager($this->configuration);
     $this->connection = Doctrine_Manager::connection();
     $this->connection->beginTransaction();
 }
开发者ID:handlename,项目名称:myDoctrineTest,代码行数:12,代码来源:myDoctrineTest.class.php

示例7: 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

示例8: 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;
         }
     }
 }
开发者ID:silky,项目名称:littlesis,代码行数:31,代码来源:mergePoliticalDuplicatesTask.class.php

示例9: createContextInstance

 protected function createContextInstance($application = 'frontend', $enviroment = 'dev', $debug = true)
 {
     $configuration = ProjectConfiguration::getApplicationConfiguration($application, $enviroment, $debug);
     sfContext::createInstance($configuration);
     sfContext::switchTo($application);
     $this->context = sfContext::getInstance();
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:7,代码来源:AnexaFixClose2015Task.class.php

示例10: gdata_insert_row

 public function gdata_insert_row()
 {
     ProjectConfiguration::registerZend();
     Zend_Loader::loadClass('Zend_Gdata_AuthSub');
     Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
     Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
     Zend_Loader::loadClass('Zend_Gdata_Docs');
     $username = "sindvig.dentista";
     $password = "@bcd1234";
     //Chave do arquivo
     $key = "0Ak_oCZQf3sTidEJnZGQ4MHdhS0R1NUlSeG1ORkpnalE";
     //Carregando o serviço do arquivo
     $service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
     $client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service);
     $spreadSheetService = new Zend_Gdata_Spreadsheets($client);
     //Pegando as planilhas do arquivo
     $query = new Zend_Gdata_Spreadsheets_DocumentQuery();
     $query->setSpreadsheetKey($key);
     $feed = $spreadSheetService->getWorksheetFeed($query);
     //Escolhendo a planilha correta
     foreach ($feed->entries as $entry) {
         if ($entry->getTitle() == 'Disponiveis') {
             $worksheetId = basename($entry->getId());
         }
     }
     //Configura variaveis da nova linha na planilha
     $assoc = $this->getAssociado();
     $matricula = $this->isTitular() ? $assoc->getMatricula() : $assoc->getTitular()->getMatricula();
     $dependenteId = $this->isDependente() ? $assoc->getId() : '0';
     //Monta array para o serviço do arquivo
     $rowData = array("data" => $this->getDateTimeObject('created_at')->format('Y-m-d'), "matricula" => $matricula, "nome" => $assoc->getNome(), "dependenteid" => $dependenteId, "encaminhaid" => $this->getId());
     //Insere na Planilha
     $insertedListEntry = $spreadSheetService->insertRow($rowData, $key, $worksheetId);
 }
开发者ID:sindvigti,项目名称:sindhealth,代码行数:34,代码来源:Encaminhamento.class.php

示例11: 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());
 }
开发者ID:ajith24,项目名称:ajithworld,代码行数:31,代码来源:sfBaseTask.class.php

示例12: 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);
            }
        }
    }
开发者ID:rollmax,项目名称:read2read,代码行数:26,代码来源:DailyTask.class.php

示例13: 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();
 }
开发者ID:silky,项目名称:littlesis,代码行数:34,代码来源:CleanupLastUserIdsTask.class.php

示例14: execute

 protected function execute($arguments = array(), $options = array())
 {
     $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true);
     $databaseManager = new sfDatabaseManager($configuration);
     $databaseManager->initialize($configuration);
     $fh = fopen($options['file_name'], 'a+');
     $start = count(file($options['file_name']));
     $this->db = Doctrine_Manager::connection();
     $this->list = Doctrine::getTable('LsList')->find($options['list_id']);
     $q = $this->list->getListEntitiesByRankQuery();
     $list_entities = $q->execute();
     function func($value)
     {
         return $value['name'];
     }
     for ($i = $start; $i < count($list_entities); $i++) {
         $entity = $list_entities[$i]->Entity;
         $people = $entity->getRelatedEntitiesQuery(array('Person'), array(1, 2, 3, 4, 6, 7, 8, 9, 10))->execute();
         $orgs = $entity->getRelatedEntitiesQuery(array('Org'), array(1, 2, 3, 4, 6, 7, 8, 9, 10))->execute();
         $donations = $entity->getRelatedEntitiesQuery(array('Person'), array(5))->execute();
         $people = implode("; ", array_map("func", $people->toArray()));
         $orgs = implode("; ", array_map("func", $orgs->toArray()));
         $donations = implode("; ", array_map("func", $donations->toArray()));
         $arr = array($entity, $people, $orgs, $donations);
         $str = implode("\t", $arr);
         fwrite($fh, $str . "\n");
     }
 }
开发者ID:silky,项目名称:littlesis,代码行数:28,代码来源:ListCsvTask.class.php

示例15: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     $applicationConfig = sfProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true);
     $context = sfContext::createInstance($applicationConfig);
     ProjectConfiguration::registerCron();
     $quiet = (bool) $options['quiet'];
     $passed = array();
     $assigned = array();
     if ($arguments['subreddit'] == '%') {
         if (!$quiet) {
             echo "Advancing EpisodeAssignments for all Subreddits...";
         }
         SubredditTable::getInstance()->advanceEpisodeAssignments();
     } else {
         $subreddit = SubredditTable::getInstance()->findOneByName($arguments['subreddit']);
         if ($subreddit) {
             if (!$quiet) {
                 echo "Advancing EpisodeAssignments for {$subreddit} Subreddit...";
             }
             $subreddit->advanceEpisodeAssignments();
         } else {
             throw new sfException('Cannot find Subreddit: ' . $arguments['subreddit']);
         }
     }
     if (!$quiet) {
         echo "\n";
     }
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:31,代码来源:herdditAdvanceepisodesTask.class.php


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