Index: trunk/phase3/includes/installer/WebInstallerPage.php |
— | — | @@ -78,7 +78,8 @@ |
79 | 79 | } |
80 | 80 | |
81 | 81 | class WebInstaller_Language extends WebInstallerPage { |
82 | | - function execute() { |
| 82 | + |
| 83 | + public function execute() { |
83 | 84 | global $wgLang; |
84 | 85 | $r = $this->parent->request; |
85 | 86 | $userLang = $r->getVal( 'UserLang' ); |
— | — | @@ -141,9 +142,9 @@ |
142 | 143 | } |
143 | 144 | |
144 | 145 | /** |
145 | | - * Get a <select> for selecting languages |
| 146 | + * Get a <select> for selecting languages. |
146 | 147 | */ |
147 | | - function getLanguageSelector( $name, $label, $selectedCode ) { |
| 148 | + public function getLanguageSelector( $name, $label, $selectedCode ) { |
148 | 149 | global $wgDummyLanguageCodes; |
149 | 150 | $s = Xml::openElement( 'select', array( 'id' => $name, 'name' => $name ) ) . "\n"; |
150 | 151 | |
— | — | @@ -157,10 +158,12 @@ |
158 | 159 | $s .= "\n</select>\n"; |
159 | 160 | return $this->parent->label( $label, $name, $s ); |
160 | 161 | } |
| 162 | + |
161 | 163 | } |
162 | 164 | |
163 | 165 | class WebInstaller_Welcome extends WebInstallerPage { |
164 | | - function execute() { |
| 166 | + |
| 167 | + public function execute() { |
165 | 168 | if ( $this->parent->request->wasPosted() ) { |
166 | 169 | if ( $this->getVar( '_Environment' ) ) { |
167 | 170 | return 'continue'; |
— | — | @@ -174,10 +177,12 @@ |
175 | 178 | $this->endForm(); |
176 | 179 | } |
177 | 180 | } |
| 181 | + |
178 | 182 | } |
179 | 183 | |
180 | 184 | class WebInstaller_DBConnect extends WebInstallerPage { |
181 | | - function execute() { |
| 185 | + |
| 186 | + public function execute() { |
182 | 187 | $r = $this->parent->request; |
183 | 188 | if ( $r->wasPosted() ) { |
184 | 189 | $status = $this->submit(); |
— | — | @@ -189,7 +194,6 @@ |
190 | 195 | } |
191 | 196 | } |
192 | 197 | |
193 | | - |
194 | 198 | $this->startForm(); |
195 | 199 | |
196 | 200 | $types = "<ul class=\"config-settings-block\">\n"; |
— | — | @@ -225,7 +229,7 @@ |
226 | 230 | $this->endForm(); |
227 | 231 | } |
228 | 232 | |
229 | | - function submit() { |
| 233 | + public function submit() { |
230 | 234 | $r = $this->parent->request; |
231 | 235 | $type = $r->getVal( 'DBType' ); |
232 | 236 | $this->setVar( 'wgDBtype', $type ); |
— | — | @@ -235,10 +239,12 @@ |
236 | 240 | } |
237 | 241 | return $installer->submitConnectForm(); |
238 | 242 | } |
| 243 | + |
239 | 244 | } |
240 | 245 | |
241 | 246 | class WebInstaller_Upgrade extends WebInstallerPage { |
242 | | - function execute() { |
| 247 | + |
| 248 | + public function execute() { |
243 | 249 | if ( $this->getVar( '_UpgradeDone' ) ) { |
244 | 250 | if ( $this->parent->request->wasPosted() ) { |
245 | 251 | // Done message acknowledged |
— | — | @@ -285,7 +291,7 @@ |
286 | 292 | $this->endForm(); |
287 | 293 | } |
288 | 294 | |
289 | | - function showDoneMessage() { |
| 295 | + public function showDoneMessage() { |
290 | 296 | $this->startForm(); |
291 | 297 | $this->addHTML( |
292 | 298 | $this->parent->getInfoBox( |
— | — | @@ -298,10 +304,12 @@ |
299 | 305 | ); |
300 | 306 | $this->endForm( 'regenerate' ); |
301 | 307 | } |
| 308 | + |
302 | 309 | } |
303 | 310 | |
304 | 311 | class WebInstaller_DBSettings extends WebInstallerPage { |
305 | | - function execute() { |
| 312 | + |
| 313 | + public function execute() { |
306 | 314 | $installer = $this->parent->getDBInstaller( $this->getVar( 'wgDBtype' ) ); |
307 | 315 | |
308 | 316 | $r = $this->parent->request; |
— | — | @@ -329,7 +337,8 @@ |
330 | 338 | } |
331 | 339 | |
332 | 340 | class WebInstaller_Name extends WebInstallerPage { |
333 | | - function execute() { |
| 341 | + |
| 342 | + public function execute() { |
334 | 343 | $r = $this->parent->request; |
335 | 344 | if ( $r->wasPosted() ) { |
336 | 345 | if ( $this->submit() ) { |
— | — | @@ -407,7 +416,7 @@ |
408 | 417 | return 'output'; |
409 | 418 | } |
410 | 419 | |
411 | | - function submit() { |
| 420 | + public function submit() { |
412 | 421 | $retVal = true; |
413 | 422 | $this->parent->setVarsFromRequest( array( 'wgSitename', '_NamespaceType', |
414 | 423 | '_AdminName', '_AdminPassword', '_AdminPassword2', '_AdminEmail', |
— | — | @@ -494,10 +503,12 @@ |
495 | 504 | } |
496 | 505 | return $retVal; |
497 | 506 | } |
| 507 | + |
498 | 508 | } |
499 | 509 | |
500 | 510 | class WebInstaller_Options extends WebInstallerPage { |
501 | | - function execute() { |
| 511 | + |
| 512 | + public function execute() { |
502 | 513 | if ( $this->getVar( '_SkipOptional' ) == 'skip' ) { |
503 | 514 | return 'skip'; |
504 | 515 | } |
— | — | @@ -643,7 +654,7 @@ |
644 | 655 | $this->endForm(); |
645 | 656 | } |
646 | 657 | |
647 | | - function getCCPartnerUrl() { |
| 658 | + public function getCCPartnerUrl() { |
648 | 659 | global $wgServer; |
649 | 660 | $exitUrl = $wgServer . $this->parent->getUrl( array( |
650 | 661 | 'page' => 'Options', |
— | — | @@ -665,7 +676,7 @@ |
666 | 677 | return $iframeUrl; |
667 | 678 | } |
668 | 679 | |
669 | | - function getCCChooser() { |
| 680 | + public function getCCChooser() { |
670 | 681 | $iframeAttribs = array( |
671 | 682 | 'class' => 'config-cc-iframe', |
672 | 683 | 'name' => 'config-cc-iframe', |
— | — | @@ -686,7 +697,7 @@ |
687 | 698 | "</div>\n"; |
688 | 699 | } |
689 | 700 | |
690 | | - function getCCDoneBox() { |
| 701 | + public function getCCDoneBox() { |
691 | 702 | $js = "parent.document.getElementById('config-cc-wrapper').style.height = '$1';"; |
692 | 703 | // If you change this height, also change it in config.css |
693 | 704 | $expandJs = str_replace( '$1', '54em', $js ); |
— | — | @@ -713,8 +724,7 @@ |
714 | 725 | "</script>\n"; |
715 | 726 | } |
716 | 727 | |
717 | | - |
718 | | - function submitCC() { |
| 728 | + public function submitCC() { |
719 | 729 | $newValues = $this->parent->setVarsFromRequest( |
720 | 730 | array( 'wgRightsUrl', 'wgRightsText', 'wgRightsIcon' ) ); |
721 | 731 | if ( count( $newValues ) != 3 ) { |
— | — | @@ -725,7 +735,7 @@ |
726 | 736 | $this->addHTML( $this->getCCDoneBox() ); |
727 | 737 | } |
728 | 738 | |
729 | | - function submit() { |
| 739 | + public function submit() { |
730 | 740 | $this->parent->setVarsFromRequest( array( '_RightsProfile', '_LicenseCode', |
731 | 741 | 'wgEnableEmail', 'wgPasswordSender', 'wgEnableUpload', 'wgLogo', |
732 | 742 | 'wgEnableUserEmail', 'wgEnotifUserTalk', 'wgEnotifWatchlist', |
— | — | @@ -769,11 +779,12 @@ |
770 | 780 | $this->parent->setVar( '_Extensions', $exts ); |
771 | 781 | return true; |
772 | 782 | } |
| 783 | + |
773 | 784 | } |
774 | 785 | |
775 | 786 | class WebInstaller_Install extends WebInstallerPage { |
776 | 787 | |
777 | | - function execute() { |
| 788 | + public function execute() { |
778 | 789 | if( $this->parent->request->wasPosted() ) { |
779 | 790 | return 'continue'; |
780 | 791 | } elseif( $this->getVar( '_InstallDone' ) ) { |
— | — | @@ -810,9 +821,11 @@ |
811 | 822 | $this->parent->showStatusBox( $status ); |
812 | 823 | } |
813 | 824 | } |
| 825 | + |
814 | 826 | } |
815 | 827 | |
816 | 828 | class WebInstaller_Complete extends WebInstallerPage { |
| 829 | + |
817 | 830 | public function execute() { |
818 | 831 | global $IP; |
819 | 832 | $this->startForm(); |
— | — | @@ -831,7 +844,8 @@ |
832 | 845 | } |
833 | 846 | |
834 | 847 | class WebInstaller_Restart extends WebInstallerPage { |
835 | | - function execute() { |
| 848 | + |
| 849 | + public function execute() { |
836 | 850 | $r = $this->parent->request; |
837 | 851 | if ( $r->wasPosted() ) { |
838 | 852 | $really = $r->getVal( 'submit-restart' ); |
— | — | @@ -848,19 +862,21 @@ |
849 | 863 | $this->addHTML( $s ); |
850 | 864 | $this->endForm( 'restart' ); |
851 | 865 | } |
| 866 | + |
852 | 867 | } |
853 | 868 | |
854 | 869 | abstract class WebInstaller_Document extends WebInstallerPage { |
855 | | - abstract function getFileName(); |
| 870 | + |
| 871 | + protected abstract function getFileName(); |
856 | 872 | |
857 | | - function execute() { |
| 873 | + public function execute() { |
858 | 874 | $text = $this->getFileContents(); |
859 | 875 | $this->parent->output->addWikiText( $text ); |
860 | 876 | $this->startForm(); |
861 | 877 | $this->endForm( false ); |
862 | 878 | } |
863 | 879 | |
864 | | - function getFileContents() { |
| 880 | + public function getFileContents() { |
865 | 881 | return file_get_contents( dirname( __FILE__ ) . '/../../' . $this->getFileName() ); |
866 | 882 | } |
867 | 883 | |
— | — | @@ -895,36 +911,44 @@ |
896 | 912 | return '<span class="config-plainlink">[http://www.mediawiki.org/wiki/Manual:' . |
897 | 913 | $matches[1] . ' ' . $matches[1] . ']</span>'; |
898 | 914 | } |
| 915 | + |
899 | 916 | } |
900 | 917 | |
901 | 918 | class WebInstaller_Readme extends WebInstaller_Document { |
902 | | - function getFileName() { return 'README'; } |
| 919 | + |
| 920 | + protected function getFileName() { return 'README'; } |
903 | 921 | |
904 | | - function getFileContents() { |
| 922 | + public function getFileContents() { |
905 | 923 | return $this->formatTextFile( parent::getFileContents() ); |
906 | 924 | } |
| 925 | + |
907 | 926 | } |
908 | 927 | |
909 | 928 | class WebInstaller_ReleaseNotes extends WebInstaller_Document { |
910 | | - function getFileName() { return 'RELEASE-NOTES'; } |
| 929 | + |
| 930 | + protected function getFileName() { return 'RELEASE-NOTES'; } |
911 | 931 | |
912 | | - function getFileContents() { |
| 932 | + public function getFileContents() { |
913 | 933 | return $this->formatTextFile( parent::getFileContents() ); |
914 | 934 | } |
| 935 | + |
915 | 936 | } |
916 | 937 | |
917 | 938 | class WebInstaller_UpgradeDoc extends WebInstaller_Document { |
918 | | - function getFileName() { return 'UPGRADE'; } |
| 939 | + |
| 940 | + protected function getFileName() { return 'UPGRADE'; } |
919 | 941 | |
920 | | - function getFileContents() { |
| 942 | + public function getFileContents() { |
921 | 943 | return $this->formatTextFile( parent::getFileContents() ); |
922 | 944 | } |
| 945 | + |
923 | 946 | } |
924 | 947 | |
925 | 948 | class WebInstaller_Copying extends WebInstaller_Document { |
926 | | - function getFileName() { return 'COPYING'; } |
| 949 | + |
| 950 | + protected function getFileName() { return 'COPYING'; } |
927 | 951 | |
928 | | - function getFileContents() { |
| 952 | + public function getFileContents() { |
929 | 953 | $text = parent::getFileContents(); |
930 | 954 | $text = str_replace( "\x0C", '', $text ); |
931 | 955 | $text = preg_replace_callback( '/\n[ \t]+/m', array( 'WebInstaller_Copying', 'replaceLeadingSpaces' ), $text ); |
— | — | @@ -935,4 +959,5 @@ |
936 | 960 | private static function replaceLeadingSpaces( $matches ) { |
937 | 961 | return "\n" . str_repeat( ' ', strlen( $matches[0] ) ); |
938 | 962 | } |
| 963 | + |
939 | 964 | } |
\ No newline at end of file |