Index: trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_RefreshJob.php |
— | — | @@ -6,14 +6,14 @@ |
7 | 7 | |
8 | 8 | /** |
9 | 9 | * SMWRefreshJob iterates over all page ids of the wiki, to perform an update |
10 | | - * action for all of them in sequence. This corresponds to the in-wiki version of |
11 | | - * the SMW_refreshData.php script for updating the whole wiki, but it also fixes |
12 | | - * problems with SMWSQLStore2 (which may have objects in its database that are not |
13 | | - * proper wiki pages). |
| 10 | + * action for all of them in sequence. This corresponds to the in-wiki version |
| 11 | + * of the SMW_refreshData.php script for updating the whole wiki, but it also |
| 12 | + * fixes problems with SMWSQLStore2 (which may have objects in its database |
| 13 | + * that are not proper wiki pages). |
14 | 14 | * |
15 | | - * @note this class ignores $smwgEnableUpdateJobs and always creates updates. In |
16 | | - * fact, it might be needed specifically on wikis that do not use update jobs in |
17 | | - * normal operation. |
| 15 | + * @note This class ignores $smwgEnableUpdateJobs and always creates updates. |
| 16 | + * In fact, it might be needed specifically on wikis that do not use update |
| 17 | + * jobs in normal operation. |
18 | 18 | * |
19 | 19 | * @author Markus Krötzsch |
20 | 20 | * @ingroup SMW |
— | — | @@ -21,11 +21,16 @@ |
22 | 22 | class SMWRefreshJob extends Job { |
23 | 23 | |
24 | 24 | /** |
25 | | - * The parameters optionally specified in the second argument of this constructor |
26 | | - * use the following array keys: 'spos' (start index, default 1), 'prog' (progress |
27 | | - * indicator, default 0), 'rc' (number of runs to be done, default 1). If more than |
28 | | - * one run is done, then the first run will restrict to properties and types. |
29 | | - * The progress indication refers to the current run, not to the overall job. |
| 25 | + * Constructor. The parameters optionally specified in the second |
| 26 | + * argument of this constructor use the following array keys: 'spos' |
| 27 | + * (start index, default 1), 'prog' (progress indicator, default 0), |
| 28 | + * ('rc' (number of runs to be done, default 1). If more than one run |
| 29 | + * is done, then the first run will restrict to properties and types. |
| 30 | + * The progress indication refers to the current run, not to the |
| 31 | + * overall job. |
| 32 | + * |
| 33 | + * @param $title Title not relevant but needed for MW jobs |
| 34 | + * @param $params array (associative) as explained above |
30 | 35 | */ |
31 | 36 | function __construct( $title, $params = array( 'spos' => 1, 'prog' => 0, 'rc' => 1 ) ) { |
32 | 37 | parent::__construct( 'SMWRefreshJob', $title, $params ); |
— | — | @@ -33,16 +38,17 @@ |
34 | 39 | |
35 | 40 | /** |
36 | 41 | * Run job |
| 42 | + * |
37 | 43 | * @return boolean success |
38 | 44 | */ |
39 | 45 | function run() { |
40 | 46 | wfProfileIn( 'SMWRefreshJob::run (SMW)' ); |
41 | | - |
| 47 | + |
42 | 48 | if ( !array_key_exists( 'spos', $this->params ) ) { |
43 | 49 | wfProfileOut( 'SMWRefreshJob::run (SMW)' ); |
44 | 50 | return true; |
45 | 51 | } |
46 | | - |
| 52 | + |
47 | 53 | $run = array_key_exists( 'run', $this->params ) ? $this->params['run']:1; |
48 | 54 | $spos = $this->params['spos']; |
49 | 55 | $namespaces = ( ( $this->params['rc'] > 1 ) && ( $run == 1 ) ) ? array( SMW_NS_PROPERTY, SMW_NS_TYPE ):false; |
— | — | @@ -55,15 +61,18 @@ |
56 | 62 | $nextjob = new SMWRefreshJob( $this->title, array( 'spos' => 1, 'prog' => 0, 'rc' => $this->params['rc'], 'run' => $run + 1 ) ); |
57 | 63 | $nextjob->insert(); |
58 | 64 | } |
59 | | - |
| 65 | + |
60 | 66 | wfProfileOut( 'SMWRefreshJob::run (SMW)' ); |
61 | | - |
| 67 | + |
62 | 68 | return true; |
63 | 69 | } |
64 | 70 | |
65 | 71 | /** |
66 | | - * Report the estimated progress status of this job as a number between 0 and 1 (0% to 100%). |
67 | | - * The progress refers to the state before processing this job. |
| 72 | + * Report the estimated progress status of this job as a number between |
| 73 | + * 0 and 1 (0% to 100%). The progress refers to the state before |
| 74 | + * processing this job. |
| 75 | + * |
| 76 | + * @return double |
68 | 77 | */ |
69 | 78 | public function getProgress() { |
70 | 79 | $prog = array_key_exists( 'prog', $this->params ) ? $this->params['prog'] : 0; |