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

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

Don't update testsuites from a cron. Run manually from new shell instead.

File size: 1.8 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         * Print shell help
50         */
51        public function help()
52        {
53                $this->out('Commandline interface to the Officeshots cron jobs');
54                $this->hr();
55                $this->out("Usage: cake cron <command>");
56                $this->hr();
57                $this->out('Commands:');
58                $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.");
59                $this->out("\n\tsyncTestsuites\n\t\tSynchronise all ODF testsuites.\n\t\tThis should be run every hour.");
60                $this->out("\n\thelp\n\t\tShow this help");
61                $this->out('');
62        }
63}
64
65?>
Note: See TracBrowser for help on using the repository browser.