Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -1749,11 +1749,6 @@ |
1750 | 1750 | 'allpagesbadtitle', |
1751 | 1751 | 'allpages-bad-ns', |
1752 | 1752 | ), |
1753 | | - 'cachedspecial' => array( |
1754 | | - 'cachedspecial-viewing-cached-ttl', |
1755 | | - 'cachedspecial-viewing-cached-ts', |
1756 | | - 'cachedspecial-refresh-now', |
1757 | | - ), |
1758 | 1753 | 'categories' => array( |
1759 | 1754 | 'categories', |
1760 | 1755 | 'categories-summary', |
— | — | @@ -3691,17 +3686,6 @@ |
3692 | 3687 | 'api-error-uploaddisabled', |
3693 | 3688 | 'api-error-verification-error', |
3694 | 3689 | ), |
3695 | | - 'duration' => array( |
3696 | | - 'duration-seconds', |
3697 | | - 'duration-minutes', |
3698 | | - 'duration-hours', |
3699 | | - 'duration-days', |
3700 | | - 'duration-weeks', |
3701 | | - 'duration-years', |
3702 | | - 'duration-decades', |
3703 | | - 'duration-centuries', |
3704 | | - 'duration-millennia' |
3705 | | - ), |
3706 | 3690 | ); |
3707 | 3691 | |
3708 | 3692 | /** Comments for each block */ |
— | — | @@ -3939,6 +3923,4 @@ |
3940 | 3924 | 'logging-irc' => 'For IRC, see bug 34508. Do not change', |
3941 | 3925 | 'feedback' => 'Feedback', |
3942 | 3926 | 'apierrors' => 'API errors', |
3943 | | - 'duration' => 'Durations', |
3944 | | - 'cachedspecial' => 'SpecialCachedPage', |
3945 | 3927 | ); |
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() { |
— | — | @@ -537,48 +537,48 @@ |
538 | 538 | return array( |
539 | 539 | array( |
540 | 540 | 0, |
541 | | - '0 B', |
542 | | - 'Zero bytes' |
| 541 | + "0 B", |
| 542 | + "Zero bytes" |
543 | 543 | ), |
544 | 544 | array( |
545 | 545 | 1024, |
546 | | - '1 KB', |
547 | | - '1 kilobyte' |
| 546 | + "1 KB", |
| 547 | + "1 kilobyte" |
548 | 548 | ), |
549 | 549 | array( |
550 | 550 | 1024 * 1024, |
551 | | - '1 MB', |
552 | | - '1,024 megabytes' |
| 551 | + "1 MB", |
| 552 | + "1,024 megabytes" |
553 | 553 | ), |
554 | 554 | array( |
555 | 555 | 1024 * 1024 * 1024, |
556 | | - '1 GB', |
557 | | - '1 gigabytes' |
| 556 | + "1 GB", |
| 557 | + "1 gigabytes" |
558 | 558 | ), |
559 | 559 | array( |
560 | 560 | pow( 1024, 4 ), |
561 | | - '1 TB', |
562 | | - '1 terabyte' |
| 561 | + "1 TB", |
| 562 | + "1 terabyte" |
563 | 563 | ), |
564 | 564 | array( |
565 | 565 | pow( 1024, 5 ), |
566 | | - '1 PB', |
567 | | - '1 petabyte' |
| 566 | + "1 PB", |
| 567 | + "1 petabyte" |
568 | 568 | ), |
569 | 569 | array( |
570 | 570 | pow( 1024, 6 ), |
571 | | - '1 EB', |
572 | | - '1,024 exabyte' |
| 571 | + "1 EB", |
| 572 | + "1,024 exabyte" |
573 | 573 | ), |
574 | 574 | array( |
575 | 575 | pow( 1024, 7 ), |
576 | | - '1 ZB', |
577 | | - '1 zetabyte' |
| 576 | + "1 ZB", |
| 577 | + "1 zetabyte" |
578 | 578 | ), |
579 | 579 | array( |
580 | 580 | pow( 1024, 8 ), |
581 | | - '1 YB', |
582 | | - '1 yottabyte' |
| 581 | + "1 YB", |
| 582 | + "1 yottabyte" |
583 | 583 | ), |
584 | 584 | // How big!? THIS BIG! |
585 | 585 | ); |
— | — | @@ -599,194 +599,59 @@ |
600 | 600 | return array( |
601 | 601 | array( |
602 | 602 | 0, |
603 | | - '0bps', |
604 | | - '0 bits per second' |
| 603 | + "0bps", |
| 604 | + "0 bits per second" |
605 | 605 | ), |
606 | 606 | array( |
607 | 607 | 999, |
608 | | - '999bps', |
609 | | - '999 bits per second' |
| 608 | + "999bps", |
| 609 | + "999 bits per second" |
610 | 610 | ), |
611 | 611 | array( |
612 | 612 | 1000, |
613 | | - '1kbps', |
614 | | - '1 kilobit per second' |
| 613 | + "1kbps", |
| 614 | + "1 kilobit per second" |
615 | 615 | ), |
616 | 616 | array( |
617 | 617 | 1000 * 1000, |
618 | | - '1Mbps', |
619 | | - '1 megabit per second' |
| 618 | + "1Mbps", |
| 619 | + "1 megabit per second" |
620 | 620 | ), |
621 | 621 | array( |
622 | 622 | pow( 10, 9 ), |
623 | | - '1Gbps', |
624 | | - '1 gigabit per second' |
| 623 | + "1Gbps", |
| 624 | + "1 gigabit per second" |
625 | 625 | ), |
626 | 626 | array( |
627 | 627 | pow( 10, 12 ), |
628 | | - '1Tbps', |
629 | | - '1 terabit per second' |
| 628 | + "1Tbps", |
| 629 | + "1 terabit per second" |
630 | 630 | ), |
631 | 631 | array( |
632 | 632 | pow( 10, 15 ), |
633 | | - '1Pbps', |
634 | | - '1 petabit per second' |
| 633 | + "1Pbps", |
| 634 | + "1 petabit per second" |
635 | 635 | ), |
636 | 636 | array( |
637 | 637 | pow( 10, 18 ), |
638 | | - '1Ebps', |
639 | | - '1 exabit per second' |
| 638 | + "1Ebps", |
| 639 | + "1 exabit per second" |
640 | 640 | ), |
641 | 641 | array( |
642 | 642 | pow( 10, 21 ), |
643 | | - '1Zbps', |
644 | | - '1 zetabit per second' |
| 643 | + "1Zbps", |
| 644 | + "1 zetabit per second" |
645 | 645 | ), |
646 | 646 | array( |
647 | 647 | pow( 10, 24 ), |
648 | | - '1Ybps', |
649 | | - '1 yottabit per second' |
| 648 | + "1Ybps", |
| 649 | + "1 yottabit per second" |
650 | 650 | ), |
651 | 651 | array( |
652 | 652 | pow( 10, 27 ), |
653 | | - '1,000Ybps', |
654 | | - '1,000 yottabits per second' |
| 653 | + "1,000Ybps", |
| 654 | + "1,000 yottabits per second" |
655 | 655 | ), |
656 | 656 | ); |
657 | 657 | } |
658 | | - |
659 | | - /** |
660 | | - * @dataProvider provideFormatDuration |
661 | | - */ |
662 | | - function testFormatDuration( $duration, $expected, $intervals = array() ) { |
663 | | - $this->assertEquals( |
664 | | - $expected, |
665 | | - $this->lang->formatDuration( $duration, $intervals ), |
666 | | - "formatDuration('$duration'): $expected" |
667 | | - ); |
668 | | - } |
669 | | - |
670 | | - function provideFormatDuration() { |
671 | | - return array( |
672 | | - array( |
673 | | - 0, |
674 | | - '0 seconds', |
675 | | - ), |
676 | | - array( |
677 | | - 1, |
678 | | - '1 second', |
679 | | - ), |
680 | | - array( |
681 | | - 2, |
682 | | - '2 seconds', |
683 | | - ), |
684 | | - array( |
685 | | - 60, |
686 | | - '1 minute', |
687 | | - ), |
688 | | - array( |
689 | | - 2 * 60, |
690 | | - '2 minutes', |
691 | | - ), |
692 | | - array( |
693 | | - 3600, |
694 | | - '1 hour', |
695 | | - ), |
696 | | - array( |
697 | | - 2 * 3600, |
698 | | - '2 hours', |
699 | | - ), |
700 | | - array( |
701 | | - 24 * 3600, |
702 | | - '1 day', |
703 | | - ), |
704 | | - array( |
705 | | - 2 * 86400, |
706 | | - '2 days', |
707 | | - ), |
708 | | - array( |
709 | | - 365.25 * 86400, // 365.25 * 86400 = 31557600 |
710 | | - '1 year', |
711 | | - ), |
712 | | - array( |
713 | | - 2 * 31557600, |
714 | | - '2 years', |
715 | | - ), |
716 | | - array( |
717 | | - 10 * 31557600, |
718 | | - '1 decade', |
719 | | - ), |
720 | | - array( |
721 | | - 20 * 31557600, |
722 | | - '2 decades', |
723 | | - ), |
724 | | - array( |
725 | | - 100 * 31557600, |
726 | | - '1 century', |
727 | | - ), |
728 | | - array( |
729 | | - 200 * 31557600, |
730 | | - '2 centuries', |
731 | | - ), |
732 | | - array( |
733 | | - 1000 * 31557600, |
734 | | - '1 millennium', |
735 | | - ), |
736 | | - array( |
737 | | - 2000 * 31557600, |
738 | | - '2 millennia', |
739 | | - ), |
740 | | - array( |
741 | | - 9001, |
742 | | - '2 hours, 30 minutes and 1 second' |
743 | | - ), |
744 | | - array( |
745 | | - 3601, |
746 | | - '1 hour and 1 second' |
747 | | - ), |
748 | | - array( |
749 | | - 31557600 + 2 * 86400 + 9000, |
750 | | - '1 year, 2 days, 2 hours and 30 minutes' |
751 | | - ), |
752 | | - array( |
753 | | - 42 * 1000 * 31557600 + 42, |
754 | | - '42 millennia and 42 seconds' |
755 | | - ), |
756 | | - array( |
757 | | - 60, |
758 | | - '60 seconds', |
759 | | - array( 'seconds' ), |
760 | | - ), |
761 | | - array( |
762 | | - 61, |
763 | | - '61 seconds', |
764 | | - array( 'seconds' ), |
765 | | - ), |
766 | | - array( |
767 | | - 1, |
768 | | - '1 second', |
769 | | - array( 'seconds' ), |
770 | | - ), |
771 | | - array( |
772 | | - 31557600 + 2 * 86400 + 9000, |
773 | | - '1 year, 2 days and 150 minutes', |
774 | | - array( 'years', 'days', 'minutes' ), |
775 | | - ), |
776 | | - array( |
777 | | - 42, |
778 | | - '0 days', |
779 | | - array( 'years', 'days' ), |
780 | | - ), |
781 | | - array( |
782 | | - 31557600 + 2 * 86400 + 9000, |
783 | | - '1 year, 2 days and 150 minutes', |
784 | | - array( 'minutes', 'days', 'years' ), |
785 | | - ), |
786 | | - array( |
787 | | - 42, |
788 | | - '0 days', |
789 | | - array( 'days', 'years' ), |
790 | | - ), |
791 | | - ); |
792 | | - } |
793 | 658 | } |
Index: trunk/phase3/includes/CacheHelper.php |
— | — | @@ -1,339 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Interface for all classes implementing CacheHelper functionality. |
6 | | - * |
7 | | - * @since 1.20 |
8 | | - * |
9 | | - * @licence GNU GPL v2 or later |
10 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
11 | | - */ |
12 | | -interface ICacheHelper { |
13 | | - |
14 | | - /** |
15 | | - * Sets if the cache should be enabled or not. |
16 | | - * |
17 | | - * @since 1.20 |
18 | | - * @param boolean $cacheEnabled |
19 | | - */ |
20 | | - function setCacheEnabled( $cacheEnabled ); |
21 | | - |
22 | | - /** |
23 | | - * Initializes the caching. |
24 | | - * Should be called before the first time anything is added via addCachedHTML. |
25 | | - * |
26 | | - * @since 1.20 |
27 | | - * |
28 | | - * @param integer|null $cacheExpiry Sets the cache expirty, either ttl in seconds or unix timestamp. |
29 | | - * @param boolean|null $cacheEnabled Sets if the cache should be enabled or not. |
30 | | - */ |
31 | | - function startCache( $cacheExpiry = null, $cacheEnabled = null ); |
32 | | - |
33 | | - /** |
34 | | - * Get a cached value if available or compute it if not and then cache it if possible. |
35 | | - * The provided $computeFunction is only called when the computation needs to happen |
36 | | - * and should return a result value. $args are arguments that will be passed to the |
37 | | - * compute function when called. |
38 | | - * |
39 | | - * @since 1.20 |
40 | | - * |
41 | | - * @param {function} $computeFunction |
42 | | - * @param array|mixed $args |
43 | | - * @param string|null $key |
44 | | - * |
45 | | - * @return mixed |
46 | | - */ |
47 | | - function getCachedValue( $computeFunction, $args = array(), $key = null ); |
48 | | - |
49 | | - /** |
50 | | - * Saves the HTML to the cache in case it got recomputed. |
51 | | - * Should be called after the last time anything is added via addCachedHTML. |
52 | | - * |
53 | | - * @since 1.20 |
54 | | - */ |
55 | | - function saveCache(); |
56 | | - |
57 | | - /** |
58 | | - * Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry.. |
59 | | - * |
60 | | - * @since 1.20 |
61 | | - * |
62 | | - * @param integer $cacheExpiry |
63 | | - */ |
64 | | - function setExpirey( $cacheExpiry ); |
65 | | - |
66 | | -} |
67 | | - |
68 | | -/** |
69 | | - * Helper class for caching various elements in a single cache entry. |
70 | | - * |
71 | | - * To get a cached value or compute it, use getCachedValue like this: |
72 | | - * $this->getCachedValue( $callback ); |
73 | | - * |
74 | | - * To add HTML that should be cached, use addCachedHTML like this: |
75 | | - * $this->addCachedHTML( $callback ); |
76 | | - * |
77 | | - * The callback function is only called when needed, so do all your expensive |
78 | | - * computations here. This function should returns the HTML to be cached. |
79 | | - * It should not add anything to the PageOutput object! |
80 | | - * |
81 | | - * Before the first addCachedHTML call, you should call $this->startCache(); |
82 | | - * After adding the last HTML that should be cached, call $this->saveCache(); |
83 | | - * |
84 | | - * @since 1.20 |
85 | | - * |
86 | | - * @file CacheHelper.php |
87 | | - * |
88 | | - * @licence GNU GPL v2 or later |
89 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
90 | | - */ |
91 | | -class CacheHelper implements ICacheHelper { |
92 | | - |
93 | | - /** |
94 | | - * The time to live for the cache, in seconds or a unix timestamp indicating the point of expiry. |
95 | | - * |
96 | | - * @since 1.20 |
97 | | - * @var integer |
98 | | - */ |
99 | | - protected $cacheExpiry = 3600; |
100 | | - |
101 | | - /** |
102 | | - * List of HTML chunks to be cached (if !hasCached) or that where cashed (of hasCached). |
103 | | - * If no cached already, then the newly computed chunks are added here, |
104 | | - * if it as cached already, chunks are removed from this list as they are needed. |
105 | | - * |
106 | | - * @since 1.20 |
107 | | - * @var array |
108 | | - */ |
109 | | - protected $cachedChunks; |
110 | | - |
111 | | - /** |
112 | | - * Indicates if the to be cached content was already cached. |
113 | | - * Null if this information is not available yet. |
114 | | - * |
115 | | - * @since 1.20 |
116 | | - * @var boolean|null |
117 | | - */ |
118 | | - protected $hasCached = null; |
119 | | - |
120 | | - /** |
121 | | - * If the cache is enabled or not. |
122 | | - * |
123 | | - * @since 1.20 |
124 | | - * @var boolean |
125 | | - */ |
126 | | - protected $cacheEnabled = true; |
127 | | - |
128 | | - /** |
129 | | - * Function that gets called when initialization is done. |
130 | | - * |
131 | | - * @since 1.20 |
132 | | - * @var function |
133 | | - */ |
134 | | - protected $onInitHandler = false; |
135 | | - |
136 | | - /** |
137 | | - * Sets if the cache should be enabled or not. |
138 | | - * |
139 | | - * @since 1.20 |
140 | | - * @param boolean $cacheEnabled |
141 | | - */ |
142 | | - public function setCacheEnabled( $cacheEnabled ) { |
143 | | - $this->cacheEnabled = $cacheEnabled; |
144 | | - } |
145 | | - |
146 | | - /** |
147 | | - * Initializes the caching. |
148 | | - * Should be called before the first time anything is added via addCachedHTML. |
149 | | - * |
150 | | - * @since 1.20 |
151 | | - * |
152 | | - * @param integer|null $cacheExpiry Sets the cache expirty, either ttl in seconds or unix timestamp. |
153 | | - * @param boolean|null $cacheEnabled Sets if the cache should be enabled or not. |
154 | | - */ |
155 | | - public function startCache( $cacheExpiry = null, $cacheEnabled = null ) { |
156 | | - if ( is_null( $this->hasCached ) ) { |
157 | | - if ( !is_null( $cacheExpiry ) ) { |
158 | | - $this->cacheExpiry = $cacheExpiry; |
159 | | - } |
160 | | - |
161 | | - if ( !is_null( $cacheEnabled ) ) { |
162 | | - $this->setCacheEnabled( $cacheEnabled ); |
163 | | - } |
164 | | - |
165 | | - $this->initCaching(); |
166 | | - } |
167 | | - } |
168 | | - |
169 | | - /** |
170 | | - * Returns a message that notifies the user he/she is looking at |
171 | | - * a cached version of the page, including a refresh link. |
172 | | - * |
173 | | - * @since 1.20 |
174 | | - * |
175 | | - * @param IContextSource $context |
176 | | - * |
177 | | - * @return string |
178 | | - */ |
179 | | - public function getCachedNotice( IContextSource $context ) { |
180 | | - $refreshArgs = $context->getRequest()->getQueryValues(); |
181 | | - unset( $refreshArgs['title'] ); |
182 | | - $refreshArgs['action'] = 'purge'; |
183 | | - |
184 | | - $subPage = $context->getTitle()->getFullText(); |
185 | | - $subPage = explode( '/', $subPage, 2 ); |
186 | | - $subPage = count( $subPage ) > 1 ? $subPage[1] : false; |
187 | | - |
188 | | - $refreshLink = Linker::link( |
189 | | - $context->getTitle( $subPage ), |
190 | | - $context->msg( 'cachedspecial-refresh-now' )->escaped(), |
191 | | - array(), |
192 | | - $refreshArgs |
193 | | - ); |
194 | | - |
195 | | - if ( $this->cacheExpiry < 86400 * 3650 ) { |
196 | | - $message = $context->msg( |
197 | | - 'cachedspecial-viewing-cached-ttl', |
198 | | - $context->getLanguage()->formatDuration( $this->cacheExpiry ) |
199 | | - )->escaped(); |
200 | | - } |
201 | | - else { |
202 | | - $message = $context->msg( |
203 | | - 'cachedspecial-viewing-cached-ts' |
204 | | - )->escaped(); |
205 | | - } |
206 | | - |
207 | | - return $message . ' ' . $refreshLink; |
208 | | - } |
209 | | - |
210 | | - /** |
211 | | - * Initializes the caching if not already done so. |
212 | | - * Should be called before any of the caching functionality is used. |
213 | | - * |
214 | | - * @since 1.20 |
215 | | - */ |
216 | | - protected function initCaching() { |
217 | | - if ( $this->cacheEnabled && is_null( $this->hasCached ) ) { |
218 | | - $cachedChunks = wfGetCache( CACHE_ANYTHING )->get( $this->getCacheKeyString() ); |
219 | | - |
220 | | - $this->hasCached = is_array( $cachedChunks ); |
221 | | - $this->cachedChunks = $this->hasCached ? $cachedChunks : array(); |
222 | | - |
223 | | - if ( $this->onInitHandler !== false ) { |
224 | | - call_user_func( $this->onInitHandler, $this->hasCached ); |
225 | | - } |
226 | | - } |
227 | | - } |
228 | | - |
229 | | - /** |
230 | | - * Get a cached value if available or compute it if not and then cache it if possible. |
231 | | - * The provided $computeFunction is only called when the computation needs to happen |
232 | | - * and should return a result value. $args are arguments that will be passed to the |
233 | | - * compute function when called. |
234 | | - * |
235 | | - * @since 1.20 |
236 | | - * |
237 | | - * @param {function} $computeFunction |
238 | | - * @param array|mixed $args |
239 | | - * @param string|null $key |
240 | | - * |
241 | | - * @return mixed |
242 | | - */ |
243 | | - public function getCachedValue( $computeFunction, $args = array(), $key = null ) { |
244 | | - $this->initCaching(); |
245 | | - |
246 | | - if ( $this->cacheEnabled && $this->hasCached ) { |
247 | | - $value = null; |
248 | | - |
249 | | - if ( is_null( $key ) ) { |
250 | | - $itemKey = array_keys( array_slice( $this->cachedChunks, 0, 1 ) ); |
251 | | - $itemKey = array_shift( $itemKey ); |
252 | | - |
253 | | - if ( !is_integer( $itemKey ) ) { |
254 | | - wfWarn( "Attempted to get item with non-numeric key while the next item in the queue has a key ($itemKey) in " . __METHOD__ ); |
255 | | - } |
256 | | - elseif ( is_null( $itemKey ) ) { |
257 | | - wfWarn( "Attempted to get an item while the queue is empty in " . __METHOD__ ); |
258 | | - } |
259 | | - else { |
260 | | - $value = array_shift( $this->cachedChunks ); |
261 | | - } |
262 | | - } |
263 | | - else { |
264 | | - if ( array_key_exists( $key, $this->cachedChunks ) ) { |
265 | | - $value = $this->cachedChunks[$key]; |
266 | | - unset( $this->cachedChunks[$key] ); |
267 | | - } |
268 | | - else { |
269 | | - wfWarn( "There is no item with key '$key' in this->cachedChunks in " . __METHOD__ ); |
270 | | - } |
271 | | - } |
272 | | - } |
273 | | - else { |
274 | | - if ( !is_array( $args ) ) { |
275 | | - $args = array( $args ); |
276 | | - } |
277 | | - |
278 | | - $value = call_user_func_array( $computeFunction, $args ); |
279 | | - |
280 | | - if ( $this->cacheEnabled ) { |
281 | | - if ( is_null( $key ) ) { |
282 | | - $this->cachedChunks[] = $value; |
283 | | - } |
284 | | - else { |
285 | | - $this->cachedChunks[$key] = $value; |
286 | | - } |
287 | | - } |
288 | | - } |
289 | | - |
290 | | - return $value; |
291 | | - } |
292 | | - |
293 | | - /** |
294 | | - * Saves the HTML to the cache in case it got recomputed. |
295 | | - * Should be called after the last time anything is added via addCachedHTML. |
296 | | - * |
297 | | - * @since 1.20 |
298 | | - */ |
299 | | - public function saveCache() { |
300 | | - if ( $this->cacheEnabled && $this->hasCached === false && !empty( $this->cachedChunks ) ) { |
301 | | - wfGetCache( CACHE_ANYTHING )->set( $this->getCacheKeyString(), $this->cachedChunks, $this->cacheExpiry ); |
302 | | - } |
303 | | - } |
304 | | - |
305 | | - /** |
306 | | - * Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry.. |
307 | | - * |
308 | | - * @since 1.20 |
309 | | - * |
310 | | - * @param integer $cacheExpiry |
311 | | - */ |
312 | | - public function setExpirey( $cacheExpiry ) { |
313 | | - $this->cacheExpiry = $cacheExpiry; |
314 | | - } |
315 | | - |
316 | | - /** |
317 | | - * Returns the cache key to use to cache this page's HTML output. |
318 | | - * Is constructed from the special page name and language code. |
319 | | - * |
320 | | - * @since 1.20 |
321 | | - * |
322 | | - * @return string |
323 | | - */ |
324 | | - protected function getCacheKeyString() { |
325 | | - return call_user_func_array( 'wfMemcKey', $this->cacheKey ); |
326 | | - } |
327 | | - |
328 | | - public function setCacheKey( array $cacheKey ) { |
329 | | - $this->cacheKey = $cacheKey; |
330 | | - } |
331 | | - |
332 | | - public function purge() { |
333 | | - $this->hasCached = false; |
334 | | - } |
335 | | - |
336 | | - public function setOnInitializedHandler( $handlerFunction ) { |
337 | | - $this->onInitHandler = $handlerFunction; |
338 | | - } |
339 | | - |
340 | | -} |
Index: trunk/phase3/includes/actions/CachedAction.php |
— | — | @@ -1,170 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Abstract action class with scaffolding for caching HTML and other values |
6 | | - * in a single blob. |
7 | | - * |
8 | | - * Before using any of the cahing functionality, call startCache. |
9 | | - * After the last call to either getCachedValue or addCachedHTML, call saveCache. |
10 | | - * |
11 | | - * To get a cached value or compute it, use getCachedValue like this: |
12 | | - * $this->getCachedValue( $callback ); |
13 | | - * |
14 | | - * To add HTML that should be cached, use addCachedHTML like this: |
15 | | - * $this->addCachedHTML( $callback ); |
16 | | - * |
17 | | - * The callback function is only called when needed, so do all your expensive |
18 | | - * computations here. This function should returns the HTML to be cached. |
19 | | - * It should not add anything to the PageOutput object! |
20 | | - * |
21 | | - * @since 1.20 |
22 | | - * |
23 | | - * @file CachedAction.php |
24 | | - * @ingroup Action |
25 | | - * |
26 | | - * @licence GNU GPL v2 or later |
27 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
28 | | - */ |
29 | | -abstract class CachedAction extends FormlessAction implements ICacheHelper { |
30 | | - |
31 | | - /** |
32 | | - * CacheHelper object to which we foreward the non-SpecialPage specific caching work. |
33 | | - * Initialized in startCache. |
34 | | - * |
35 | | - * @since 1.20 |
36 | | - * @var CacheHelper |
37 | | - */ |
38 | | - protected $cacheHelper; |
39 | | - |
40 | | - /** |
41 | | - * If the cache is enabled or not. |
42 | | - * |
43 | | - * @since 1.20 |
44 | | - * @var boolean |
45 | | - */ |
46 | | - protected $cacheEnabled = true; |
47 | | - |
48 | | - /** |
49 | | - * Sets if the cache should be enabled or not. |
50 | | - * |
51 | | - * @since 1.20 |
52 | | - * @param boolean $cacheEnabled |
53 | | - */ |
54 | | - public function setCacheEnabled( $cacheEnabled ) { |
55 | | - $this->cacheHelper->setCacheEnabled( $cacheEnabled ); |
56 | | - } |
57 | | - |
58 | | - /** |
59 | | - * Initializes the caching. |
60 | | - * Should be called before the first time anything is added via addCachedHTML. |
61 | | - * |
62 | | - * @since 1.20 |
63 | | - * |
64 | | - * @param integer|null $cacheExpiry Sets the cache expirty, either ttl in seconds or unix timestamp. |
65 | | - * @param boolean|null $cacheEnabled Sets if the cache should be enabled or not. |
66 | | - */ |
67 | | - public function startCache( $cacheExpiry = null, $cacheEnabled = null ) { |
68 | | - $this->cacheHelper = new CacheHelper(); |
69 | | - |
70 | | - $this->cacheHelper->setCacheEnabled( $this->cacheEnabled ); |
71 | | - $this->cacheHelper->setOnInitializedHandler( array( $this, 'onCacheInitialized' ) ); |
72 | | - |
73 | | - $keyArgs = $this->getCacheKey(); |
74 | | - |
75 | | - if ( array_key_exists( 'action', $keyArgs ) && $keyArgs['action'] === 'purge' ) { |
76 | | - unset( $keyArgs['action'] ); |
77 | | - } |
78 | | - |
79 | | - $this->cacheHelper->setCacheKey( $keyArgs ); |
80 | | - |
81 | | - if ( $this->getRequest()->getText( 'action' ) === 'purge' ) { |
82 | | - $this->cacheHelper->purge(); |
83 | | - } |
84 | | - |
85 | | - $this->cacheHelper->startCache( $cacheExpiry, $cacheEnabled ); |
86 | | - } |
87 | | - |
88 | | - /** |
89 | | - * Get a cached value if available or compute it if not and then cache it if possible. |
90 | | - * The provided $computeFunction is only called when the computation needs to happen |
91 | | - * and should return a result value. $args are arguments that will be passed to the |
92 | | - * compute function when called. |
93 | | - * |
94 | | - * @since 1.20 |
95 | | - * |
96 | | - * @param {function} $computeFunction |
97 | | - * @param array|mixed $args |
98 | | - * @param string|null $key |
99 | | - * |
100 | | - * @return mixed |
101 | | - */ |
102 | | - public function getCachedValue( $computeFunction, $args = array(), $key = null ) { |
103 | | - return $this->cacheHelper->getCachedValue( $computeFunction, $args, $key ); |
104 | | - } |
105 | | - |
106 | | - /** |
107 | | - * Add some HTML to be cached. |
108 | | - * This is done by providing a callback function that should |
109 | | - * return the HTML to be added. It will only be called if the |
110 | | - * item is not in the cache yet or when the cache has been invalidated. |
111 | | - * |
112 | | - * @since 1.20 |
113 | | - * |
114 | | - * @param {function} $computeFunction |
115 | | - * @param array $args |
116 | | - * @param string|null $key |
117 | | - */ |
118 | | - public function addCachedHTML( $computeFunction, $args = array(), $key = null ) { |
119 | | - $this->getOutput()->addHTML( $this->cacheHelper->getCachedValue( $computeFunction, $args, $key ) ); |
120 | | - } |
121 | | - |
122 | | - /** |
123 | | - * Saves the HTML to the cache in case it got recomputed. |
124 | | - * Should be called after the last time anything is added via addCachedHTML. |
125 | | - * |
126 | | - * @since 1.20 |
127 | | - */ |
128 | | - public function saveCache() { |
129 | | - $this->cacheHelper->saveCache(); |
130 | | - } |
131 | | - |
132 | | - /** |
133 | | - * Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry.. |
134 | | - * |
135 | | - * @since 1.20 |
136 | | - * |
137 | | - * @param integer $cacheExpiry |
138 | | - */ |
139 | | - public function setExpirey( $cacheExpiry ) { |
140 | | - $this->cacheHelper->setExpirey( $cacheExpiry ); |
141 | | - } |
142 | | - |
143 | | - /** |
144 | | - * Returns the variables used to constructed the cache key in an array. |
145 | | - * |
146 | | - * @since 1.20 |
147 | | - * |
148 | | - * @return array |
149 | | - */ |
150 | | - protected function getCacheKey() { |
151 | | - return array( |
152 | | - get_class( $this->page ), |
153 | | - $this->getName(), |
154 | | - $this->getLanguage()->getCode() |
155 | | - ); |
156 | | - } |
157 | | - |
158 | | - /** |
159 | | - * Gets called after the cache got initialized. |
160 | | - * |
161 | | - * @since 1.20 |
162 | | - * |
163 | | - * @param boolean $hasCached |
164 | | - */ |
165 | | - public function onCacheInitialized( $hasCached ) { |
166 | | - if ( $hasCached ) { |
167 | | - $this->getOutput()->setSubtitle( $this->cacheHelper->getCachedNotice( $this->getContext() ) ); |
168 | | - } |
169 | | - } |
170 | | - |
171 | | -} |
\ No newline at end of file |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -27,7 +27,6 @@ |
28 | 28 | 'BadTitleError' => 'includes/Exception.php', |
29 | 29 | 'BaseTemplate' => 'includes/SkinTemplate.php', |
30 | 30 | 'Block' => 'includes/Block.php', |
31 | | - 'CacheHelper' => 'includes/CacheHelper.php', |
32 | 31 | 'Category' => 'includes/Category.php', |
33 | 32 | 'Categoryfinder' => 'includes/Categoryfinder.php', |
34 | 33 | 'CategoryPage' => 'includes/CategoryPage.php', |
— | — | @@ -121,7 +120,6 @@ |
122 | 121 | 'Http' => 'includes/HttpFunctions.php', |
123 | 122 | 'HttpError' => 'includes/Exception.php', |
124 | 123 | 'HttpRequest' => 'includes/HttpFunctions.old.php', |
125 | | - 'ICacheHelper' => 'includes/CacheHelper.php', |
126 | 124 | 'IcuCollation' => 'includes/Collation.php', |
127 | 125 | 'IdentityCollation' => 'includes/Collation.php', |
128 | 126 | 'ImageGallery' => 'includes/ImageGallery.php', |
— | — | @@ -260,7 +258,6 @@ |
261 | 259 | 'ZipDirectoryReader' => 'includes/ZipDirectoryReader.php', |
262 | 260 | |
263 | 261 | # includes/actions |
264 | | - 'CachedAction' => 'includes/actions/CachedAction.php', |
265 | 262 | 'CreditsAction' => 'includes/actions/CreditsAction.php', |
266 | 263 | 'DeleteAction' => 'includes/actions/DeleteAction.php', |
267 | 264 | 'EditAction' => 'includes/actions/EditAction.php', |
— | — | @@ -827,7 +824,6 @@ |
828 | 825 | 'SpecialBlockList' => 'includes/specials/SpecialBlockList.php', |
829 | 826 | 'SpecialBlockme' => 'includes/specials/SpecialBlockme.php', |
830 | 827 | 'SpecialBookSources' => 'includes/specials/SpecialBooksources.php', |
831 | | - 'SpecialCachedPage' => 'includes/specials/SpecialCachedPage.php', |
832 | 828 | 'SpecialCategories' => 'includes/specials/SpecialCategories.php', |
833 | 829 | 'SpecialChangeEmail' => 'includes/specials/SpecialChangeEmail.php', |
834 | 830 | 'SpecialChangePassword' => 'includes/specials/SpecialChangePassword.php', |
Index: trunk/phase3/includes/specials/SpecialCachedPage.php |
— | — | @@ -1,169 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Abstract special page class with scaffolding for caching HTML and other values |
6 | | - * in a single blob. |
7 | | - * |
8 | | - * Before using any of the cahing functionality, call startCache. |
9 | | - * After the last call to either getCachedValue or addCachedHTML, call saveCache. |
10 | | - * |
11 | | - * To get a cached value or compute it, use getCachedValue like this: |
12 | | - * $this->getCachedValue( $callback ); |
13 | | - * |
14 | | - * To add HTML that should be cached, use addCachedHTML like this: |
15 | | - * $this->addCachedHTML( $callback ); |
16 | | - * |
17 | | - * The callback function is only called when needed, so do all your expensive |
18 | | - * computations here. This function should returns the HTML to be cached. |
19 | | - * It should not add anything to the PageOutput object! |
20 | | - * |
21 | | - * @since 1.20 |
22 | | - * |
23 | | - * @file SpecialCachedPage.php |
24 | | - * @ingroup SpecialPage |
25 | | - * |
26 | | - * @licence GNU GPL v2 or later |
27 | | - * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
28 | | - */ |
29 | | -abstract class SpecialCachedPage extends SpecialPage implements ICacheHelper { |
30 | | - |
31 | | - /** |
32 | | - * CacheHelper object to which we foreward the non-SpecialPage specific caching work. |
33 | | - * Initialized in startCache. |
34 | | - * |
35 | | - * @since 1.20 |
36 | | - * @var CacheHelper |
37 | | - */ |
38 | | - protected $cacheHelper; |
39 | | - |
40 | | - /** |
41 | | - * If the cache is enabled or not. |
42 | | - * |
43 | | - * @since 1.20 |
44 | | - * @var boolean |
45 | | - */ |
46 | | - protected $cacheEnabled = true; |
47 | | - |
48 | | - /** |
49 | | - * Sets if the cache should be enabled or not. |
50 | | - * |
51 | | - * @since 1.20 |
52 | | - * @param boolean $cacheEnabled |
53 | | - */ |
54 | | - public function setCacheEnabled( $cacheEnabled ) { |
55 | | - $this->cacheHelper->setCacheEnabled( $cacheEnabled ); |
56 | | - } |
57 | | - |
58 | | - /** |
59 | | - * Initializes the caching. |
60 | | - * Should be called before the first time anything is added via addCachedHTML. |
61 | | - * |
62 | | - * @since 1.20 |
63 | | - * |
64 | | - * @param integer|null $cacheExpiry Sets the cache expirty, either ttl in seconds or unix timestamp. |
65 | | - * @param boolean|null $cacheEnabled Sets if the cache should be enabled or not. |
66 | | - */ |
67 | | - public function startCache( $cacheExpiry = null, $cacheEnabled = null ) { |
68 | | - $this->cacheHelper = new CacheHelper(); |
69 | | - |
70 | | - $this->cacheHelper->setCacheEnabled( $this->cacheEnabled ); |
71 | | - $this->cacheHelper->setOnInitializedHandler( array( $this, 'onCacheInitialized' ) ); |
72 | | - |
73 | | - $keyArgs = $this->getCacheKey(); |
74 | | - |
75 | | - if ( array_key_exists( 'action', $keyArgs ) && $keyArgs['action'] === 'purge' ) { |
76 | | - unset( $keyArgs['action'] ); |
77 | | - } |
78 | | - |
79 | | - $this->cacheHelper->setCacheKey( $keyArgs ); |
80 | | - |
81 | | - if ( $this->getRequest()->getText( 'action' ) === 'purge' ) { |
82 | | - $this->cacheHelper->purge(); |
83 | | - } |
84 | | - |
85 | | - $this->cacheHelper->startCache( $cacheExpiry, $cacheEnabled ); |
86 | | - } |
87 | | - |
88 | | - /** |
89 | | - * Get a cached value if available or compute it if not and then cache it if possible. |
90 | | - * The provided $computeFunction is only called when the computation needs to happen |
91 | | - * and should return a result value. $args are arguments that will be passed to the |
92 | | - * compute function when called. |
93 | | - * |
94 | | - * @since 1.20 |
95 | | - * |
96 | | - * @param {function} $computeFunction |
97 | | - * @param array|mixed $args |
98 | | - * @param string|null $key |
99 | | - * |
100 | | - * @return mixed |
101 | | - */ |
102 | | - public function getCachedValue( $computeFunction, $args = array(), $key = null ) { |
103 | | - return $this->cacheHelper->getCachedValue( $computeFunction, $args, $key ); |
104 | | - } |
105 | | - |
106 | | - /** |
107 | | - * Add some HTML to be cached. |
108 | | - * This is done by providing a callback function that should |
109 | | - * return the HTML to be added. It will only be called if the |
110 | | - * item is not in the cache yet or when the cache has been invalidated. |
111 | | - * |
112 | | - * @since 1.20 |
113 | | - * |
114 | | - * @param {function} $computeFunction |
115 | | - * @param array $args |
116 | | - * @param string|null $key |
117 | | - */ |
118 | | - public function addCachedHTML( $computeFunction, $args = array(), $key = null ) { |
119 | | - $this->getOutput()->addHTML( $this->cacheHelper->getCachedValue( $computeFunction, $args, $key ) ); |
120 | | - } |
121 | | - |
122 | | - /** |
123 | | - * Saves the HTML to the cache in case it got recomputed. |
124 | | - * Should be called after the last time anything is added via addCachedHTML. |
125 | | - * |
126 | | - * @since 1.20 |
127 | | - */ |
128 | | - public function saveCache() { |
129 | | - $this->cacheHelper->saveCache(); |
130 | | - } |
131 | | - |
132 | | - /** |
133 | | - * Sets the time to live for the cache, in seconds or a unix timestamp indicating the point of expiry.. |
134 | | - * |
135 | | - * @since 1.20 |
136 | | - * |
137 | | - * @param integer $cacheExpiry |
138 | | - */ |
139 | | - public function setExpirey( $cacheExpiry ) { |
140 | | - $this->cacheHelper->setExpirey( $cacheExpiry ); |
141 | | - } |
142 | | - |
143 | | - /** |
144 | | - * Returns the variables used to constructed the cache key in an array. |
145 | | - * |
146 | | - * @since 1.20 |
147 | | - * |
148 | | - * @return array |
149 | | - */ |
150 | | - protected function getCacheKey() { |
151 | | - return array( |
152 | | - $this->mName, |
153 | | - $this->getLanguage()->getCode() |
154 | | - ); |
155 | | - } |
156 | | - |
157 | | - /** |
158 | | - * Gets called after the cache got initialized. |
159 | | - * |
160 | | - * @since 1.20 |
161 | | - * |
162 | | - * @param boolean $hasCached |
163 | | - */ |
164 | | - public function onCacheInitialized( $hasCached ) { |
165 | | - if ( $hasCached ) { |
166 | | - $this->getOutput()->setSubtitle( $this->cacheHelper->getCachedNotice( $this->getContext() ) ); |
167 | | - } |
168 | | - } |
169 | | - |
170 | | -} |
Index: trunk/phase3/includes/objectcache/MemcachedClient.php |
— | — | @@ -344,20 +344,11 @@ |
345 | 345 | return false; |
346 | 346 | } |
347 | 347 | |
348 | | - /** |
349 | | - * @param $key |
350 | | - * @param $timeout int |
351 | | - * @return bool |
352 | | - */ |
353 | 348 | public function lock( $key, $timeout = 0 ) { |
354 | 349 | /* stub */ |
355 | 350 | return true; |
356 | 351 | } |
357 | 352 | |
358 | | - /** |
359 | | - * @param $key |
360 | | - * @return bool |
361 | | - */ |
362 | 353 | public function unlock( $key ) { |
363 | 354 | /* stub */ |
364 | 355 | return true; |
— | — | @@ -480,7 +471,7 @@ |
481 | 472 | $this->stats['get_multi'] = 1; |
482 | 473 | } |
483 | 474 | $sock_keys = array(); |
484 | | - $socks = array(); |
| 475 | + |
485 | 476 | foreach ( $keys as $key ) { |
486 | 477 | $sock = $this->get_sock( $key ); |
487 | 478 | if ( !is_resource( $sock ) ) { |
— | — | @@ -494,7 +485,6 @@ |
495 | 486 | $sock_keys[$sock][] = $key; |
496 | 487 | } |
497 | 488 | |
498 | | - $gather = array(); |
499 | 489 | // Send out the requests |
500 | 490 | foreach ( $socks as $sock ) { |
501 | 491 | $cmd = 'get'; |
— | — | @@ -589,7 +579,6 @@ |
590 | 580 | return array(); |
591 | 581 | } |
592 | 582 | |
593 | | - $ret = array(); |
594 | 583 | while ( true ) { |
595 | 584 | $res = fgets( $sock ); |
596 | 585 | $ret[] = $res; |
— | — | @@ -755,9 +744,6 @@ |
756 | 745 | $this->_dead_host( $host ); |
757 | 746 | } |
758 | 747 | |
759 | | - /** |
760 | | - * @param $host |
761 | | - */ |
762 | 748 | function _dead_host( $host ) { |
763 | 749 | $parts = explode( ':', $host ); |
764 | 750 | $ip = $parts[0]; |
— | — | @@ -788,8 +774,8 @@ |
789 | 775 | } |
790 | 776 | |
791 | 777 | $hv = is_array( $key ) ? intval( $key[0] ) : $this->_hashfunc( $key ); |
| 778 | + |
792 | 779 | if ( $this->_buckets === null ) { |
793 | | - $bu = array(); |
794 | 780 | foreach ( $this->_servers as $v ) { |
795 | 781 | if ( is_array( $v ) ) { |
796 | 782 | for( $i = 0; $i < $v[1]; $i++ ) { |
— | — | @@ -865,8 +851,7 @@ |
866 | 852 | $this->stats[$cmd] = 1; |
867 | 853 | } |
868 | 854 | if ( !$this->_safe_fwrite( $sock, "$cmd $key $amt\r\n" ) ) { |
869 | | - $this->_dead_sock( $sock ); |
870 | | - return null; |
| 855 | + return $this->_dead_sock( $sock ); |
871 | 856 | } |
872 | 857 | |
873 | 858 | $line = fgets( $sock ); |
— | — | @@ -1013,8 +998,7 @@ |
1014 | 999 | } |
1015 | 1000 | } |
1016 | 1001 | if ( !$this->_safe_fwrite( $sock, "$cmd $key $flags $exp $len\r\n$val\r\n" ) ) { |
1017 | | - $this->_dead_sock( $sock ); |
1018 | | - return false; |
| 1002 | + return $this->_dead_sock( $sock ); |
1019 | 1003 | } |
1020 | 1004 | |
1021 | 1005 | $line = trim( fgets( $sock ) ); |
— | — | @@ -1054,8 +1038,7 @@ |
1055 | 1039 | } |
1056 | 1040 | |
1057 | 1041 | if ( !$this->_connect_sock( $sock, $host ) ) { |
1058 | | - $this->_dead_host( $host ); |
1059 | | - return null; |
| 1042 | + return $this->_dead_host( $host ); |
1060 | 1043 | } |
1061 | 1044 | |
1062 | 1045 | // Do not buffer writes |
— | — | @@ -1066,9 +1049,6 @@ |
1067 | 1050 | return $this->_cache_sock[$host]; |
1068 | 1051 | } |
1069 | 1052 | |
1070 | | - /** |
1071 | | - * @param $str string |
1072 | | - */ |
1073 | 1053 | function _debugprint( $str ) { |
1074 | 1054 | print( $str ); |
1075 | 1055 | } |
— | — | @@ -1100,9 +1080,6 @@ |
1101 | 1081 | |
1102 | 1082 | /** |
1103 | 1083 | * Original behaviour |
1104 | | - * @param $f |
1105 | | - * @param $buf |
1106 | | - * @param $len bool |
1107 | 1084 | * @return int |
1108 | 1085 | */ |
1109 | 1086 | function _safe_fwrite( $f, $buf, $len = false ) { |
— | — | @@ -1116,7 +1093,6 @@ |
1117 | 1094 | |
1118 | 1095 | /** |
1119 | 1096 | * Flush the read buffer of a stream |
1120 | | - * @param $f Resource |
1121 | 1097 | */ |
1122 | 1098 | function _flush_read_buffer( $f ) { |
1123 | 1099 | if ( !is_resource( $f ) ) { |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -1910,52 +1910,6 @@ |
1911 | 1911 | } |
1912 | 1912 | |
1913 | 1913 | /** |
1914 | | - * Takes a number of seconds and turns it into a text using values such as hours and minutes. |
1915 | | - * |
1916 | | - * @since 1.20 |
1917 | | - * |
1918 | | - * @param integer $seconds The amount of seconds. |
1919 | | - * @param array $chosenIntervals The intervals to enable. |
1920 | | - * |
1921 | | - * @return string |
1922 | | - */ |
1923 | | - public function formatDuration( $seconds, array $chosenIntervals = array() ) { |
1924 | | - $intervals = array( |
1925 | | - 'millennia' => 1000 * 31557600, |
1926 | | - 'centuries' => 100 * 31557600, |
1927 | | - 'decades' => 10 * 31557600, |
1928 | | - 'years' => 31557600, // 86400 * 365.25 |
1929 | | - 'weeks' => 604800, |
1930 | | - 'days' => 86400, |
1931 | | - 'hours' => 3600, |
1932 | | - 'minutes' => 60, |
1933 | | - 'seconds' => 1, |
1934 | | - ); |
1935 | | - |
1936 | | - if ( empty( $chosenIntervals ) ) { |
1937 | | - $chosenIntervals = array( 'millennia', 'centuries', 'decades', 'years', 'days', 'hours', 'minutes', 'seconds' ); |
1938 | | - } |
1939 | | - |
1940 | | - $intervals = array_intersect_key( $intervals, array_flip( $chosenIntervals ) ); |
1941 | | - $sortedNames = array_keys( $intervals ); |
1942 | | - $smallestInterval = array_pop( $sortedNames ); |
1943 | | - |
1944 | | - $segments = array(); |
1945 | | - |
1946 | | - foreach ( $intervals as $name => $length ) { |
1947 | | - $value = floor( $seconds / $length ); |
1948 | | - |
1949 | | - if ( $value > 0 || ( $name == $smallestInterval && empty( $segments ) ) ) { |
1950 | | - $seconds -= $value * $length; |
1951 | | - $message = new Message( 'duration-' . $name, array( $value ) ); |
1952 | | - $segments[] = $message->inLanguage( $this )->escaped(); |
1953 | | - } |
1954 | | - } |
1955 | | - |
1956 | | - return $this->listToText( $segments ); |
1957 | | - } |
1958 | | - |
1959 | | - /** |
1960 | 1914 | * Internal helper function for userDate(), userTime() and userTimeAndDate() |
1961 | 1915 | * |
1962 | 1916 | * @param $type String: can be 'date', 'time' or 'both' |
— | — | @@ -3804,7 +3758,7 @@ |
3805 | 3759 | |
3806 | 3760 | /** |
3807 | 3761 | * Decode an expiry (block, protection, etc) which has come from the DB |
3808 | | - * |
| 3762 | + * |
3809 | 3763 | * @FIXME: why are we returnings DBMS-dependent strings??? |
3810 | 3764 | * |
3811 | 3765 | * @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 mixed|string |
| 49 | + * @return string |
50 | 50 | */ |
51 | 51 | function lcfirst ( $string ) { |
52 | 52 | if ( substr( $string, 0, 1 ) === 'I' ) { |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2661,11 +2661,6 @@ |
2662 | 2662 | It may contain one or more characters which cannot be used in titles.', |
2663 | 2663 | 'allpages-bad-ns' => '{{SITENAME}} does not have namespace "$1".', |
2664 | 2664 | |
2665 | | -# SpecialCachedPage |
2666 | | -'cachedspecial-viewing-cached-ttl' => 'You are viewing a cached version of this page, which can be up to $1 old.', |
2667 | | -'cachedspecial-viewing-cached-ts' => 'You are viewing a cached version of this page, which might not be completely actual.', |
2668 | | -'cachedspecial-refresh-now' => 'View latest.', |
2669 | | - |
2670 | 2665 | # Special:Categories |
2671 | 2666 | 'categories' => 'Categories', |
2672 | 2667 | 'categories-summary' => '', # do not translate or duplicate this message to other languages |
— | — | @@ -4825,15 +4820,4 @@ |
4826 | 4821 | 'api-error-uploaddisabled' => 'Uploading is disabled on this wiki.', |
4827 | 4822 | 'api-error-verification-error' => 'This file might be corrupt, or have the wrong extension.', |
4828 | 4823 | |
4829 | | -# Durations |
4830 | | -'duration-seconds' => '$1 {{PLURAL:$1|second|seconds}}', |
4831 | | -'duration-minutes' => '$1 {{PLURAL:$1|minute|minutes}}', |
4832 | | -'duration-hours' => '$1 {{PLURAL:$1|hour|hours}}', |
4833 | | -'duration-days' => '$1 {{PLURAL:$1|day|days}}', |
4834 | | -'duration-weeks' => '$1 {{PLURAL:$1|week|weeks}}', |
4835 | | -'duration-years' => '$1 {{PLURAL:$1|year|years}}', |
4836 | | -'duration-decades' => '$1 {{PLURAL:$1|decade|decades}}', |
4837 | | -'duration-centuries' => '$1 {{PLURAL:$1|century|centuries}}', |
4838 | | -'duration-millennia' => '$1 {{PLURAL:$1|millennium|millennia}}', |
4839 | | - |
4840 | 4824 | ); |