コード例 #1
0
ファイル: Migrate.php プロジェクト: miteshchavada/clubmaster
 public function onVersionMigrate(\Club\InstallerBundle\Event\FilterVersionEvent $event)
 {
     if ($event->getVersion()->getVersion() != '20121016161300') {
         // fit to this version only
         return;
     }
     $task = $this->em->getRepository('ClubTaskBundle:Task')->findOneBy(array('method' => 'onLogTask'));
     if ($task) {
         $this->em->remove($task);
     }
     $task = $this->em->getRepository('ClubTaskBundle:Task')->findOneBy(array('method' => 'onLoginAttemptTask'));
     if ($task) {
         $this->em->remove($task);
     }
     $task = $this->em->getRepository('ClubTaskBundle:Task')->findOneBy(array('method' => 'onBanTask'));
     if ($task) {
         $this->em->remove($task);
     }
     $tasks = array(array('name' => 'Booking cleanup', 'interval' => 'T1M', 'method' => 'onBookingCleanup'), array('name' => 'Task cleanup', 'interval' => 'T1M', 'method' => 'onTaskCleanup'));
     foreach ($tasks as $task) {
         $r = $this->em->getRepository('ClubTaskBundle:Task')->findOneBy(array('method' => $task['method']));
         if (!$r) {
             $t = new \Club\TaskBundle\Entity\Task();
             $t->setTaskName($task['name']);
             $t->setEnabled(1);
             $t->setLocked(0);
             $t->setNextRunAt(new \DateTime());
             $t->setTaskInterval($task['interval']);
             $t->setEvent('\\Club\\TaskBundle\\Event\\Events');
             $t->setMethod($task['method']);
             $this->em->persist($t);
         }
     }
 }
コード例 #2
0
ファイル: LoadTaskData.php プロジェクト: hollodk/clubmaster
 public function load($manager)
 {
     $task = new \Club\TaskBundle\Entity\Task();
     $task->setTaskName('Update dynamic groups');
     $task->setEnabled(1);
     $task->setLocked(0);
     $task->setNextRunAt(new \DateTime());
     $task->setTaskInterval('+1 hour');
     $task->setEvent('\\Club\\TaskBundle\\Event\\Events');
     $task->setMethod('onGroupTask');
     $manager->persist($task);
     $task = new \Club\TaskBundle\Entity\Task();
     $task->setTaskName('Cleanup logs');
     $task->setEnabled(1);
     $task->setLocked(0);
     $task->setNextRunAt(new \DateTime());
     $task->setTaskInterval('+1 hour');
     $task->setEvent('\\Club\\TaskBundle\\Event\\Events');
     $task->setMethod('onLogTask');
     $manager->persist($task);
     $task = new \Club\TaskBundle\Entity\Task();
     $task->setTaskName('Renewal memberships');
     $task->setEnabled(1);
     $task->setLocked(0);
     $task->setNextRunAt(new \DateTime());
     $task->setTaskInterval('+1 hour');
     $task->setEvent('\\Club\\TaskBundle\\Event\\Events');
     $task->setMethod('onAutoRenewalTask');
     $manager->persist($task);
     $task = new \Club\TaskBundle\Entity\Task();
     $task->setTaskName('Cleanup login logs');
     $task->setEnabled(1);
     $task->setLocked(0);
     $task->setNextRunAt(new \DateTime());
     $task->setTaskInterval('+1 hour');
     $task->setEvent('\\Club\\TaskBundle\\Event\\Events');
     $task->setMethod('onLoginAttemptTask');
     $manager->persist($task);
     $task = new \Club\TaskBundle\Entity\Task();
     $task->setTaskName('Cleanup ban logs');
     $task->setEnabled(1);
     $task->setLocked(0);
     $task->setNextRunAt(new \DateTime());
     $task->setTaskInterval('+1 hour');
     $task->setEvent('\\Club\\TaskBundle\\Event\\Events');
     $task->setMethod('onBanTask');
     $manager->persist($task);
     $task = new \Club\TaskBundle\Entity\Task();
     $task->setTaskName('Send emails');
     $task->setEnabled(1);
     $task->setLocked(0);
     $task->setNextRunAt(new \DateTime());
     $task->setTaskInterval('+1 hour');
     $task->setEvent('\\Club\\TaskBundle\\Event\\Events');
     $task->setMethod('onMailTask');
     $manager->persist($task);
     $manager->flush();
 }
コード例 #3
0
ファイル: Load.php プロジェクト: miteshchavada/clubmaster
 private function initTask()
 {
     $tasks = array(array('name' => 'Update dynamic groups', 'interval' => '1D', 'method' => 'onGroupTask'), array('name' => 'Renewal memberships', 'interval' => 'T1H', 'method' => 'onAutoRenewalTask'), array('name' => 'Send emails', 'interval' => 'T1M', 'method' => 'onMailTask'), array('name' => 'Process message queue', 'interval' => 'T15M', 'method' => 'onMessageTask'), array('name' => 'Generate new team schedules', 'interval' => '1D', 'method' => 'onTeamTask'), array('name' => 'Create team penalty', 'interval' => 'T1H', 'method' => 'onTeamPenalty'), array('name' => 'Process matches', 'interval' => 'T15M', 'method' => 'onMatchTask'), array('name' => 'Booking cleanup', 'interval' => 'T1M', 'method' => 'onBookingCleanup'), array('name' => 'Task cleanup', 'interval' => 'T1M', 'method' => 'onTaskCleanup'));
     foreach ($tasks as $task) {
         $r = $this->em->getRepository('ClubTaskBundle:Task')->findOneBy(array('method' => $task['method']));
         if (!$r) {
             $t = new \Club\TaskBundle\Entity\Task();
             $t->setTaskName($task['name']);
             $t->setEnabled(1);
             $t->setLocked(0);
             $t->setNextRunAt(new \DateTime());
             $t->setTaskInterval($task['interval']);
             $t->setEvent('\\Club\\TaskBundle\\Event\\Events');
             $t->setMethod($task['method']);
             $this->em->persist($t);
         }
     }
 }