Index: trunk/phase3/tests/phpunit/languages/LanguageTest.php |
— | — | @@ -23,12 +23,12 @@ |
24 | 24 | 'convertDoubleWidth() with the full alphabet and digits' |
25 | 25 | ); |
26 | 26 | } |
27 | | - |
| 27 | + |
28 | 28 | /** @dataProvider provideFormattableTimes */ |
29 | 29 | function testFormatTimePeriod( $seconds, $format, $expected, $desc ) { |
30 | 30 | $this->assertEquals( $expected, $this->lang->formatTimePeriod( $seconds, $format ), $desc ); |
31 | 31 | } |
32 | | - |
| 32 | + |
33 | 33 | function provideFormattableTimes() { |
34 | 34 | return array( |
35 | 35 | array( 9.45, array(), '9.5s', 'formatTimePeriod() rounding (<10s)' ), |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | array( 176460.55, array(), '2d 1h 1m 1s', 'formatTimePeriod() rounding, recursion, (>48h)' ), |
64 | 64 | array( 176460.55, array( 'noabbrevs' => true ), '2 days 1 hour 1 minute 1 second', 'formatTimePeriod() rounding, recursion, (>48h)' ), |
65 | 65 | ); |
66 | | - |
| 66 | + |
67 | 67 | } |
68 | 68 | |
69 | 69 | function testTruncate() { |
— | — | @@ -224,7 +224,7 @@ |
225 | 225 | "sprintfDate('$format', '$ts'): $msg" |
226 | 226 | ); |
227 | 227 | |
228 | | - date_default_timezone_set( $oldTZ ); |
| 228 | + date_default_timezone_set( $oldTZ ); |
229 | 229 | } |
230 | 230 | |
231 | 231 | function provideSprintfDateSamples() { |
Index: trunk/phase3/includes/objectcache/MemcachedClient.php |
— | — | @@ -344,11 +344,20 @@ |
345 | 345 | return false; |
346 | 346 | } |
347 | 347 | |
| 348 | + /** |
| 349 | + * @param $key |
| 350 | + * @param $timeout int |
| 351 | + * @return bool |
| 352 | + */ |
348 | 353 | public function lock( $key, $timeout = 0 ) { |
349 | 354 | /* stub */ |
350 | 355 | return true; |
351 | 356 | } |
352 | 357 | |
| 358 | + /** |
| 359 | + * @param $key |
| 360 | + * @return bool |
| 361 | + */ |
353 | 362 | public function unlock( $key ) { |
354 | 363 | /* stub */ |
355 | 364 | return true; |
— | — | @@ -471,7 +480,7 @@ |
472 | 481 | $this->stats['get_multi'] = 1; |
473 | 482 | } |
474 | 483 | $sock_keys = array(); |
475 | | - |
| 484 | + $socks = array(); |
476 | 485 | foreach ( $keys as $key ) { |
477 | 486 | $sock = $this->get_sock( $key ); |
478 | 487 | if ( !is_resource( $sock ) ) { |
— | — | @@ -485,6 +494,7 @@ |
486 | 495 | $sock_keys[$sock][] = $key; |
487 | 496 | } |
488 | 497 | |
| 498 | + $gather = array(); |
489 | 499 | // Send out the requests |
490 | 500 | foreach ( $socks as $sock ) { |
491 | 501 | $cmd = 'get'; |
— | — | @@ -579,6 +589,7 @@ |
580 | 590 | return array(); |
581 | 591 | } |
582 | 592 | |
| 593 | + $ret = array(); |
583 | 594 | while ( true ) { |
584 | 595 | $res = fgets( $sock ); |
585 | 596 | $ret[] = $res; |
— | — | @@ -744,6 +755,9 @@ |
745 | 756 | $this->_dead_host( $host ); |
746 | 757 | } |
747 | 758 | |
| 759 | + /** |
| 760 | + * @param $host |
| 761 | + */ |
748 | 762 | function _dead_host( $host ) { |
749 | 763 | $parts = explode( ':', $host ); |
750 | 764 | $ip = $parts[0]; |
— | — | @@ -774,8 +788,8 @@ |
775 | 789 | } |
776 | 790 | |
777 | 791 | $hv = is_array( $key ) ? intval( $key[0] ) : $this->_hashfunc( $key ); |
778 | | - |
779 | 792 | if ( $this->_buckets === null ) { |
| 793 | + $bu = array(); |
780 | 794 | foreach ( $this->_servers as $v ) { |
781 | 795 | if ( is_array( $v ) ) { |
782 | 796 | for( $i = 0; $i < $v[1]; $i++ ) { |
— | — | @@ -851,7 +865,8 @@ |
852 | 866 | $this->stats[$cmd] = 1; |
853 | 867 | } |
854 | 868 | if ( !$this->_safe_fwrite( $sock, "$cmd $key $amt\r\n" ) ) { |
855 | | - return $this->_dead_sock( $sock ); |
| 869 | + $this->_dead_sock( $sock ); |
| 870 | + return null; |
856 | 871 | } |
857 | 872 | |
858 | 873 | $line = fgets( $sock ); |
— | — | @@ -998,7 +1013,8 @@ |
999 | 1014 | } |
1000 | 1015 | } |
1001 | 1016 | if ( !$this->_safe_fwrite( $sock, "$cmd $key $flags $exp $len\r\n$val\r\n" ) ) { |
1002 | | - return $this->_dead_sock( $sock ); |
| 1017 | + $this->_dead_sock( $sock ); |
| 1018 | + return false; |
1003 | 1019 | } |
1004 | 1020 | |
1005 | 1021 | $line = trim( fgets( $sock ) ); |
— | — | @@ -1038,7 +1054,8 @@ |
1039 | 1055 | } |
1040 | 1056 | |
1041 | 1057 | if ( !$this->_connect_sock( $sock, $host ) ) { |
1042 | | - return $this->_dead_host( $host ); |
| 1058 | + $this->_dead_host( $host ); |
| 1059 | + return null; |
1043 | 1060 | } |
1044 | 1061 | |
1045 | 1062 | // Do not buffer writes |
— | — | @@ -1049,6 +1066,9 @@ |
1050 | 1067 | return $this->_cache_sock[$host]; |
1051 | 1068 | } |
1052 | 1069 | |
| 1070 | + /** |
| 1071 | + * @param $str string |
| 1072 | + */ |
1053 | 1073 | function _debugprint( $str ) { |
1054 | 1074 | print( $str ); |
1055 | 1075 | } |
— | — | @@ -1080,6 +1100,9 @@ |
1081 | 1101 | |
1082 | 1102 | /** |
1083 | 1103 | * Original behaviour |
| 1104 | + * @param $f |
| 1105 | + * @param $buf |
| 1106 | + * @param $len bool |
1084 | 1107 | * @return int |
1085 | 1108 | */ |
1086 | 1109 | function _safe_fwrite( $f, $buf, $len = false ) { |
— | — | @@ -1093,6 +1116,7 @@ |
1094 | 1117 | |
1095 | 1118 | /** |
1096 | 1119 | * Flush the read buffer of a stream |
| 1120 | + * @param $f Resource |
1097 | 1121 | */ |
1098 | 1122 | function _flush_read_buffer( $f ) { |
1099 | 1123 | if ( !is_resource( $f ) ) { |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -3800,7 +3800,7 @@ |
3801 | 3801 | |
3802 | 3802 | /** |
3803 | 3803 | * Decode an expiry (block, protection, etc) which has come from the DB |
3804 | | - * |
| 3804 | + * |
3805 | 3805 | * @FIXME: why are we returnings DBMS-dependent strings??? |
3806 | 3806 | * |
3807 | 3807 | * @param $expiry String: Database expiry String |
Index: trunk/phase3/languages/classes/LanguageKaa.php |
— | — | @@ -41,11 +41,11 @@ |
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | | - * It fixes issue with lcfirst for transforming 'I' to 'ı' |
| 45 | + * It fixes issue with lcfirst for transforming 'I' to 'ı' |
46 | 46 | * |
47 | 47 | * @param $string string |
48 | 48 | * |
49 | | - * @return string |
| 49 | + * @return mixed|string |
50 | 50 | */ |
51 | 51 | function lcfirst ( $string ) { |
52 | 52 | if ( substr( $string, 0, 1 ) === 'I' ) { |