r63813 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63812‎ | r63813 | r63814 >
Date:12:10, 16 March 2010
Author:demon
Status:reverted
Tags:
Comment:
Show an error if session.save_path is broken. Of course if session.auto_start is true and your save_path is bad you've already shot yourself in the foot and we can't avoid that.
Modified paths:
  • /branches/new-installer/phase3/includes/installer/WebInstaller.php (modified) (history)
  • /branches/new-installer/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /branches/new-installer/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: branches/new-installer/phase3/maintenance/language/messages.inc
@@ -3143,6 +3143,7 @@
31443144 'config-session-error',
31453145 'config-session-expired',
31463146 'config-no-session',
 3147+ 'config-session-path-bad',
31473148 'config-show-help',
31483149 'config-hide-help',
31493150 'config-your-language',
Index: branches/new-installer/phase3/includes/installer/WebInstaller.php
@@ -203,6 +203,11 @@
204204 * Start the PHP session. This may be called before execute() to start the PHP session.
205205 */
206206 function startSession() {
 207+ $sessPath = $this->getSessionSavePath();
 208+ if( !is_dir( $sessPath ) || !is_writeable( $sessPath ) ) {
 209+ $this->showError( 'config-session-path-bad', $sessPath );
 210+ return false;
 211+ }
207212 if( wfIniGetBool( 'session.auto_start' ) || session_id() ) {
208213 // Done already
209214 return true;
@@ -220,6 +225,21 @@
221226 }
222227
223228 /**
 229+ * Get the value of session.save_path
 230+ *
 231+ * Per http://www.php.net/manual/en/ref.session.php#ini.session.save-path,
 232+ * this might have some additional preceding parts which need to be
 233+ * ditched
 234+ *
 235+ * @return string
 236+ */
 237+ private function getSessionSavePath() {
 238+ $path = ini_get( 'session.save_path' );
 239+ $path = substr( $path, strrpos( $path, ';' ) );
 240+ return $path;
 241+ }
 242+
 243+ /**
224244 * Show an error message in a box. Parameters are like wfMsg().
225245 */
226246 function showError( $msg /*...*/ ) {
Index: branches/new-installer/phase3/languages/messages/MessagesEn.php
@@ -4127,6 +4127,7 @@
41284128 Please restart the installation process.',
41294129 'config-no-session' => 'Your session data was lost!
41304130 Please check your php.ini and make sure session.save_path is set to an appropriate directory.',
 4131+'config-session-path-bad' => 'Your session.save_path ($1) seems to be invalid or unwritable.',
41314132 'config-show-help' => 'Help',
41324133 'config-hide-help' => 'Hide help',
41334134 'config-your-language' => 'Your language:',

Follow-up revisions

RevisionCommit summaryAuthorDate
r75256Fix r63813, r64717 (session path detection in new installer). Surprise surpri...demon16:02, 23 October 2010
r78259Remove bogus session_path checks. Reverts r67465, r63813, r75256, r64717.demon17:25, 12 December 2010

Status & tagging log