Exemple #1
0
 function setup_frontend()
 {
     $epan_model = $this->add('xepan/epanservices/Model_Epan');
     $this->app->addHook('order_placed', [$epan_model, 'createFromOrder']);
     $this->app->addHook('invoice_paid', [$epan_model, 'invoicePaid']);
     $this->app->exportFrontEndTool('xepan\\epanservices\\Tool_EpanTrial', 'Epan Trial');
     $this->app->exportFrontEndTool('xepan\\epanservices\\Tool_AfterCreation', 'Epan Trial');
     $this->app->addHook('cron_executor', function ($app) {
         $now = \DateTime::createFromFormat('Y-m-d H:i:s', $this->app->now);
         echo "Running All Epans Cron <br/>";
         var_dump($now);
         if ($this->app->current_website_name != 'www') {
             echo "leaving " . $this->app->current_website_name . '<br/>';
             return;
         }
         $job1 = new \Cron\Job\ShellJob();
         $job1->setSchedule(new \Cron\Schedule\CrontabSchedule('*/5 * * * *'));
         if (!$job1->getSchedule() || $job1->getSchedule()->valid($now)) {
             $urls = [];
             foreach ($this->add('xepan\\base\\Model_Epan')->addCondition('id', '<>', $this->app->epan->id) as $other_epans) {
                 // $command = 'wget http://'. $other_epans['name'].'.epan.in?page=xepan_base_cron&cut_page=true';
                 // echo "<br/> executing ". $command. '<br/>';
                 // shell_exec($command);
                 $urls[] = 'http://' . $other_epans['name'] . '.epan.in?page=xepan_base_cron&cut_page=true&now=' . urlencode($this->app->now);
             }
             if (count($urls)) {
                 $results = $this->multi_request($urls);
             }
         }
     });
     return $this;
 }
Exemple #2
0
function build_cron()
{
    // Increment redis key every minute
    $inc_job = new \Cron\Job\ShellJob();
    $inc_job->setCommand('php inc.php');
    $inc_job->setSchedule(new \Cron\Schedule\CrontabSchedule('*/2 * * * *'));
    $resolver = new \Cron\Resolver\ArrayResolver();
    $resolver->addJob($inc_job);
    $cron = new \Cron\Cron();
    $cron->setExecutor(new \Cron\Executor\Executor());
    $cron->setResolver($resolver);
    return $cron;
}
Exemple #3
0
 function setup_frontend()
 {
     $this->routePages('xepan_communication');
     $this->addLocation(array('template' => 'templates', 'js' => 'templates/js'))->setBaseURL('./vendor/xepan/communication/');
     $this->app->addHook('cron_executor', function ($app) {
         $now = \DateTime::createFromFormat('Y-m-d H:i:s', $this->app->now);
         echo "Email Fetch <br/>";
         var_dump($now);
         $job1 = new \Cron\Job\ShellJob();
         $job1->setSchedule(new \Cron\Schedule\CrontabSchedule('* * * * *'));
         if (!$job1->getSchedule() || $job1->getSchedule()->valid($now)) {
             echo " Executing email fetching <br/>";
             $this->add('xepan\\communication\\Controller_Cron');
         }
         $job2 = new \Cron\Job\ShellJob();
         $job2->setSchedule(new \Cron\Schedule\CrontabSchedule('*/30 * * * *'));
         if (!$job2->getSchedule() || $job2->getSchedule()->valid($now)) {
             echo " Executing email fetching Bounce <br/>";
             $this->add('xepan\\communication\\Controller_BounceEmailCheck');
         }
     });
     return $this;
 }
Exemple #4
0
 function setup_frontend()
 {
     $this->routePages('xepan_marketing');
     $this->addLocation(array('template' => 'templates', 'js' => 'templates/js'))->setBaseURL('./vendor/xepan/marketing/');
     $this->app->addHook('cron_executor', function ($app) {
         $now = \DateTime::createFromFormat('Y-m-d H:i:s', $this->app->now);
         echo "Testing in Marketing<br/>";
         var_dump($now);
         $job2 = new \Cron\Job\ShellJob();
         $job2->setSchedule(new \Cron\Schedule\CrontabSchedule('* * * * *'));
         if (!$job2->getSchedule() || $job2->getSchedule()->valid($now)) {
             echo " Executing Newsletter exec <br/>";
             $this->add('xepan\\marketing\\Controller_NewsLetterExec');
         }
         $job3 = new \Cron\Job\ShellJob();
         $job3->setSchedule(new \Cron\Schedule\CrontabSchedule('* * * * *'));
         if (!$job3->getSchedule() || $job3->getSchedule()->valid($now)) {
             echo " Executing Social exec <br/>";
             $this->add('xepan\\marketing\\Controller_SocialExec');
         }
     });
     if ($this->app->isEditing) {
         $this->app->exportFrontEndTool('xepan\\marketing\\Tool_Subscription', 'Marketing');
     }
     return $this;
 }
Exemple #5
0
 function setup_frontend()
 {
     $this->routePages('xepan_projects');
     $this->addLocation(array('template' => 'templates', 'js' => 'templates/js'))->setBaseURL('./vendor/xepan/projects/');
     $this->app->addHook('cron_executor', function ($app) {
         $now = \DateTime::createFromFormat('Y-m-d H:i:s', $this->app->now);
         $job1 = new \Cron\Job\ShellJob();
         $job1->setSchedule(new \Cron\Schedule\CrontabSchedule('*/1 * * * *'));
         if (!$job1->getSchedule() || $job1->getSchedule()->valid($now)) {
             echo " Executing Task Cron For Reminder And Recuring Tasks<br/>";
             try {
                 $task = $this->add('xepan\\projects\\Model_Task');
                 $task->reminder();
                 $recurring_task = $this->add('xepan\\projects\\Model_Task');
                 $recurring_task->recurring();
             } catch (\Exception $e) {
                 throw $e;
             }
         }
     });
     return $this;
 }