@@ -88,17 +88,26 @@ discard block |
||
88 | 88 | "; |
89 | 89 | } |
90 | 90 | |
91 | +/** |
|
92 | + * @param string $name |
|
93 | + */ |
|
91 | 94 | function item_xml($name, $val) { |
92 | 95 | if (!$val) $val = 0; |
93 | 96 | echo " <$name>$val</$name>\n"; |
94 | 97 | } |
95 | 98 | |
99 | +/** |
|
100 | + * @param string $name |
|
101 | + */ |
|
96 | 102 | function item_html($name, $val) { |
97 | 103 | $name = tra($name); |
98 | 104 | echo "<tr><td>$name</td><td>$val</td></tr>\n"; |
99 | 105 | //echo "<tr><td align=right>$name</td><td align=right>$val</td></tr>\n"; |
100 | 106 | } |
101 | 107 | |
108 | +/** |
|
109 | + * @param stdClass $x |
|
110 | + */ |
|
102 | 111 | function show_status_html($x) { |
103 | 112 | page_head(tra("Project status")); |
104 | 113 | $j = $x->jobs; |
@@ -190,6 +199,9 @@ discard block |
||
190 | 199 | page_tail(); |
191 | 200 | } |
192 | 201 | |
202 | +/** |
|
203 | + * @param stdClass $x |
|
204 | + */ |
|
193 | 205 | function show_status_xml($x) { |
194 | 206 | xml_header(); |
195 | 207 | echo "<server_status>\n<daemon_status>\n"; |
@@ -239,6 +251,11 @@ discard block |
||
239 | 251 | "; |
240 | 252 | } |
241 | 253 | |
254 | +/** |
|
255 | + * @param string $cmd |
|
256 | + * @param string $pidname |
|
257 | + * @param string $host |
|
258 | + */ |
|
242 | 259 | function local_daemon_running($cmd, $pidname, $host) { |
243 | 260 | if (!$pidname) { |
244 | 261 | $cmd = trim($cmd); |
@@ -25,6 +25,9 @@ |
||
25 | 25 | |
26 | 26 | check_get_args(array("mode")); |
27 | 27 | |
28 | +/** |
|
29 | + * @param string $mode |
|
30 | + */ |
|
28 | 31 | function filename($mode) { |
29 | 32 | switch ($mode) { |
30 | 33 | case 'host': return "cuda_hosts.dat"; |
@@ -37,6 +37,9 @@ discard block |
||
37 | 37 | return $n; |
38 | 38 | } |
39 | 39 | |
40 | +/** |
|
41 | + * @param integer $state |
|
42 | + */ |
|
40 | 43 | function show_all_link($batches, $state, $limit, $user, $app) { |
41 | 44 | $n = state_count($batches, $state); |
42 | 45 | if ($n > $limit) { |
@@ -269,6 +272,9 @@ discard block |
||
269 | 272 | page_tail(); |
270 | 273 | } |
271 | 274 | |
275 | +/** |
|
276 | + * @param null|integer $app_id |
|
277 | + */ |
|
272 | 278 | function check_admin_access($user, $app_id) { |
273 | 279 | $user_submit = BoincUserSubmit::lookup_userid($user->id); |
274 | 280 | if (!$user_submit) error_page("no access"); |
@@ -523,6 +529,9 @@ discard block |
||
523 | 529 | page_tail(); |
524 | 530 | } |
525 | 531 | |
532 | +/** |
|
533 | + * @param null|integer $state |
|
534 | + */ |
|
526 | 535 | function show_batches_in_state($batches, $state) { |
527 | 536 | switch ($state) { |
528 | 537 | case BATCH_STATE_IN_PROGRESS: |
@@ -57,6 +57,9 @@ |
||
57 | 57 | edit_form($user, $team, $forum, true); |
58 | 58 | } |
59 | 59 | |
60 | +/** |
|
61 | + * @param boolean $first |
|
62 | + */ |
|
60 | 63 | function edit_form($user, $team, $forum, $first) { |
61 | 64 | page_head(tra("Team Message Board")); |
62 | 65 | echo " |
@@ -30,6 +30,9 @@ |
||
30 | 30 | // list entries are of the form id => team, |
31 | 31 | // where team includes a field "refcnt". |
32 | 32 | // |
33 | +/** |
|
34 | + * @param integer $weight |
|
35 | + */ |
|
33 | 36 | function merge_lists($list1, &$list2, $weight) { |
34 | 37 | foreach($list1 as $team) { |
35 | 38 | $id = $team->id; |
@@ -26,6 +26,9 @@ discard block |
||
26 | 26 | var $db_name; |
27 | 27 | var $readonly; |
28 | 28 | |
29 | + /** |
|
30 | + * @param boolean $readonly |
|
31 | + */ |
|
29 | 32 | function init_conn($user, $passwd, $host, $name, $readonly) { |
30 | 33 | if (MYSQLI) { |
31 | 34 | $x = explode(":", $host); |
@@ -92,6 +95,14 @@ discard block |
||
92 | 95 | } |
93 | 96 | } |
94 | 97 | |
98 | + /** |
|
99 | + * @param string $table1 |
|
100 | + * @param string $table2 |
|
101 | + * @param string $joinfield1 |
|
102 | + * @param string $joinfield2 |
|
103 | + * @param string $classname |
|
104 | + * @param string $fields |
|
105 | + */ |
|
95 | 106 | function get_list($table1, $table2, $joinfield1, $joinfield2, $classname, $fields, $where_clause, $order_clause, $limit) { |
96 | 107 | $query = "select $fields from DBNAME.$table1 a join DBNAME.$table2 b on a.$joinfield1=b.$joinfield2 where $where_clause order by $order_clause desc limit $limit"; |
97 | 108 | $result = $this->do_query($query); |
@@ -131,6 +142,10 @@ discard block |
||
131 | 142 | return $this->lookup_fields($table, $classname, "*", $clause); |
132 | 143 | } |
133 | 144 | |
145 | + /** |
|
146 | + * @param string $table |
|
147 | + * @param string $classname |
|
148 | + */ |
|
134 | 149 | function lookup_id($id, $table, $classname) { |
135 | 150 | $id = (int)$id; |
136 | 151 | return $this->lookup($table, $classname, "id=$id"); |
@@ -165,28 +180,51 @@ discard block |
||
165 | 180 | return $this->enum_general($classname,$query); |
166 | 181 | } |
167 | 182 | |
183 | + /** |
|
184 | + * @param string $table |
|
185 | + * @param string $classname |
|
186 | + */ |
|
168 | 187 | function enum($table, $classname, $where_clause=null, $order_clause=null) { |
169 | 188 | return self::enum_fields( |
170 | 189 | $table, $classname, '*', $where_clause, $order_clause |
171 | 190 | ); |
172 | 191 | } |
173 | 192 | |
193 | + /** |
|
194 | + * @param string $table |
|
195 | + */ |
|
174 | 196 | function update($obj, $table, $clause) { |
175 | 197 | $query = "update DBNAME.$table set $clause where id=$obj->id"; |
176 | 198 | return $this->do_query($query); |
177 | 199 | } |
200 | + |
|
201 | + /** |
|
202 | + * @param string $table |
|
203 | + */ |
|
178 | 204 | function update_aux($table, $clause) { |
179 | 205 | $query = "update DBNAME.$table set $clause"; |
180 | 206 | return $this->do_query($query); |
181 | 207 | } |
208 | + |
|
209 | + /** |
|
210 | + * @param string $table |
|
211 | + */ |
|
182 | 212 | function insert($table, $clause) { |
183 | 213 | $query = "insert into DBNAME.$table $clause"; |
184 | 214 | return $this->do_query($query); |
185 | 215 | } |
216 | + |
|
217 | + /** |
|
218 | + * @param string $table |
|
219 | + */ |
|
186 | 220 | function delete($obj, $table) { |
187 | 221 | $query = "delete from DBNAME.$table where id=$obj->id"; |
188 | 222 | return $this->do_query($query); |
189 | 223 | } |
224 | + |
|
225 | + /** |
|
226 | + * @param string $table |
|
227 | + */ |
|
190 | 228 | function delete_aux($table, $clause) { |
191 | 229 | $query = "delete from DBNAME.$table where $clause"; |
192 | 230 | return $this->do_query($query); |
@@ -198,6 +236,10 @@ discard block |
||
198 | 236 | return mysql_insert_id($this->db_conn); |
199 | 237 | } |
200 | 238 | } |
239 | + |
|
240 | + /** |
|
241 | + * @param string $field |
|
242 | + */ |
|
201 | 243 | function get_int($query, $field) { |
202 | 244 | $result = $this->do_query($query); |
203 | 245 | if (!$result) error_page("database error on query $query"); |
@@ -228,14 +270,26 @@ discard block |
||
228 | 270 | $query = "select count(*) as total from DBNAME.$table where $clause"; |
229 | 271 | return $this->get_int($query, 'total'); |
230 | 272 | } |
273 | + |
|
274 | + /** |
|
275 | + * @param string $table |
|
276 | + */ |
|
231 | 277 | function sum($table, $field, $clause="") { |
232 | 278 | $query = "select sum($field) as total from DBNAME.$table $clause"; |
233 | 279 | return $this->get_double($query, 'total'); |
234 | 280 | } |
281 | + |
|
282 | + /** |
|
283 | + * @param string $table |
|
284 | + */ |
|
235 | 285 | function max($table, $field, $clause="") { |
236 | 286 | $query = "select max($field) as total from DBNAME.$table $clause"; |
237 | 287 | return $this->get_double($query, 'total'); |
238 | 288 | } |
289 | + |
|
290 | + /** |
|
291 | + * @param string $table |
|
292 | + */ |
|
239 | 293 | function percentile($table, $field, $clause, $pct) { |
240 | 294 | $n = $this->count($table, $clause); |
241 | 295 | if (!$n) return false; |
@@ -243,6 +297,10 @@ discard block |
||
243 | 297 | $query = "select $field from DBNAME.$table where $clause order by $field limit $m,1"; |
244 | 298 | return $this->get_double($query, $field); |
245 | 299 | } |
300 | + |
|
301 | + /** |
|
302 | + * @param string $table |
|
303 | + */ |
|
246 | 304 | function replace($table, $clause) { |
247 | 305 | $query = "replace into DBNAME.$table set $clause"; |
248 | 306 | return $this->do_query($query); |
@@ -38,6 +38,9 @@ |
||
38 | 38 | // return a column title (Average or Total), |
39 | 39 | // hyperlinked if this is not the current sort column |
40 | 40 | // |
41 | +/** |
|
42 | + * @param integer $i |
|
43 | + */ |
|
41 | 44 | function col_title($is_team, $app, $appid, $is_total, $i) { |
42 | 45 | $x = $i ? tra("Total") : tra("Average"); |
43 | 46 | if ($app->id == $appid && ($is_total ? $i : !$i)) { |
@@ -799,6 +799,9 @@ |
||
799 | 799 | return $form; |
800 | 800 | } |
801 | 801 | |
802 | +/** |
|
803 | + * @param boolean $_dco_form |
|
804 | + */ |
|
802 | 805 | function elysia_cron_reset_statistics_form_submit($_dco_form, &$_dco_form_state) { |
803 | 806 | elysia_cron_reset_stats(); |
804 | 807 |
@@ -222,6 +222,7 @@ discard block |
||
222 | 222 | * A substitute for variable_get to avoid cache management |
223 | 223 | * Use ONLY for variables setted during cron execution: elysia_cron_semaphore, elysia_cron_last_run, elysia_cron_last_context, cron_semaphore, cron_last |
224 | 224 | * WARN_UPGRADE |
225 | + * @param string $name |
|
225 | 226 | */ |
226 | 227 | function _ec_variable_get($name, $default) { |
227 | 228 | global $_ec_variables, $_ec_variables_allowed; |
@@ -251,6 +252,7 @@ discard block |
||
251 | 252 | * A substitute for variable_set to avoid cache management |
252 | 253 | * Use ONLY for variables setted during cron execution: elysia_cron_semaphore, elysia_cron_last_run, elysia_cron_last_context, cron_semaphore, cron_last |
253 | 254 | * WARN_UPGRADE |
255 | + * @param string $name |
|
254 | 256 | */ |
255 | 257 | function _ec_variable_set($name, $value) { |
256 | 258 | global $_ec_variables, $_ec_variables_allowed; |
@@ -286,6 +288,7 @@ discard block |
||
286 | 288 | * A substitute for variable_del to avoid cache management |
287 | 289 | * Use ONLY for variables setted during cron execution: elysia_cron_semaphore, elysia_cron_last_run, elysia_cron_last_context, cron_semaphore, cron_last |
288 | 290 | * WARN_UPGRADE |
291 | + * @param string $name |
|
289 | 292 | */ |
290 | 293 | function _ec_variable_del($name) { |
291 | 294 | global $_ec_variables, $_ec_variables_allowed; |
@@ -407,6 +410,9 @@ discard block |
||
407 | 410 | unset($elysia_cron_db_cache[$name]); |
408 | 411 | } |
409 | 412 | |
413 | +/** |
|
414 | + * @param string $key |
|
415 | + */ |
|
410 | 416 | function elysia_cron_get($name, $channel = false, $key, $default, $refresh = false) { |
411 | 417 | global $elysia_cron_db_cache; |
412 | 418 | static $elysia_cron_defaults; |
@@ -450,6 +456,9 @@ discard block |
||
450 | 456 | return elysia_cron_get($channel, true, 'disable', $default, $refresh); |
451 | 457 | } |
452 | 458 | |
459 | +/** |
|
460 | + * @param string $v |
|
461 | + */ |
|
453 | 462 | function elysia_cron_set_channel_disabled($channel, $v) { |
454 | 463 | return elysia_cron_set($channel, true, array('disable' => $v ? 1 : 0)); |
455 | 464 | } |
@@ -466,6 +475,9 @@ discard block |
||
466 | 475 | return elysia_cron_get($channel, true, 'rule', $default, $refresh); |
467 | 476 | } |
468 | 477 | |
478 | +/** |
|
479 | + * @param string $v |
|
480 | + */ |
|
469 | 481 | function elysia_cron_set_channel_rule($channel, $v) { |
470 | 482 | return elysia_cron_set($channel, true, array('rule' => $v)); |
471 | 483 | } |
@@ -478,6 +490,9 @@ discard block |
||
478 | 490 | return elysia_cron_get($channel, true, 'running', $default, $refresh); |
479 | 491 | } |
480 | 492 | |
493 | +/** |
|
494 | + * @param integer $v |
|
495 | + */ |
|
481 | 496 | function elysia_cron_set_channel_running($channel, $v) { |
482 | 497 | return elysia_cron_set($channel, true, array('running' => $v)); |
483 | 498 | } |
@@ -569,6 +584,9 @@ discard block |
||
569 | 584 | return elysia_cron_get($job, false, 'rule', $default, $refresh); |
570 | 585 | } |
571 | 586 | |
587 | +/** |
|
588 | + * @param string $v |
|
589 | + */ |
|
572 | 590 | function elysia_cron_set_job_rule($job, $v) { |
573 | 591 | return elysia_cron_set($job, false, array('rule' => $v)); |
574 | 592 | } |
@@ -585,6 +603,9 @@ discard block |
||
585 | 603 | return elysia_cron_get($job, false, 'weight', $default, $refresh); |
586 | 604 | } |
587 | 605 | |
606 | +/** |
|
607 | + * @param string $v |
|
608 | + */ |
|
588 | 609 | function elysia_cron_set_job_weight($job, $v) { |
589 | 610 | return elysia_cron_set($job, false, array('weight' => $v)); |
590 | 611 | } |
@@ -601,6 +622,9 @@ discard block |
||
601 | 622 | return elysia_cron_get($job, false, 'disable', $default, $refresh); |
602 | 623 | } |
603 | 624 | |
625 | +/** |
|
626 | + * @param string $v |
|
627 | + */ |
|
604 | 628 | function elysia_cron_set_job_disabled($job, $v) { |
605 | 629 | return elysia_cron_set($job, false, array('disable' => $v ? 1 : 0)); |
606 | 630 | } |
@@ -620,6 +644,9 @@ discard block |
||
620 | 644 | return !$c ? $default : $c; |
621 | 645 | } |
622 | 646 | |
647 | +/** |
|
648 | + * @param string $v |
|
649 | + */ |
|
623 | 650 | function elysia_cron_set_job_channel($job, $v) { |
624 | 651 | return elysia_cron_set($job, false, array('context' => $v)); |
625 | 652 | } |
@@ -632,6 +659,9 @@ discard block |
||
632 | 659 | return elysia_cron_get($job, false, 'running', $default, $refresh); |
633 | 660 | } |
634 | 661 | |
662 | +/** |
|
663 | + * @param integer $v |
|
664 | + */ |
|
635 | 665 | function elysia_cron_set_job_running($job, $v) { |
636 | 666 | return elysia_cron_set($job, false, array('running' => $v)); |
637 | 667 | } |