Index: trunk/phase3/maintenance/runJobs.php |
— | — | @@ -2,6 +2,10 @@ |
3 | 3 | /** |
4 | 4 | * This script starts pending jobs. |
5 | 5 | * |
| 6 | + * Usage: |
| 7 | + * --maxjobs <num> (default 10000) |
| 8 | + * --type <job_cmd> |
| 9 | + * |
6 | 10 | * This program is free software; you can redistribute it and/or modify |
7 | 11 | * it under the terms of the GNU General Public License as published by |
8 | 12 | * the Free Software Foundation; either version 2 of the License, or |
— | — | @@ -29,7 +33,6 @@ |
30 | 34 | $this->addOption( 'maxjobs', 'Maximum number of jobs to run', false, true ); |
31 | 35 | $this->addOption( 'type', 'Type of job to run', false, true ); |
32 | 36 | $this->addOption( 'procs', 'Number of processes to use', false, true ); |
33 | | - $this->addOption( 'exclusive', 'Run only one exclusive runJobs script at a time. Timeout is 1800 seconds. Useful for cron scripts.', false ); |
34 | 37 | } |
35 | 38 | |
36 | 39 | public function memoryLimit() { |
— | — | @@ -38,10 +41,6 @@ |
39 | 42 | } |
40 | 43 | |
41 | 44 | public function execute() { |
42 | | - if ( $this->lock() === false ) { |
43 | | - exit( 0 ); |
44 | | - } |
45 | | - |
46 | 45 | global $wgTitle; |
47 | 46 | if ( $this->hasOption( 'procs' ) ) { |
48 | 47 | $procs = intval( $this->getOption( 'procs' ) ); |
— | — | @@ -50,7 +49,6 @@ |
51 | 50 | } |
52 | 51 | $fc = new ForkController( $procs ); |
53 | 52 | if ( $fc->start() != 'child' ) { |
54 | | - $this->unlock(); |
55 | 53 | exit( 0 ); |
56 | 54 | } |
57 | 55 | } |
— | — | @@ -87,9 +85,6 @@ |
88 | 86 | } |
89 | 87 | } |
90 | 88 | } |
91 | | - if ( !$this->hasOption( 'procs' ) ) { |
92 | | - $this->unlock(); |
93 | | - } |
94 | 89 | } |
95 | 90 | |
96 | 91 | /** |
— | — | @@ -100,25 +95,6 @@ |
101 | 96 | $this->output( wfTimestamp( TS_DB ) . " $msg\n" ); |
102 | 97 | wfDebugLog( 'runJobs', $msg ); |
103 | 98 | } |
104 | | - |
105 | | - protected function lock() { |
106 | | - if ( $this->hasOption( 'exclusive' ) ) { |
107 | | - $cache = wfGetCache( CACHE_ANYTHING ); |
108 | | - $running = $cache->get( wfMemcKey( 'runjobs' ) ); |
109 | | - if ( $running ) { |
110 | | - return false; |
111 | | - } else { |
112 | | - $cache->set( wfMemcKey( 'runjobs' ), '1', 1800 ); |
113 | | - return true; |
114 | | - } |
115 | | - } |
116 | | - return true; |
117 | | - } |
118 | | - |
119 | | - protected function unlock() { |
120 | | - wfGetCache( CACHE_ANYTHING )->delete( wfMemcKey( 'runjobs' ) ); |
121 | | - } |
122 | | - |
123 | 99 | } |
124 | 100 | |
125 | 101 | $maintClass = "RunJobs"; |