* Installer for Oracle fixes
[mediawiki.git] / includes / installer / WebInstaller.php
blob208f5ea667e8bf06fcf307d668744408e3a95c3b
1 <?php
2 /**
3 * Core installer web interface.
5 * @file
6 * @ingroup Deployment
7 */
9 /**
10 * Class for the core installer web interface.
12 * @ingroup Deployment
13 * @since 1.17
15 class WebInstaller extends CoreInstaller {
17 /**
18 * @var WebInstallerOutput
20 public $output;
22 /**
23 * WebRequest object.
25 * @var WebRequest
27 public $request;
29 /**
30 * Cached session array.
32 * @var array
34 public $session;
36 /**
37 * Captured PHP error text. Temporary.
39 public $phpErrors;
41 /**
42 * The main sequence of page names. These will be displayed in turn.
43 * To add one:
44 * * Add it here
45 * * Add a config-page-<name> message
46 * * Add a WebInstaller_<name> class
48 public $pageSequence = array(
49 'Language',
50 'Welcome',
51 'DBConnect',
52 'Upgrade',
53 'DBSettings',
54 'Name',
55 'Options',
56 'Install',
57 'Complete',
60 /**
61 * Out of sequence pages, selectable by the user at any time.
63 public $otherPages = array(
64 'Restart',
65 'Readme',
66 'ReleaseNotes',
67 'Copying',
68 'UpgradeDoc', // Can't use Upgrade due to Upgrade step
71 /**
72 * Array of pages which have declared that they have been submitted, have validated
73 * their input, and need no further processing.
75 public $happyPages;
77 /**
78 * List of "skipped" pages. These are pages that will automatically continue
79 * to the next page on any GET request. To avoid breaking the "back" button,
80 * they need to be skipped during a back operation.
82 public $skippedPages;
84 /**
85 * Flag indicating that session data may have been lost.
87 public $showSessionWarning = false;
89 public $tabIndex = 1;
91 public $currentPageName;
93 /**
94 * Constructor.
96 * @param $request WebRequest
98 public function __construct( WebRequest $request ) {
99 parent::__construct();
100 $this->output = new WebInstallerOutput( $this );
101 $this->request = $request;
105 * Main entry point.
107 * @param $session Array: initial session array
109 * @return Array: new session array
111 public function execute( array $session ) {
112 $this->session = $session;
114 if ( isset( $session['settings'] ) ) {
115 $this->settings = $session['settings'] + $this->settings;
118 $this->exportVars();
119 $this->setupLanguage();
121 if( $this->getVar( '_InstallDone' ) && $this->request->getVal( 'localsettings' ) )
123 $ls = new LocalSettingsGenerator( $this );
124 $this->request->response()->header('Content-type: text/plain');
126 $this->request->response()->header(
127 'Content-Disposition: attachment; filename="LocalSettings.php"'
130 echo $ls->getText();
131 return $this->session;
134 if ( isset( $session['happyPages'] ) ) {
135 $this->happyPages = $session['happyPages'];
136 } else {
137 $this->happyPages = array();
140 if ( isset( $session['skippedPages'] ) ) {
141 $this->skippedPages = $session['skippedPages'];
142 } else {
143 $this->skippedPages = array();
146 $lowestUnhappy = $this->getLowestUnhappy();
148 # Special case for Creative Commons partner chooser box.
149 if ( $this->request->getVal( 'SubmitCC' ) ) {
150 $page = $this->getPageByName( 'Options' );
151 $this->output->useShortHeader();
152 $page->submitCC();
153 return $this->finish();
156 if ( $this->request->getVal( 'ShowCC' ) ) {
157 $page = $this->getPageByName( 'Options' );
158 $this->output->useShortHeader();
159 $this->output->addHTML( $page->getCCDoneBox() );
160 return $this->finish();
163 # Get the page name.
164 $pageName = $this->request->getVal( 'page' );
166 if ( in_array( $pageName, $this->otherPages ) ) {
167 # Out of sequence
168 $pageId = false;
169 $page = $this->getPageByName( $pageName );
170 } else {
171 # Main sequence
172 if ( !$pageName || !in_array( $pageName, $this->pageSequence ) ) {
173 $pageId = $lowestUnhappy;
174 } else {
175 $pageId = array_search( $pageName, $this->pageSequence );
178 # If necessary, move back to the lowest-numbered unhappy page
179 if ( $pageId > $lowestUnhappy ) {
180 $pageId = $lowestUnhappy;
181 if ( $lowestUnhappy == 0 ) {
182 # Knocked back to start, possible loss of session data.
183 $this->showSessionWarning = true;
187 $pageName = $this->pageSequence[$pageId];
188 $page = $this->getPageByName( $pageName );
191 # If a back button was submitted, go back without submitting the form data.
192 if ( $this->request->wasPosted() && $this->request->getBool( 'submit-back' ) ) {
193 if ( $this->request->getVal( 'lastPage' ) ) {
194 $nextPage = $this->request->getVal( 'lastPage' );
195 } elseif ( $pageId !== false ) {
196 # Main sequence page
197 # Skip the skipped pages
198 $nextPageId = $pageId;
200 do {
201 $nextPageId--;
202 $nextPage = $this->pageSequence[$nextPageId];
203 } while( isset( $this->skippedPages[$nextPage] ) );
204 } else {
205 $nextPage = $this->pageSequence[$lowestUnhappy];
208 $this->output->redirect( $this->getUrl( array( 'page' => $nextPage ) ) );
209 return $this->finish();
212 # Execute the page.
213 $this->currentPageName = $page->getName();
214 $this->startPageWrapper( $pageName );
215 $localSettings = $this->getLocalSettingsStatus();
217 if( !$localSettings->isGood() ) {
218 $this->showStatusBox( $localSettings );
219 $result = 'output';
220 } else {
221 $result = $page->execute();
224 $this->endPageWrapper();
226 if ( $result == 'skip' ) {
227 # Page skipped without explicit submission.
228 # Skip it when we click "back" so that we don't just go forward again.
229 $this->skippedPages[$pageName] = true;
230 $result = 'continue';
231 } else {
232 unset( $this->skippedPages[$pageName] );
235 # If it was posted, the page can request a continue to the next page.
236 if ( $result === 'continue' && !$this->output->headerDone() ) {
237 if ( $pageId !== false ) {
238 $this->happyPages[$pageId] = true;
241 $lowestUnhappy = $this->getLowestUnhappy();
243 if ( $this->request->getVal( 'lastPage' ) ) {
244 $nextPage = $this->request->getVal( 'lastPage' );
245 } elseif ( $pageId !== false ) {
246 $nextPage = $this->pageSequence[$pageId + 1];
247 } else {
248 $nextPage = $this->pageSequence[$lowestUnhappy];
251 if ( array_search( $nextPage, $this->pageSequence ) > $lowestUnhappy ) {
252 $nextPage = $this->pageSequence[$lowestUnhappy];
255 $this->output->redirect( $this->getUrl( array( 'page' => $nextPage ) ) );
258 return $this->finish();
261 public function getLowestUnhappy() {
262 if ( count( $this->happyPages ) == 0 ) {
263 return 0;
264 } else {
265 return max( array_keys( $this->happyPages ) ) + 1;
270 * Start the PHP session. This may be called before execute() to start the PHP session.
272 public function startSession() {
273 $sessPath = $this->getSessionSavePath();
275 if( $sessPath != '' ) {
276 if( strval( ini_get( 'open_basedir' ) ) != '' ) {
277 // we need to skip the following check when open_basedir is on.
278 // The session path probably *wont* be writable by the current
279 // user, and telling them to change it is bad. Bug 23021.
280 } elseif( !is_dir( $sessPath ) || !is_writeable( $sessPath ) ) {
281 $this->showError( 'config-session-path-bad', $sessPath );
282 return false;
284 } else {
285 // If the path is unset it'll default to some system bit, which *probably* is ok...
286 // not sure how to actually get what will be used.
289 if( wfIniGetBool( 'session.auto_start' ) || session_id() ) {
290 // Done already
291 return true;
294 $this->phpErrors = array();
295 set_error_handler( array( $this, 'errorHandler' ) );
296 session_start();
297 restore_error_handler();
299 if ( $this->phpErrors ) {
300 $this->showError( 'config-session-error', $this->phpErrors[0] );
301 return false;
304 return true;
308 * Get the value of session.save_path
310 * Per http://www.php.net/manual/en/session.configuration.php#ini.session.save-path,
311 * this may have an initial integer value to indicate the depth of session
312 * storage (eg /tmp/a/b/c). Explode on ; and check and see if this part is
313 * there or not. Should also allow paths with semicolons in them (if you
314 * really wanted your session files stored in /tmp/some;dir) which PHP
315 * supposedly supports.
317 * @return String
319 private function getSessionSavePath() {
320 $parts = explode( ';', ini_get( 'session.save_path' ), 2 );
321 return count( $parts ) == 1 ? $parts[0] : $parts[1];
325 * Show an error message in a box. Parameters are like wfMsg().
327 public function showError( $msg /*...*/ ) {
328 $args = func_get_args();
329 array_shift( $args );
330 $args = array_map( 'htmlspecialchars', $args );
331 $msg = wfMsgReal( $msg, $args, false, false, false );
332 $this->output->addHTML( $this->getErrorBox( $msg ) );
336 * Temporary error handler for session start debugging.
338 public function errorHandler( $errno, $errstr ) {
339 $this->phpErrors[] = $errstr;
343 * Clean up from execute()
345 * @return array
347 public function finish() {
348 $this->output->output();
350 $this->session['happyPages'] = $this->happyPages;
351 $this->session['skippedPages'] = $this->skippedPages;
352 $this->session['settings'] = $this->settings;
354 return $this->session;
358 * Get a URL for submission back to the same script.
360 * @param $query: Array
362 public function getUrl( $query = array() ) {
363 $url = $this->request->getRequestURL();
364 # Remove existing query
365 $url = preg_replace( '/\?.*$/', '', $url );
367 if ( $query ) {
368 $url .= '?' . wfArrayToCGI( $query );
371 return $url;
375 * Get a WebInstallerPage from the main sequence, by ID.
377 * @param $id Integer
379 * @return WebInstallerPage
381 public function getPageById( $id ) {
382 return $this->getPageByName( $this->pageSequence[$id] );
386 * Get a WebInstallerPage by name.
388 * @param $pageName String
390 * @return WebInstallerPage
392 public function getPageByName( $pageName ) {
393 // Totally lame way to force autoload of WebInstallerPage.php
394 class_exists( 'WebInstallerPage' );
396 $pageClass = 'WebInstaller_' . $pageName;
398 return new $pageClass( $this );
402 * Get a session variable.
404 * @param $name String
405 * @param $default
407 public function getSession( $name, $default = null ) {
408 if ( !isset( $this->session[$name] ) ) {
409 return $default;
410 } else {
411 return $this->session[$name];
416 * Set a session variable.
418 public function setSession( $name, $value ) {
419 $this->session[$name] = $value;
423 * Get the next tabindex attribute value.
425 public function nextTabIndex() {
426 return $this->tabIndex++;
430 * Initializes language-related variables.
432 public function setupLanguage() {
433 global $wgLang, $wgContLang, $wgLanguageCode;
435 if ( $this->getSession( 'test' ) === null && !$this->request->wasPosted() ) {
436 $wgLanguageCode = $this->getAcceptLanguage();
437 $wgLang = $wgContLang = Language::factory( $wgLanguageCode );
438 $this->setVar( 'wgLanguageCode', $wgLanguageCode );
439 $this->setVar( '_UserLang', $wgLanguageCode );
440 } else {
441 $wgLanguageCode = $this->getVar( 'wgLanguageCode' );
442 $wgLang = Language::factory( $this->getVar( '_UserLang' ) );
443 $wgContLang = Language::factory( $wgLanguageCode );
448 * Retrieves MediaWiki language from Accept-Language HTTP header.
450 * @return string
452 public function getAcceptLanguage() {
453 global $wgLanguageCode, $wgRequest;
455 $mwLanguages = Language::getLanguageNames();
456 $headerLanguages = array_keys( $wgRequest->getAcceptLang() );
458 foreach ( $headerLanguages as $lang ) {
459 if ( isset( $mwLanguages[$lang] ) ) {
460 return $lang;
464 return $wgLanguageCode;
468 * Called by execute() before page output starts, to show a page list.
470 * @param $currentPageName String
472 public function startPageWrapper( $currentPageName ) {
473 $s = "<div class=\"config-page-wrapper\">\n" .
474 "<div class=\"config-page-list\"><ul>\n";
475 $lastHappy = -1;
477 foreach ( $this->pageSequence as $id => $pageName ) {
478 $happy = !empty( $this->happyPages[$id] );
479 $s .= $this->getPageListItem(
480 $pageName,
481 $happy || $lastHappy == $id - 1,
482 $currentPageName
485 if ( $happy ) {
486 $lastHappy = $id;
490 $s .= "</ul><br/><ul>\n";
492 foreach ( $this->otherPages as $pageName ) {
493 $s .= $this->getPageListItem( $pageName, true, $currentPageName );
496 $s .= "</ul></div>\n". // end list pane
497 "<div class=\"config-page\">\n" .
498 Xml::element( 'h2', array(),
499 wfMsg( 'config-page-' . strtolower( $currentPageName ) ) );
501 $this->output->addHTMLNoFlush( $s );
505 * Get a list item for the page list.
507 * @param $pageName String
508 * @param $enabled Boolean
509 * @param $currentPageName String
511 * @return string
513 public function getPageListItem( $pageName, $enabled, $currentPageName ) {
514 $s = "<li class=\"config-page-list-item\">";
515 $name = wfMsg( 'config-page-' . strtolower( $pageName ) );
517 if ( $enabled ) {
518 $query = array( 'page' => $pageName );
520 if ( !in_array( $pageName, $this->pageSequence ) ) {
521 if ( in_array( $currentPageName, $this->pageSequence ) ) {
522 $query['lastPage'] = $currentPageName;
525 $link = Xml::element( 'a',
526 array(
527 'href' => $this->getUrl( $query )
529 $name
531 } else {
532 $link = htmlspecialchars( $name );
535 if ( $pageName == $currentPageName ) {
536 $s .= "<span class=\"config-page-current\">$link</span>";
537 } else {
538 $s .= $link;
540 } else {
541 $s .= Xml::element( 'span',
542 array(
543 'class' => 'config-page-disabled'
545 $name
549 $s .= "</li>\n";
551 return $s;
555 * Output some stuff after a page is finished.
557 public function endPageWrapper() {
558 $this->output->addHTMLNoFlush(
559 "</div>\n" .
560 "<br style=\"clear:both\"/>\n" .
561 "</div>" );
565 * Get HTML for an error box with an icon.
567 * @param $text String: wikitext, get this with wfMsgNoTrans()
569 public function getErrorBox( $text ) {
570 return $this->getInfoBox( $text, 'critical-32.png', 'config-error-box' );
574 * Get HTML for a warning box with an icon.
576 * @param $text String: wikitext, get this with wfMsgNoTrans()
578 public function getWarningBox( $text ) {
579 return $this->getInfoBox( $text, 'warning-32.png', 'config-warning-box' );
583 * Get HTML for an info box with an icon.
585 * @param $text String: wikitext, get this with wfMsgNoTrans()
586 * @param $icon String: icon name, file in skins/common/images
587 * @param $class String: additional class name to add to the wrapper div
589 public function getInfoBox( $text, $icon = 'info-32.png', $class = false ) {
590 $s =
591 "<div class=\"config-info $class\">\n" .
592 "<div class=\"config-info-left\">\n" .
593 Xml::element( 'img',
594 array(
595 'src' => '../skins/common/images/' . $icon,
596 'alt' => wfMsg( 'config-information' ),
598 ) . "\n" .
599 "</div>\n" .
600 "<div class=\"config-info-right\">\n" .
601 $this->parse( $text ) . "\n" .
602 "</div>\n" .
603 "<div style=\"clear: left;\"></div>\n" .
604 "</div>\n";
605 return $s;
609 * Get small text indented help for a preceding form field.
610 * Parameters like wfMsg().
612 public function getHelpBox( $msg /*, ... */ ) {
613 $args = func_get_args();
614 array_shift( $args );
615 $args = array_map( 'htmlspecialchars', $args );
616 $text = wfMsgReal( $msg, $args, false, false, false );
617 $html = $this->parse( $text, true );
619 return
620 "<div class=\"config-help-wrapper\">\n" .
621 "<div class=\"config-help-message\">\n" .
622 $html .
623 "</div>\n" .
624 "<div class=\"config-show-help\">\n" .
625 "<a href=\"#\">" .
626 wfMsgHtml( 'config-show-help' ) .
627 "</a></div>\n" .
628 "<div class=\"config-hide-help\">\n" .
629 "<a href=\"#\">" .
630 wfMsgHtml( 'config-hide-help' ) .
631 "</a></div>\n</div>\n";
635 * Output a help box.
637 public function showHelpBox( $msg /*, ... */ ) {
638 $args = func_get_args();
639 $html = call_user_func_array( array( $this, 'getHelpBox' ), $args );
640 $this->output->addHTML( $html );
644 * Show a short informational message.
645 * Output looks like a list.
647 * @param $msg string
649 public function showMessage( $msg /*, ... */ ) {
650 $args = func_get_args();
651 array_shift( $args );
652 $html = '<div class="config-message">' .
653 $this->parse( wfMsgReal( $msg, $args, false, false, false ) ) .
654 "</div>\n";
655 $this->output->addHTML( $html );
659 * @param $status Status
661 public function showStatusMessage( Status $status ) {
662 $text = $status->getWikiText();
663 $this->output->addWikiText(
664 "<div class=\"config-message\">\n" .
665 $text .
666 "</div>"
671 * Label a control by wrapping a config-input div around it and putting a
672 * label before it.
674 public function label( $msg, $forId, $contents ) {
675 if ( strval( $msg ) == '' ) {
676 $labelText = '&#160;';
677 } else {
678 $labelText = wfMsgHtml( $msg );
681 $attributes = array( 'class' => 'config-label' );
683 if ( $forId ) {
684 $attributes['for'] = $forId;
687 return
688 "<div class=\"config-input\">\n" .
689 Xml::tags( 'label',
690 $attributes,
691 $labelText ) . "\n" .
692 $contents .
693 "</div>\n";
697 * Get a labelled text box to configure a variable.
699 * @param $params Array
700 * Parameters are:
701 * var: The variable to be configured (required)
702 * label: The message name for the label (required)
703 * attribs: Additional attributes for the input element (optional)
704 * controlName: The name for the input element (optional)
705 * value: The current value of the variable (optional)
707 public function getTextBox( $params ) {
708 if ( !isset( $params['controlName'] ) ) {
709 $params['controlName'] = 'config_' . $params['var'];
712 if ( !isset( $params['value'] ) ) {
713 $params['value'] = $this->getVar( $params['var'] );
716 if ( !isset( $params['attribs'] ) ) {
717 $params['attribs'] = array();
720 return
721 $this->label(
722 $params['label'],
723 $params['controlName'],
724 Xml::input(
725 $params['controlName'],
726 30, // intended to be overridden by CSS
727 $params['value'],
728 $params['attribs'] + array(
729 'id' => $params['controlName'],
730 'class' => 'config-input-text',
731 'tabindex' => $this->nextTabIndex()
738 * Get a labelled password box to configure a variable.
740 * Implements password hiding
741 * @param $params Array
742 * Parameters are:
743 * var: The variable to be configured (required)
744 * label: The message name for the label (required)
745 * attribs: Additional attributes for the input element (optional)
746 * controlName: The name for the input element (optional)
747 * value: The current value of the variable (optional)
749 public function getPasswordBox( $params ) {
750 if ( !isset( $params['value'] ) ) {
751 $params['value'] = $this->getVar( $params['var'] );
754 if ( !isset( $params['attribs'] ) ) {
755 $params['attribs'] = array();
758 $params['value'] = $this->getFakePassword( $params['value'] );
759 $params['attribs']['type'] = 'password';
761 return $this->getTextBox( $params );
765 * Get a labelled checkbox to configure a boolean variable.
767 * @param $params Array
768 * Parameters are:
769 * var: The variable to be configured (required)
770 * label: The message name for the label (required)
771 * attribs: Additional attributes for the input element (optional)
772 * controlName: The name for the input element (optional)
773 * value: The current value of the variable (optional)
775 public function getCheckBox( $params ) {
776 if ( !isset( $params['controlName'] ) ) {
777 $params['controlName'] = 'config_' . $params['var'];
780 if ( !isset( $params['value'] ) ) {
781 $params['value'] = $this->getVar( $params['var'] );
784 if ( !isset( $params['attribs'] ) ) {
785 $params['attribs'] = array();
788 if( isset( $params['rawtext'] ) ) {
789 $labelText = $params['rawtext'];
790 } else {
791 $labelText = $this->parse( wfMsg( $params['label'] ) );
794 return
795 "<div class=\"config-input-check\">\n" .
796 "<label>\n" .
797 Xml::check(
798 $params['controlName'],
799 $params['value'],
800 $params['attribs'] + array(
801 'id' => $params['controlName'],
802 'class' => 'config-input-text',
803 'tabindex' => $this->nextTabIndex(),
806 $labelText . "\n" .
807 "</label>\n" .
808 "</div>\n";
812 * Get a set of labelled radio buttons.
814 * @param $params Array
815 * Parameters are:
816 * var: The variable to be configured (required)
817 * label: The message name for the label (required)
818 * itemLabelPrefix: The message name prefix for the item labels (required)
819 * values: List of allowed values (required)
820 * itemAttribs Array of attribute arrays, outer key is the value name (optional)
821 * commonAttribs Attribute array applied to all items
822 * controlName: The name for the input element (optional)
823 * value: The current value of the variable (optional)
825 public function getRadioSet( $params ) {
826 if ( !isset( $params['controlName'] ) ) {
827 $params['controlName'] = 'config_' . $params['var'];
830 if ( !isset( $params['value'] ) ) {
831 $params['value'] = $this->getVar( $params['var'] );
834 if ( !isset( $params['label'] ) ) {
835 $label = '';
836 } else {
837 $label = $this->parse( wfMsgNoTrans( $params['label'] ) );
840 $s = "<label class=\"config-label\">\n" .
841 $label .
842 "</label>\n" .
843 "<ul class=\"config-settings-block\">\n";
844 foreach ( $params['values'] as $value ) {
845 $itemAttribs = array();
847 if ( isset( $params['commonAttribs'] ) ) {
848 $itemAttribs = $params['commonAttribs'];
851 if ( isset( $params['itemAttribs'][$value] ) ) {
852 $itemAttribs = $params['itemAttribs'][$value] + $itemAttribs;
855 $checked = $value == $params['value'];
856 $id = $params['controlName'] . '_' . $value;
857 $itemAttribs['id'] = $id;
858 $itemAttribs['tabindex'] = $this->nextTabIndex();
860 $s .=
861 '<li>' .
862 Xml::radio( $params['controlName'], $value, $checked, $itemAttribs ) .
863 '&#160;' .
864 Xml::tags( 'label', array( 'for' => $id ), $this->parse(
865 wfMsgNoTrans( $params['itemLabelPrefix'] . strtolower( $value ) )
866 ) ) .
867 "</li>\n";
870 $s .= "</ul>\n";
871 return $s;
875 * Output an error or warning box using a Status object.
877 public function showStatusBox( $status ) {
878 if( !$status->isGood() ) {
879 $text = $status->getWikiText();
881 if( $status->isOk() ) {
882 $box = $this->getWarningBox( $text );
883 } else {
884 $box = $this->getErrorBox( $text );
887 $this->output->addHTML( $box );
892 * Convenience function to set variables based on form data.
893 * Assumes that variables containing "password" in the name are (potentially
894 * fake) passwords.
896 * @param $varNames Array
897 * @param $prefix String: the prefix added to variables to obtain form names
899 public function setVarsFromRequest( $varNames, $prefix = 'config_' ) {
900 $newValues = array();
902 foreach ( $varNames as $name ) {
903 $value = trim( $this->request->getVal( $prefix . $name ) );
904 $newValues[$name] = $value;
906 if ( $value === null ) {
907 // Checkbox?
908 $this->setVar( $name, false );
909 } else {
910 if ( stripos( $name, 'password' ) !== false ) {
911 $this->setPassword( $name, $value );
912 } else {
913 $this->setVar( $name, $value );
918 return $newValues;
922 * Get the starting tags of a fieldset.
924 * @param $legend String: message name
926 public function getFieldsetStart( $legend ) {
927 return "\n<fieldset><legend>" . wfMsgHtml( $legend ) . "</legend>\n";
931 * Get the end tag of a fieldset.
933 public function getFieldsetEnd() {
934 return "</fieldset>\n";
938 * Helper for Installer::docLink()
940 public function getDocUrl( $page ) {
941 $url = "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page );
943 if ( in_array( $this->currentPageName, $this->pageSequence ) ) {
944 $url .= '&lastPage=' . urlencode( $this->currentPageName );
947 return $url;