Index: trunk/extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php |
— | — | @@ -38,8 +38,8 @@ |
39 | 39 | $optionsWithArgs = array( 'd', 's', 'e', 'b', 'server', 'page' ); // -d <delay>, -s <startid>, -e <endid>, -b <backend> |
40 | 40 | |
41 | 41 | require_once ( getenv( 'MW_INSTALL_PATH' ) !== false |
42 | | - ? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/commandLine.inc" |
43 | | - : dirname( __FILE__ ) . '/../../../maintenance/commandLine.inc' ); |
| 42 | + ? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/commandLine.inc" |
| 43 | + : dirname( __FILE__ ) . '/../../../maintenance/commandLine.inc' ); |
44 | 44 | |
45 | 45 | global $smwgEnableUpdateJobs, $wgServer; |
46 | 46 | $smwgEnableUpdateJobs = false; // do not fork additional update jobs while running this script |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | if ( array_key_exists( 't', $options ) ) { |
91 | 91 | $filterarray[] = SMW_NS_TYPE; |
92 | 92 | } |
93 | | -$filter = count( $filterarray ) > 0 ? $filterarray:false; |
| 93 | +$filter = count( $filterarray ) > 0 ? $filterarray : false; |
94 | 94 | |
95 | 95 | if ( array_key_exists( 'f', $options ) ) { |
96 | 96 | print "\n Deleting all stored data completely and rebuilding it again later!\n Semantic data in the wiki might be incomplete for some time while this operation runs.\n\n NOTE: It is usually necessary to run this script ONE MORE TIME after this operation,\n since some properties' types are not stored yet in the first run.\n The first run can normally use the parameter -p to refresh only properties.\n\n"; |
— | — | @@ -97,28 +97,28 @@ |
98 | 98 | print " WARNING: -s or -e are used, so some pages will not be refreshed at all!\n Data for those pages will only be available again when they have been\n refreshed as well!\n\n"; |
99 | 99 | } |
100 | 100 | |
101 | | - print "Abort with control-c in the next five seconds ... "; |
| 101 | + print 'Abort with control-c in the next five seconds ... '; |
102 | 102 | |
103 | 103 | // TODO |
104 | 104 | // Remove the following section and replace it with a simple |
105 | | - // wfCountDown as soon as we switch to MediaWiki 1.16. |
| 105 | + // wfCountDown as soon as we switch to MediaWiki 1.16. |
106 | 106 | // Currently, wfCountDown is only supported from |
107 | 107 | // revision 51650 (Jun 9 2009) onward. |
108 | 108 | $n = 6; |
109 | | - if ( function_exists( "wfCountDown" ) ) { |
| 109 | + if ( function_exists( 'wfCountDown' ) ) { |
110 | 110 | wfCountDown( $n ); |
111 | 111 | } else { |
112 | | - for ( $i = $n; $i >= 0; $i-- ) { |
113 | | - if ( $i != $n ) { |
114 | | - echo str_repeat( "\x08", strlen( $i + 1 ) ); |
115 | | - } |
116 | | - echo $i; |
117 | | - flush(); |
118 | | - if ( $i ) { |
119 | | - sleep( 1 ); |
120 | | - } |
121 | | - } |
122 | | - echo "\n"; |
| 112 | + for ( $i = $n; $i >= 0; $i-- ) { |
| 113 | + if ( $i != $n ) { |
| 114 | + echo str_repeat( "\x08", strlen( $i + 1 ) ); |
| 115 | + } |
| 116 | + echo $i; |
| 117 | + flush(); |
| 118 | + if ( $i ) { |
| 119 | + sleep( 1 ); |
| 120 | + } |
| 121 | + } |
| 122 | + echo "\n"; |
123 | 123 | } |
124 | 124 | // Remove up to here and just uncomment the following line: |
125 | 125 | // wfCountDown( 6 ); |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | " 1000) were refreshed, please abort with CTRL-C and resume this script\n" . |
145 | 145 | " at the last processed page id using the parameter -s (use -v to display\n" . |
146 | 146 | " page ids during refresh). Continue this until all pages were refreshed.\n---\n"; |
147 | | - print "Processing all IDs from $start to " . ( $end ? "$end":"last ID" ) . " ...\n"; |
| 147 | + print "Processing all IDs from $start to " . ( $end ? "$end" : 'last ID' ) . " ...\n"; |
148 | 148 | |
149 | 149 | $id = $start; |
150 | 150 | while ( ( ( !$end ) || ( $id <= $end ) ) && ( $id > 0 ) ) { |
Index: trunk/extensions/SemanticMediaWiki/maintenance/SMW_conceptCache.php |
— | — | @@ -15,11 +15,11 @@ |
16 | 16 | $optionsWithArgs = array( 'concept', 'old', 's', 'e' ); |
17 | 17 | |
18 | 18 | require_once ( getenv( 'MW_INSTALL_PATH' ) !== false |
19 | | - ? getenv( 'MW_INSTALL_PATH' ) . '/maintenance/commandLine.inc' |
20 | | - : dirname( __FILE__ ) . '/../../../maintenance/commandLine.inc' ); |
| 19 | + ? getenv( 'MW_INSTALL_PATH' ) . '/maintenance/commandLine.inc' |
| 20 | + : dirname( __FILE__ ) . '/../../../maintenance/commandLine.inc' ); |
21 | 21 | |
22 | | -$output_level = array_key_exists( 'quiet', $options ) ? 0: |
23 | | - ( array_key_exists( 'verbose', $options ) ? 2 : 1 ); |
| 22 | +$output_level = array_key_exists( 'quiet', $options ) ? 0 : |
| 23 | + ( array_key_exists( 'verbose', $options ) ? 2 : 1 ); |
24 | 24 | |
25 | 25 | if ( array_key_exists( 'help', $options ) ) { |
26 | 26 | $action = 'help'; |
— | — | @@ -37,23 +37,23 @@ |
38 | 38 | if ( outputMessage( print "Waiting for $delay seconds ... " ) ) { |
39 | 39 | // TODO |
40 | 40 | // Remove the following section and replace it with a simple |
41 | | - // wfCountDown as soon as we switch to MediaWiki 1.16. |
| 41 | + // wfCountDown as soon as we switch to MediaWiki 1.16. |
42 | 42 | // Currently, wfCountDown is only supported from |
43 | 43 | // revision 51650 (Jun 9 2009) onward. |
44 | 44 | if ( function_exists( 'wfCountDown' ) ) { |
45 | 45 | wfCountDown( $delay ); |
46 | 46 | } else { |
47 | | - for ( $i = $delay; $i >= 0; $i-- ) { |
48 | | - if ( $i != $delay ) { |
49 | | - echo str_repeat( "\x08", strlen( $i + 1 ) ); |
50 | | - } |
51 | | - echo $i; |
52 | | - flush(); |
53 | | - if ( $i ) { |
54 | | - sleep( 1 ); |
55 | | - } |
56 | | - } |
57 | | - echo "\n"; |
| 47 | + for ( $i = $delay; $i >= 0; $i-- ) { |
| 48 | + if ( $i != $delay ) { |
| 49 | + echo str_repeat( "\x08", strlen( $i + 1 ) ); |
| 50 | + } |
| 51 | + echo $i; |
| 52 | + flush(); |
| 53 | + if ( $i ) { |
| 54 | + sleep( 1 ); |
| 55 | + } |
| 56 | + } |
| 57 | + echo "\n"; |
58 | 58 | } |
59 | 59 | // Remove up to here and just uncomment the following line: |
60 | 60 | // wfCountDown( $delay ); |
— | — | @@ -109,8 +109,9 @@ |
110 | 110 | } |
111 | 111 | |
112 | 112 | global $smwgIP; |
113 | | -if ( ! isset( $smwgIP ) ) |
114 | | - $smwgIP = dirname( __FILE__ ) . '/../'; |
| 113 | +if ( !isset( $smwgIP ) ) { |
| 114 | + $smwgIP = dirname( __FILE__ ) . '/../'; |
| 115 | +} |
115 | 116 | |
116 | 117 | require_once( $smwgIP . 'includes/SMW_GlobalFunctions.php' ); |
117 | 118 | |
— | — | @@ -127,8 +128,8 @@ |
128 | 129 | $select_old = isset( $options['old'] ) ? intval( $options['old'] ) : false; |
129 | 130 | |
130 | 131 | if ( isset( $options['concept'] ) ) { // single concept mode |
131 | | - // $concept = SMWDataValueFactory::newTypeIDValue('_wpg'); |
132 | | - // $concept->setValues('African_countries',SMW_NS_CONCEPT); |
| 132 | + // $concept = SMWDataValueFactory::newTypeIDValue( '_wpg' ); |
| 133 | + // $concept->setValues( 'African_countries', SMW_NS_CONCEPT ); |
133 | 134 | global $wgContLang; |
134 | 135 | $concept = Title::newFromText( $wgContLang->getNsText( SMW_NS_CONCEPT ) . ':' . $options['concept'] ); |
135 | 136 | if ( $concept !== null ) { |
— | — | @@ -140,7 +141,7 @@ |
141 | 142 | } else { |
142 | 143 | $start = 0; |
143 | 144 | } |
144 | | - $end = $db->selectField( 'page', 'max(page_id)', false, 'SMW_refreshData' ); |
| 145 | + $end = $db->selectField( 'page', 'MAX(page_id)', false, 'SMW_refreshData' ); |
145 | 146 | if ( array_key_exists( 'e', $options ) ) { |
146 | 147 | $end = min( intval( $options['e'] ), $end ); |
147 | 148 | } |
— | — | @@ -148,7 +149,9 @@ |
149 | 150 | |
150 | 151 | for ( $id = $start; $id <= $end; $id++ ) { |
151 | 152 | $title = Title::newFromID( $id ); |
152 | | - if ( ( $title === null ) || ( $title->getNamespace() != SMW_NS_CONCEPT ) ) continue; |
| 153 | + if ( ( $title === null ) || ( $title->getNamespace() != SMW_NS_CONCEPT ) ) { |
| 154 | + continue; |
| 155 | + } |
153 | 156 | $num_lines += doAction( $title, $num_lines ); |
154 | 157 | } |
155 | 158 | } |
— | — | @@ -168,15 +171,15 @@ |
169 | 172 | $skip = 'page not cachable (no concept description, maybe a redirect)'; |
170 | 173 | } elseif ( ( $select_update ) && ( $status['status'] != 'full' ) ) { |
171 | 174 | $skip = 'page not cached yet'; |
172 | | - } elseif ( ( $select_old ) && ( $status['status'] == 'full' ) && ( $status['date'] > ( strtotime( "now" ) - $select_old * 60 ) ) ) { |
| 175 | + } elseif ( ( $select_old ) && ( $status['status'] == 'full' ) && ( $status['date'] > ( strtotime( 'now' ) - $select_old * 60 ) ) ) { |
173 | 176 | $skip = 'cache is not old yet'; |
174 | 177 | } elseif ( ( $select_hard ) && ( $smwgQMaxSize >= $status['size'] ) && |
175 | | - ( $smwgQMaxDepth >= $status['depth'] && |
176 | | - ( ( ~( ~( $status['features'] + 0 ) | $smwgQFeatures ) ) == 0 ) ) ) { |
| 178 | + ( $smwgQMaxDepth >= $status['depth'] && |
| 179 | + ( ( ~( ~( $status['features'] + 0 ) | $smwgQFeatures ) ) == 0 ) ) ) { |
177 | 180 | $skip = 'concept is not "hard" according to wiki settings'; |
178 | 181 | } |
179 | 182 | if ( $skip ) { |
180 | | - $pref = ( $numlines !== false ) ? "($numlines) ":''; |
| 183 | + $pref = ( $numlines !== false ) ? "($numlines) " : ''; |
181 | 184 | return ( outputMessage( $pref . 'Skipping concept "' . $title->getPrefixedText() . "\": $skip\n", 2 ) ) ? 1 : 0; |
182 | 185 | } |
183 | 186 | if ( $numlines !== false ) { |
— | — | @@ -196,17 +199,17 @@ |
197 | 200 | if ( $status['status'] == 'no' ) { |
198 | 201 | outputMessage( "Concept not known or redirect.\n" ); |
199 | 202 | } elseif ( $status['status'] == 'full' ) { |
200 | | - outputMessage( 'Cache created at ' . date( "Y-m-d H:i:s", $status['date'] ) . ' (' . floor( ( strtotime( "now" ) - $status['date'] ) / 60 ) . " minutes old), " . $status['count'] . " elements in cache\n" ); |
| 203 | + outputMessage( 'Cache created at ' . date( 'Y-m-d H:i:s', $status['date'] ) . ' (' . floor( ( strtotime( 'now' ) - $status['date'] ) / 60 ) . ' minutes old), ' . $status['count'] . " elements in cache\n" ); |
201 | 204 | } else { |
202 | 205 | outputMessage( "Not cached.\n" ); |
203 | 206 | } |
204 | 207 | break; |
205 | 208 | } |
206 | | - |
| 209 | + |
207 | 210 | if ( count( $errors ) > 0 ) { |
208 | 211 | outputMessage( ' ' . implode( $errors, "\n " ) . "\n" ); |
209 | 212 | } |
210 | | - |
| 213 | + |
211 | 214 | return 1; |
212 | 215 | } |
213 | 216 | |
Index: trunk/extensions/SemanticMediaWiki/maintenance/SMW_setup.php |
— | — | @@ -43,8 +43,8 @@ |
44 | 44 | $optionsWithArgs = array( 'b', 'user', 'password' ); |
45 | 45 | |
46 | 46 | require_once ( getenv( 'MW_INSTALL_PATH' ) !== false |
47 | | - ? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/commandLine.inc" |
48 | | - : dirname( __FILE__ ) . '/../../../maintenance/commandLine.inc' ); |
| 47 | + ? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/commandLine.inc" |
| 48 | + : dirname( __FILE__ ) . '/../../../maintenance/commandLine.inc' ); |
49 | 49 | |
50 | 50 | global $smwgDefaultStore; |
51 | 51 | |
— | — | @@ -72,12 +72,13 @@ |
73 | 73 | |
74 | 74 | |
75 | 75 | global $smwgIP; |
76 | | -if ( ! isset( $smwgIP ) ) |
77 | | - $smwgIP = dirname( __FILE__ ) . '/../'; |
| 76 | +if ( !isset( $smwgIP ) ) { |
| 77 | + $smwgIP = dirname( __FILE__ ) . '/../'; |
| 78 | +} |
78 | 79 | |
79 | 80 | require_once( $smwgIP . 'includes/SMW_GlobalFunctions.php' ); |
80 | 81 | |
81 | | -if ( array_key_exists( 'delete', $options ) ) { |
| 82 | +if ( array_key_exists( 'delete', $options ) ) { |
82 | 83 | print "\n Deleting all stored data for $smwgDefaultStore completely!\n \n\n"; |
83 | 84 | if ( $alternativestore ) { |
84 | 85 | print " This store is currently not used by SMW. Deleting it\n should not cause problems in the wiki.\n\n"; |
— | — | @@ -91,23 +92,23 @@ |
92 | 93 | |
93 | 94 | // TODO |
94 | 95 | // Remove the following section and replace it with a simple |
95 | | - // wfCountDown as soon as we switch to MediaWiki 1.16. |
| 96 | + // wfCountDown as soon as we switch to MediaWiki 1.16. |
96 | 97 | // Currently, wfCountDown is only supported from |
97 | 98 | // revision 51650 (Jun 9 2009) onward. |
98 | | - if ( function_exists( "wfCountDown" ) ) { |
| 99 | + if ( function_exists( 'wfCountDown' ) ) { |
99 | 100 | wfCountDown( $delay ); |
100 | 101 | } else { |
101 | | - for ( $i = $delay; $i >= 0; $i-- ) { |
102 | | - if ( $i != $delay ) { |
103 | | - echo str_repeat( "\x08", strlen( $i + 1 ) ); |
104 | | - } |
105 | | - echo $i; |
106 | | - flush(); |
107 | | - if ( $i ) { |
108 | | - sleep( 1 ); |
109 | | - } |
110 | | - } |
111 | | - echo "\n"; |
| 102 | + for ( $i = $delay; $i >= 0; $i-- ) { |
| 103 | + if ( $i != $delay ) { |
| 104 | + echo str_repeat( "\x08", strlen( $i + 1 ) ); |
| 105 | + } |
| 106 | + echo $i; |
| 107 | + flush(); |
| 108 | + if ( $i ) { |
| 109 | + sleep( 1 ); |
| 110 | + } |
| 111 | + } |
| 112 | + echo "\n"; |
112 | 113 | } |
113 | 114 | // Remove up to here and just uncomment the following line: |
114 | 115 | // wfCountDown( $delay ); |
— | — | @@ -125,5 +126,3 @@ |
126 | 127 | } |
127 | 128 | |
128 | 129 | print "\n\nDone.\n"; |
129 | | - |
130 | | - |
Index: trunk/extensions/SemanticMediaWiki/maintenance/SMW_dumpRDF.php |
— | — | @@ -1,5 +1,4 @@ |
2 | 2 | <?php |
3 | | - |
4 | 3 | /** |
5 | 4 | * Usage: |
6 | 5 | * php SMW_dumpRDF.php [options...] |
— | — | @@ -8,7 +7,7 @@ |
9 | 8 | * then the MW_INSTALL_PATH environment variable must be set. |
10 | 9 | * See README in the maintenance directory. |
11 | 10 | * |
12 | | - * -o <filename> output file, stdout is used if omitted; |
| 11 | + * -o <filename> output file, stdout is used if omitted; |
13 | 12 | * file output is generally better and strongly recommended for large wikis |
14 | 13 | * --categories do only categories |
15 | 14 | * --concepts do only concepts |
— | — | @@ -31,8 +30,8 @@ |
32 | 31 | $optionsWithArgs = array( 'o', 'd', 'e', 'server' ); |
33 | 32 | |
34 | 33 | require_once ( getenv( 'MW_INSTALL_PATH' ) !== false |
35 | | - ? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/commandLine.inc" |
36 | | - : dirname( __FILE__ ) . '/../../../maintenance/commandLine.inc' ); |
| 34 | + ? getenv( 'MW_INSTALL_PATH' ) . "/maintenance/commandLine.inc" |
| 35 | + : dirname( __FILE__ ) . '/../../../maintenance/commandLine.inc' ); |
37 | 36 | global $smwgIP, $wgServer; |
38 | 37 | require_once( "$smwgIP/specials/Export/SMW_SpecialOWLExport.php" ); |
39 | 38 | |
— | — | @@ -53,17 +52,17 @@ |
54 | 53 | } |
55 | 54 | |
56 | 55 | |
57 | | -if ( array_key_exists( 'categories' , $options ) ) { |
| 56 | +if ( array_key_exists( 'categories', $options ) ) { |
58 | 57 | $export_ns = NS_CATEGORY; |
59 | | -} elseif ( array_key_exists( 'concepts' , $options ) ) { |
| 58 | +} elseif ( array_key_exists( 'concepts', $options ) ) { |
60 | 59 | $export_ns = SMW_NS_CONCEPT; |
61 | | -} elseif ( array_key_exists( 'classes' , $options ) ) { |
| 60 | +} elseif ( array_key_exists( 'classes', $options ) ) { |
62 | 61 | $export_ns = array( NS_CATEGORY, SMW_NS_CONCEPT ); |
63 | | -} elseif ( array_key_exists( 'properties' , $options ) ) { |
| 62 | +} elseif ( array_key_exists( 'properties', $options ) ) { |
64 | 63 | $export_ns = SMW_NS_PROPERTY; |
65 | | -} elseif ( array_key_exists( 'types' , $options ) ) { |
| 64 | +} elseif ( array_key_exists( 'types', $options ) ) { |
66 | 65 | $export_ns = SMW_NS_TYPE; |
67 | | -} elseif ( array_key_exists( 'individuals' , $options ) ) { |
| 66 | +} elseif ( array_key_exists( 'individuals', $options ) ) { |
68 | 67 | $export_ns = - 1; |
69 | 68 | } else { |
70 | 69 | $export_ns = false; |