コード例 #1
0
 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $this->logSection('sfForkedDoctrineApply:upgrade-proiles', 'Gathering informations');
     $count = sfGuardUserProfileTable::getInstance()->getProfilesWithUserQuery()->count();
     $this->logSection('upgrade-proiles:', $count . ' profiles to upgrade');
     $this->logSection('upgrade-proiles:', 'retriving profiles to upgrade');
     $profiles = sfGuardUserProfileTable::getInstance()->getProfilesWithUserQuery()->execute(array(), Doctrine_Core::HYDRATE_ON_DEMAND);
     foreach ($profiles as $profile) {
         $this->log('upgrade ' . $profile);
         $profile->getUser()->setEmailAddress($profile->getEmail());
         $profile->save();
         unset($profile);
         $this->log('done');
     }
     $this->logSection('upgrade-proiles:', 'finished');
 }
コード例 #2
0
 public function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     //Creating time object
     $date = new DateTime();
     $date->setTimestamp(time() - $options['days'] * 8600);
     $this->logSection('initialize:', 'Gathering informations');
     //Getting number of profiles with validation codes
     $query = sfGuardUserProfileTable::getInstance()->getProfilesWithValidationCodesQuery();
     $query->andWhere($query->getRootAlias() . '.validate_at <= ?', $date->format('Y-m-d H:i:s'));
     $number = $query->count();
     //checking if there's any records that needs to be cleared
     if ($number > 0) {
         //We're processing those that needs attention
         $this->logSection('processing:', 'Found ' . $number . ' records to process');
         sfGuardUserProfileTable::getInstance()->getProfilesWithValidationCodesQuery(sfGuardUserProfileTable::getInstance()->createQuery('p')->update()->set('p.validate', 'NULL')->set('p.validate_at', 'NULL'))->andWhere('p.validate_at <= ?', $date->format('Y-m-d H:i:s'))->execute();
         $this->logSection('processing:', 'Validate codes are cleared');
     } else {
         //If there are none profiles with validation codes, we'll do nothing
         $this->log('Nothing to do');
     }
 }
コード例 #3
0
ファイル: components.class.php プロジェクト: silky/littlesis
 public function executeTopAnalysts()
 {
     $this->users = sfGuardUserProfileTable::getTopUsersQuery()->limit(10)->execute();
 }