Index: trunk/extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php |
— | — | @@ -11,6 +11,9 @@ |
12 | 12 | * |
13 | 13 | * -d <delay> Wait for this many milliseconds after processing an article, useful for limiting server load. |
14 | 14 | * -v Be verbose about the progress. |
| 15 | + * -c Will refresh only category pages (and other explicitly named namespaces) |
| 16 | + * -p Will refresh only property pages (and other explicitly named namespaces) |
| 17 | + * -t Will refresh only type pages (and other explicitly named namespaces) |
15 | 18 | * |
16 | 19 | * @author Yaron Koren |
17 | 20 | * @author Markus Krötzsch |
— | — | @@ -35,6 +38,25 @@ |
36 | 39 | $verbose = false; |
37 | 40 | } |
38 | 41 | |
| 42 | +$filter = false; |
| 43 | +$categories = false; |
| 44 | +$properties = false; |
| 45 | +$types = false; |
| 46 | +$articles = false; |
| 47 | + |
| 48 | +if ( array_key_exists( 'c', $options ) ) { |
| 49 | + $filter = true; |
| 50 | + $categories = true; |
| 51 | +} |
| 52 | +if ( array_key_exists( 'p', $options ) ) { |
| 53 | + $filter = true; |
| 54 | + $properties = true; |
| 55 | +} |
| 56 | +if ( array_key_exists( 't', $options ) ) { |
| 57 | + $filter = true; |
| 58 | + $types = true; |
| 59 | +} |
| 60 | + |
39 | 61 | global $wgParser; |
40 | 62 | |
41 | 63 | $dbr =& wfGetDB( DB_MASTER ); |
— | — | @@ -50,6 +72,17 @@ |
51 | 73 | for ($id = $start; $id <= $end; $id++) { |
52 | 74 | $title = Title::newFromID($id); |
53 | 75 | if ( ($title === NULL) ) continue; |
| 76 | + if ($filter) { |
| 77 | + $ns = $title->getNamespace(); |
| 78 | + $doit = false; |
| 79 | + if (($categories) && ($ns == NS_CATEGORY)) |
| 80 | + $doit = true; |
| 81 | + if (($properties) && (($ns == SMW_NS_RELATION) || ($ns == SMW_NS_ATTRIBUTE))) |
| 82 | + $doit = true; |
| 83 | + if (($types) && ($ns == SMW_NS_TYPE)) |
| 84 | + $doit = true; |
| 85 | + if (!$doit) continue; |
| 86 | + } |
54 | 87 | if ($verbose) { |
55 | 88 | print "($num_files) Processing page with ID " . $id . " ...\n"; |
56 | 89 | } |
— | — | @@ -64,7 +97,7 @@ |
65 | 98 | } |
66 | 99 | } else { |
67 | 100 | smwfGetStore()->deleteSubject($title); |
68 | | - // sleep to be nice to the server |
| 101 | + // sleep to be nice to the server |
69 | 102 | // (for this case, sleep only every 1000 pages, so that large chunks of e.g. messages are processed more quickly) |
70 | 103 | if ( ($delay !== false) && (($num_files+1) % 1000 === 0) ) { |
71 | 104 | usleep($delay); |