Index: trunk/phase3/includes/installer/WebInstaller.php |
— | — | @@ -2,10 +2,18 @@ |
3 | 3 | |
4 | 4 | class WebInstaller extends Installer { |
5 | 5 | |
6 | | - /** WebRequest object */ |
| 6 | + /** |
| 7 | + * WebRequest object. |
| 8 | + * |
| 9 | + * @var WebRequest |
| 10 | + */ |
7 | 11 | public $request; |
8 | 12 | |
9 | | - /** Cached session array */ |
| 13 | + /** |
| 14 | + * Cached session array. |
| 15 | + * |
| 16 | + * @var array |
| 17 | + */ |
10 | 18 | public $session; |
11 | 19 | |
12 | 20 | /** Captured PHP error text. Temporary. |
— | — | @@ -65,8 +73,12 @@ |
66 | 74 | |
67 | 75 | public $currentPageName; |
68 | 76 | |
69 | | - /** Constructor */ |
70 | | - public function __construct( $request ) { |
| 77 | + /** |
| 78 | + * Constructor. |
| 79 | + * |
| 80 | + * @param WebRequest $request |
| 81 | + */ |
| 82 | + public function __construct( WebRequest $request ) { |
71 | 83 | parent::__construct(); |
72 | 84 | $this->output = new WebInstallerOutput( $this ); |
73 | 85 | $this->request = $request; |
— | — | @@ -79,7 +91,7 @@ |
80 | 92 | * |
81 | 93 | * @return Array: new session array |
82 | 94 | */ |
83 | | - public function execute( $session ) { |
| 95 | + public function execute( array $session ) { |
84 | 96 | $this->session = $session; |
85 | 97 | |
86 | 98 | if ( isset( $session['settings'] ) ) { |
— | — | @@ -311,17 +323,23 @@ |
312 | 324 | |
313 | 325 | /** |
314 | 326 | * Clean up from execute() |
| 327 | + * |
| 328 | + * @return array |
315 | 329 | */ |
316 | 330 | public function finish() { |
317 | 331 | $this->output->output(); |
| 332 | + |
318 | 333 | $this->session['happyPages'] = $this->happyPages; |
319 | 334 | $this->session['skippedPages'] = $this->skippedPages; |
320 | 335 | $this->session['settings'] = $this->settings; |
| 336 | + |
321 | 337 | return $this->session; |
322 | 338 | } |
323 | 339 | |
324 | 340 | /** |
325 | 341 | * Get a URL for submission back to the same script. |
| 342 | + * |
| 343 | + * @param $query: Array |
326 | 344 | */ |
327 | 345 | public function getUrl( $query = array() ) { |
328 | 346 | $url = $this->request->getRequestURL(); |
— | — | @@ -337,6 +355,10 @@ |
338 | 356 | |
339 | 357 | /** |
340 | 358 | * Get a WebInstallerPage from the main sequence, by ID. |
| 359 | + * |
| 360 | + * @param $id Integer |
| 361 | + * |
| 362 | + * @return WebInstallerPage |
341 | 363 | */ |
342 | 364 | public function getPageById( $id ) { |
343 | 365 | return $this->getPageByName( $this->pageSequence[$id] ); |
— | — | @@ -344,6 +366,10 @@ |
345 | 367 | |
346 | 368 | /** |
347 | 369 | * Get a WebInstallerPage by name. |
| 370 | + * |
| 371 | + * @param $pageName String |
| 372 | + * |
| 373 | + * @return WebInstallerPage |
348 | 374 | */ |
349 | 375 | public function getPageByName( $pageName ) { |
350 | 376 | // Totally lame way to force autoload of WebInstallerPage.php |
— | — | @@ -356,6 +382,9 @@ |
357 | 383 | |
358 | 384 | /** |
359 | 385 | * Get a session variable. |
| 386 | + * |
| 387 | + * @param $name String |
| 388 | + * @param $default |
360 | 389 | */ |
361 | 390 | public function getSession( $name, $default = null ) { |
362 | 391 | if ( !isset( $this->session[$name] ) ) { |
— | — | @@ -384,6 +413,7 @@ |
385 | 414 | */ |
386 | 415 | public function setupLanguage() { |
387 | 416 | global $wgLang, $wgContLang, $wgLanguageCode; |
| 417 | + |
388 | 418 | if ( $this->getSession( 'test' ) === null && !$this->request->wasPosted() ) { |
389 | 419 | $wgLanguageCode = $this->getAcceptLanguage(); |
390 | 420 | $wgLang = $wgContLang = Language::factory( $wgLanguageCode ); |
— | — | @@ -398,6 +428,8 @@ |
399 | 429 | |
400 | 430 | /** |
401 | 431 | * Retrieves MediaWiki language from Accept-Language HTTP header. |
| 432 | + * |
| 433 | + * @return string |
402 | 434 | */ |
403 | 435 | public function getAcceptLanguage() { |
404 | 436 | global $wgLanguageCode; |
— | — | @@ -430,6 +462,8 @@ |
431 | 463 | |
432 | 464 | /** |
433 | 465 | * Called by execute() before page output starts, to show a page list. |
| 466 | + * |
| 467 | + * @param $currentPageName String |
434 | 468 | */ |
435 | 469 | public function startPageWrapper( $currentPageName ) { |
436 | 470 | $s = "<div class=\"config-page-wrapper\">\n" . |
— | — | @@ -462,6 +496,12 @@ |
463 | 497 | |
464 | 498 | /** |
465 | 499 | * Get a list item for the page list. |
| 500 | + * |
| 501 | + * @param $pageName String |
| 502 | + * @param $enabled Boolean |
| 503 | + * @param $currentPageName String |
| 504 | + * |
| 505 | + * @return string |
466 | 506 | */ |
467 | 507 | public function getPageListItem( $pageName, $enabled, $currentPageName ) { |
468 | 508 | $s = "<li class=\"config-page-list-item\">"; |
— | — | @@ -500,6 +540,7 @@ |
501 | 541 | } |
502 | 542 | |
503 | 543 | $s .= "</li>\n"; |
| 544 | + |
504 | 545 | return $s; |
505 | 546 | } |
506 | 547 | |
— | — | @@ -565,6 +606,7 @@ |
566 | 607 | $args = func_get_args(); |
567 | 608 | array_shift( $args ); |
568 | 609 | $args = array_map( 'htmlspecialchars', $args ); |
| 610 | + |
569 | 611 | $text = wfMsgReal( $msg, $args, false, false, false ); |
570 | 612 | $html = $this->parse( $text, true ); |
571 | 613 | $id = $this->helpId++; |