From 5505925383457d3f87755f74d26433dc94b5ccda Mon Sep 17 00:00:00 2001 From: fmarier Date: Mon, 18 May 2009 04:47:58 +0000 Subject: [PATCH] MDL-19222 sessionlib: add a check and error message when initialising file sessions in case there is no free space on the partition --- lang/en_utf8/error.php | 1 + lib/sessionlib.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lang/en_utf8/error.php b/lang/en_utf8/error.php index 0a8e2cadec..fb076179f2 100644 --- a/lang/en_utf8/error.php +++ b/lang/en_utf8/error.php @@ -406,6 +406,7 @@ $string['sectionnotexist'] = 'This section does not exist'; $string['secretalreadyused'] = 'Change password confirmation link was already used, password was not changed'; $string['sendmessage'] = 'Send message'; $string['sessioncookiesdisable'] = 'Incorrect use of require_key_login() - session cookies must be disabled!'; +$string['sessiondiskfull'] = 'The session partition is full. It is not possible to login at this time.

Please notify server administrator.'; $string['sessionerroruser'] = 'Your session has timed out. Please login again.'; $string['sessionerroruser2'] = 'A server error that affects your login session was detected. Please login again or restart your browser.'; $string['sessionipnomatch'] = 'Sorry, but your IP number seems to have changed from when you first logged in. This security feature prevents crackers stealing your identity while logged in to this site. Normal users should not be seeing this message - please ask the site administrator for help.'; diff --git a/lib/sessionlib.php b/lib/sessionlib.php index 9eadb84f1b..746c35ab53 100644 --- a/lib/sessionlib.php +++ b/lib/sessionlib.php @@ -307,6 +307,9 @@ class legacy_file_session extends session_stub { if (!is_writable($CFG->dataroot .'/sessions/')) { print_error('sessionnotwritable', 'error'); } + if (!(disk_free_space($CFG->dataroot.'/sessions') > 0)) { + print_error('sessiondiskfull', 'error'); + } ini_set('session.save_path', $CFG->dataroot .'/sessions'); } } -- 2.39.5