From a640a33a87da1d30db8051d5eef479127e2e8472 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Tue, 10 Mar 2015 09:22:53 -0400
Subject: [PATCH] Added support for help switch in expire tools.

---
 .../Controller/UtilController.php             | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php b/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php
index 1ee913db2d6..b61d4a31570 100644
--- a/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php
+++ b/module/VuFindConsole/src/VuFindConsole/Controller/UtilController.php
@@ -367,6 +367,26 @@ class UtilController extends AbstractBase
      */
     public function expiresearchesAction()
     {
+        $this->consoleOpts->addRules(
+            [
+                'h|help' => 'Get help',
+            ]
+        );
+
+        if ($this->consoleOpts->getOption('h')
+            || $this->consoleOpts->getOption('help')
+        ) {
+            Console::writeLine('Expire old searches in the database.');
+            Console::writeLine('');
+            Console::writeLine(
+                'Optional parameter: the age (in days) of searches to expire;'
+            );
+            Console::writeLine(
+                'by default, searches more than 2 days old will be removed.'
+            );
+            return $this->getFailureResponse();
+        }
+
         return $this->expire(
             'Search',
             '%%count%% expired searches deleted.',
@@ -382,6 +402,26 @@ class UtilController extends AbstractBase
      */
     public function expiresessionsAction()
     {
+        $this->consoleOpts->addRules(
+            [
+                'h|help' => 'Get help',
+            ]
+        );
+
+        if ($this->consoleOpts->getOption('h')
+            || $this->consoleOpts->getOption('help')
+        ) {
+            Console::writeLine('Expire old sessions in the database.');
+            Console::writeLine('');
+            Console::writeLine(
+                'Optional parameter: the age (in days) of sessions to expire;'
+            );
+            Console::writeLine(
+                'by default, sessions more than 2 days old will be removed.'
+            );
+            return $this->getFailureResponse();
+        }
+
         return $this->expire(
             'Session',
             '%%count%% expired sessions deleted.',
-- 
GitLab