source: trunk/server/www/app/vendors/shells/cron.php @ 297

Last change on this file since 297 was 297, checked in by sander, 11 years ago

Generate and display jobs and results for test suites

File size: 2.0 KB
Line 
1<?php
2/**
3 * Officeshots.org - Test your office documents in different applications
4 * Copyright (C) 2009 Stichting Lone Wolves
5 * Written by Sander Marechal <s.marechal@jejik.com>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21class CronShell extends Shell
22{
23        /**
24         * Override startup() so no welcome message is printed
25         */
26        public function startup() {}
27
28        /**
29         * Main function. Print help and exit.
30         */
31        public  function main()
32        {
33                $this->help();
34        }
35
36        /**
37         * Expire old requests
38         */
39        public function expire()
40        {
41                $Request = ClassRegistry::init('Request');
42
43                if (!$Request->expireAll()) {
44                        $this->log('Cron: Could not expire old requests.');
45                }
46        }
47
48        /**
49         * Generate new jobs for the test suites. This should be run once per day.
50         */
51        public function updateTestsuites()
52        {
53                $Testsuite = ClassRegistry::init('Testsuite');
54                $this->out($Testsuite->addJobs());
55        }
56
57        /**
58         * Print shell help
59         */
60        public function help()
61        {
62                $this->out('Commandline interface to the Officeshots cron jobs');
63                $this->hr();
64                $this->out("Usage: cake cron <command>");
65                $this->hr();
66                $this->out('Commands:');
67                $this->out("\n\texpire\n\t\tSet STATE_EXPIRED on all requests whose expiry time has passed.\n\t\tThis should be run every minute.");
68                $this->out("\n\tupdateTestsuites\n\t\tCreate jopbs for all ODF testsuites.\n\t\tThis should be run every hour.");
69                $this->out("\n\thelp\n\t\tShow this help");
70                $this->out('');
71        }
72}
73
74?>
Note: See TracBrowser for help on using the repository browser.