cron.php 887 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * FormIt Cronjob
  4. *
  5. * @package formit
  6. */
  7. if(!(php_sapi_name() === 'cli')) {
  8. header("HTTP/1.1 400 Bad Request");
  9. print 'Only runnable from CLI.';
  10. exit;
  11. }
  12. require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/config.core.php';
  13. require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php';
  14. require_once MODX_CONNECTORS_PATH.'index.php';
  15. $corePath = $modx->getOption('formit.core_path',null,$modx->getOption('core_path').'components/formit/');
  16. require_once $corePath.'model/formit/formit.class.php';
  17. $modx->formit = new FormIt($modx);
  18. $modx->lexicon->load('formit:default');
  19. /* handle request */
  20. $path = $modx->getOption('processorsPath', $modx->formit->config, $corePath.'processors/');
  21. $response = $modx->runProcessor('mgr/form/clean', [], [
  22. 'processors_path' => $path
  23. ]);
  24. if ($response->isError()) {
  25. print $response->getMessage();
  26. }