示例#1
0
 public function init()
 {
     parent::init();
     $this->displayError();
     $this->setMemoryLimit('1024M');
     $this->setTimeLimt(-1);
 }
 /**
  * Constructor
  * @param Symfony\Component\Finder $finder    The Finder dependency
  * @param Symfony\Component\DOMCralwer $crawler   The DOMCrawler dependency
  * @param Outputter $outputter The console output dependency
  */
 public function __construct($finder, $crawler, $outputter)
 {
     $this->finder = $finder;
     $this->crawler = $crawler;
     $this->output = $outputter;
     $this->limits = self::config()->limits;
     parent::__construct();
 }
示例#3
0
 public function init()
 {
     parent::init();
     self::$logDir = '/tmp/process/';
     if (!is_dir(self::$logDir)) {
         mkdir(self::$logDir, 0777, true);
     }
     self::$cliPath = APPLICATION_PATH . '/cli/cli.php';
 }
 public function __construct(GoogleContentExperiments $googleContentExperiments = null)
 {
     parent::__construct();
     if (!$googleContentExperiments) {
         $container = Container::getInstance();
         $this->googleContentExperiments = $container['google_content_experiments'];
     } else {
         $this->googleContentExperiments = $googleContentExperiments;
     }
 }
    protected function process($user, $message)
    {
        $this->maxBufferSize = 1048576;
        switch ($message) {
            case 'hello':
                $this->send($user, 'hello human');
                break;
            case 'help':
                $this->send($user, 'help: <br> articles  => to show all articles.<br>
xml => to make output shown in XML on/off.<br>json => output in JSON on/off.<br>article=1 => gives single article id=1');
                break;
            case substr($message, 0, 8) === 'article=' && strlen($message) > 8:
                $this->id = substr($message, -1 * (strlen($message) - 8));
                $send = new CliController('', '');
                $view = $send->actionView($this->id, $this->out);
                $this->send($user, $view);
                break;
            case 'articles':
                $send = new CliController('', '');
                $view = $send->actionIndex($this->out);
                $this->send($user, $view);
                break;
            case 'xml':
                $this->out = $this->out === 'xml' ? '' : 'xml';
                $this->send($user, 'xml = ' . $this->out);
                break;
            case 'json':
                $this->out = $this->out === 'json' ? '' : 'json';
                $this->send($user, 'json = ' . $this->out);
                break;
            case 'cli':
                $this->send($user, PHP_SAPI === 'cli' ? '<b>Your on command line!</b>' : 'Not on command line!');
                break;
            default:
                $this->send($user, 'not understood, type help for help');
                break;
        }
    }
示例#6
0
 /**
  * Init
  *
  * @return mixed
  * 
  * @author Sebastian Diel <*****@*****.**>
  * @since 14.05.2012
  */
 public function init()
 {
     $result = parent::init();
     if (array_key_exists('argv', $_SERVER)) {
         $args = $_SERVER['argv'];
         if (is_array($args)) {
             array_shift($args);
             array_shift($args);
             foreach ($args as $arg) {
                 if (strpos($arg, '=') !== false) {
                     list($name, $value) = explode('=', $arg);
                 } else {
                     $name = $arg;
                     $value = true;
                 }
                 $this->setCliArg($name, $value);
             }
         }
     }
     return $result;
 }
 public function __construct()
 {
     parent::__construct();
     $this->member_repository = Injector::inst()->get('MemberRepository');
 }
示例#8
0
 public function init()
 {
     parent::init();
 }
示例#9
0
 public function init()
 {
     Deprecation::notice('3.1', 'ScheduledTask, QuarterHourlyTask, HourlyTask, DailyTask, MonthlyTask, WeeklyTask and ' . 'YearlyTask are deprecated, please extend from BuildTask or CliController, ' . 'and invoke them in self-defined frequencies through Unix cronjobs etc.');
     parent::init();
 }