From 8258b32ab9b20b0c9bb7e0ef145f3500023c468e Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Fri, 6 Mar 2015 14:11:57 -0600
Subject: [PATCH] cli: Add beginnings of endpoints for cron items

---
 setup/cli/modules/cron.php | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 setup/cli/modules/cron.php

diff --git a/setup/cli/modules/cron.php b/setup/cli/modules/cron.php
new file mode 100644
index 000000000..724c06cac
--- /dev/null
+++ b/setup/cli/modules/cron.php
@@ -0,0 +1,34 @@
+<?php
+require_once dirname(__file__) . "/class.module.php";
+require_once dirname(__file__) . "/../cli.inc.php";
+
+class CronManager extends Module {
+    var $prologue = 'CLI cron manager for osTicket';
+
+    var $arguments = array(
+        'action' => array(
+            'help' => 'Action to be performed',
+            'options' => array(
+                'fetch' => 'Fetch email',
+                'search' => 'Build search index'
+            ),
+        ),
+    );
+
+    function run($args, $options) {
+        Bootstrap::connect();
+        $ost = osTicket::start();
+
+        switch (strtolower($args[0])) {
+        case 'fetch':
+            Cron::MailFetcher();
+            break;
+        case 'search':
+            $ost->searcher->backend->IndexOldStuff();
+            break;
+        }
+    }
+}
+
+Module::register('cron', 'CronManager');
+?>
-- 
GitLab