Commit Graph

44 Commits

Author SHA1 Message Date
f8e2383bdd MDL-59866 session: Add retry for redis sessions
There is an edge case whereby redis will fail
to accept connections on the first try but
retrying the connection seems to make it work

Included in this commit:
* Retry functionality in the session init
2017-12-12 14:42:04 +10:00
2a31e628f1 MDL-57477 session: Comment tidyup 2017-10-24 08:12:02 +08:00
bd035b98fd MDL-57477 core: If memcached 3.x mimic 2.2.0 lock acquisition behavior 2017-10-23 13:45:47 -04:00
7782e6610b MDL-58311 cache: Add password support for redis
add password support for redis connects in cache and session
2017-03-27 10:31:45 +01:00
a2f1c5c39a MDL-57752 session: fix check_security() session termination 2017-02-13 07:54:02 +00:00
88671590f2 MDL-57655 session: Adds igbinary serializer to Redis session handler 2017-01-25 00:47:25 +01:00
2d45ac279d Merge branch 'MDL-56823' of git://github.com/aolley/moodle 2016-11-15 09:07:36 +00:00
b86c685075 MDL-56417 session: Respect the return value of ignore_timeout_hook. 2016-11-10 14:24:24 +08:00
d456bd42c3 MDL-56823 session: redis sessions don't honour $CFG->sessiontimeout
The redis session handler doesn't use the sessiontimeout config setting
to determine session lifetime.

It has a lock expiry, which is set to 7200 (or a config setting) that is
used to determine how long a lock is held onto, but that should be
distinct from the session timeout.
2016-11-10 10:30:04 +10:30
44eb1490c4 MDL-54751 course: Set adhoc task user
We should complete the deletion process using the same
user that started it.

Added a new param to loginas() to prevent the event to be generated as
there is no need to generate an new event for that as the user didn't
explicitly loginas again.
2016-11-08 09:45:07 +08:00
1810eb1bf8 Revert "Merge branch 'MDL-56129-master' of git://github.com/andrewnicols/moodle"
This reverts commit aaa2788e42, reversing
changes made to 80b74762c9.
2016-10-27 09:59:38 +01:00
c823bfee62 MDL-56129 core: Set a timeout on the session cookie
This is primarily because iOS has changed something under the hood which
means that only session cookies which have an expiry are passed around the
OS.

In order to make media playable outside of the browser (e.g. a video), we
must set a session cookie timeout.

Since the session timeout is configurable, this patch sets the cookie
timeout to the session timeout plus a period of one week.

This ensures that videos continue to work, and that the expired session
message is shown on the login page, but without requiring excessively long
session times.
2016-10-24 11:47:06 +08:00
657ddbf592 MDL-55273 admin: Change $CFG->cookiesecure default to on 2016-08-22 09:20:32 +10:00
7f8a816a7d MDL-54606 session: Add redis handler with locking. 2016-08-04 21:50:11 +10:00
1f5a347b46 MDL-53947 memcached: Fix memcached session warning on PHP7 2016-06-07 10:25:07 +08:00
d07c339272 Revert "Merge branch 'MDL-53599' of git://github.com/nhoobin/moodle"
This reverts commit 15a813cda2, reversing
changes made to 6870e1fa77.
2016-05-06 10:18:10 +08:00
1ac585fefd MDL-53713 core: account for session_start returning false 2016-05-06 09:27:27 +08:00
c5211882f7 MDL-53599 session: Added a session_class_handler for Redis.
It is now possible to set up Redis as a session handler for Moodle.
Ensure that the phpredis extension is enabled and working on your sever.

Please place the following lines in config.php
$CFG->session_handler_class = '\core\session\redis';
$CFG->session_redis_save_path = 'tcp://127.0.0.1';

To determine if it has been set correctly, navigate to
$CFG->wwwroot/admin/phpinfo.php and find following the strings in the
session block,

session.save_handler = redis
session.save_path = tcp://127.0.0.1
2016-04-18 16:28:45 +10:00
2f244f1cc6 MDL-30811 core: Initiate notifications on first use only 2016-03-02 13:30:09 +08:00
0346323cec MDL-30811 output: Add support for session notifications 2016-02-29 09:05:56 +08:00
34c6ec1869 MDL-50891 useragent: Move web crawler checks to useragent class 2015-08-28 14:31:51 +08:00
dcee0b9447 MDL-49360 core_lib: add new method get_local_referer()
This commit also replace all usages of $_SERVER['HTTP_REFERER'] and get_referer().
2015-07-27 11:11:24 +08:00
774c00c740 MDL-47000 session: Update memcached version referecnes to 2.2.0 2015-02-24 15:18:15 -05:00
57996fe956 MDL-44642 session: Add a client-side session keepalive system
For pages where there will be significant user interaction in which the
server is not updated, it may be necessary to poll the server periodically
to touch the session.

This makes use of the existing checknet script which was designed for
checking network connectivity but fits into this use-case reasonably well.
2014-12-16 08:32:46 +08:00
89e9321f96 MDL-47834 auth: Allow enforcing of login limits 2014-11-21 10:00:01 +13:00
866f03de46 MDL-47800 auth: Add option to logout on pw change 2014-11-18 09:51:52 +13:00
1e31f11852 MDL-28484 core_lib: Add function for https detection
Signed-off-by: Tony Butler <tonyjbutler@gmail.com>
2014-10-03 13:02:29 +01:00
aba9019832 Merge branch 'wip_MDL-46711_m28_memcachesrvs' of https://github.com/skodak/moodle 2014-08-19 16:31:06 +08:00
652d886ae5 Merge branch 'wip_MDL-46552_m28_memcached' of https://github.com/skodak/moodle 2014-08-19 02:28:56 +02:00
e8b52671ae MDL-46711 session: add support for multiple servers to memcache session driver
Includes proper definition of object properties which fixes handling of timout default.
2014-08-07 15:39:27 +12:00
c6b5f18d06 MDL-46561 session: use full session validation in \core\session\manager::session_exists() 2014-08-07 08:59:24 +12:00
fcbf5cbb01 MDL-46552 session: add support for multiple servers in memcached session driver 2014-08-05 11:34:57 +12:00
2e00d01db4 MDL-46099 session: fix use of references for session globals
This reverses the references used for global $USER and $SESSION,
the reason is that PHP does not allow references to references.
$USER is a reference to $GLOBALS['USER'] which means we cannot
put any references to it. Solution is to store the current user and session
objects in $GLOBALS['USER'] and $GLOBALS['SESSIOn'] are reference
them in $_SESSION.

This patch makes the session code behave the same way in CLI,
phpunit and normal web requests - this allows use to finally
unit test most aspects of the session code in Moodle.
2014-07-01 08:38:00 +12:00
f2faa7cd17 MDL-45260 Memcache session support does not work for multiple servers 2014-04-24 12:49:15 +01:00
e645b4d580 MDL-43975 Sessions: Should support memcache, not just memcached
This commit adds a session handler which works using memcache (without
requiring the memcached extension), similar to the support for
memcache within MUC.

This may be less reliable than memcached but we have been using a
similar approach on our system without problems. In case, I added a
warning in config-dist.php.
2014-04-01 13:34:50 +01:00
a59a423926 Merge branch 'MDL-42084-master' of git://github.com/sammarshallou/moodle 2013-12-03 11:12:34 +13:00
cc9651dcae Merge branch 'm27_MDL-43039_SessionDiskFull_False_Positive' of https://github.com/scara/moodle 2013-12-02 14:37:22 +08:00
35897a5223 MDL-43039 Libraries "The session partition is full." false positive. 2013-11-30 14:36:58 +01:00
226991e9fe MDL-43106 fix double cookies on first access 2013-11-29 15:47:16 +08:00
3ef7279f26 MDL-42084 Core: Change set_time_limit to core_php_time_limit::raise everywhere
Exceptions (places where set_time_limit is still left) are:

Third-party libraries:
  ADODB
  PHPMailer

Moodle core:
  PHPUnit - not relevant (CLI mode)
2013-11-06 16:40:01 +00:00
6ec361c6bc MDL-42485 add session lock acquire timeout to memcached session driver
Credit goes to Eric Merrill, thanks!
2013-10-27 16:05:12 +01:00
38fc013025 MDL-42040 refactor core Moodle shutdown handlers logic 2013-10-04 11:36:46 +02:00
de230fd359 MDL-37324 fix phpunit and behat SESSION and USER setup 2013-09-24 08:59:29 +02:00
d79d5ac276 MDL-31501 rework user session architecture
List of changes:
 * New OOP API using PHP namespace \core\session\.
 * All handlers now update the sessions table consistently.
 * Experimental DB session support in Oracle.
 * Full support for session file handler (filesystem locking required).
 * New option for alternative session directory.
 * Official memcached session handler support.
 * Workaround for memcached version with non-functional gc.
 * Improved security - forced session id regeneration.
 * Improved compatibility with recent PHP releases.
 * Fixed borked CSS during install in debug mode.
 * Switched to file based sessions in new installs.
 * DB session setting disappears if DB does not support sessions.
 * DB session setting disappears if session handler specified in config.php.
 * Fast purging of sessions used in request only.
 * No legacy distinction -  file, database and memcached support the same functionality.
 * Session handler name included in performance info.
 * Fixed user_loggedin and user_loggedout event triggering.
 * Other minor bugfixing and improvements.
 * Fixed database session segfault if MUC disposed before $DB.

Limitations:
 * Session access time is now updated right after session start.
 * Support for $CFG->sessionlockloggedinonly was removed.
 * First request does not update userid in sessions table.
 * The timeouts may break badly if server hosting forces PHP.ini session settings.
 * The session GC is a lot slower, we do not rely on external session timeouts.
 * There cannot be any hooks triggered at the session write time.
 * File and memcached handlers do not support session lock acquire timeouts.
 * Some low level PHP session functions can not be used directly in Moodle code.
2013-09-21 13:11:56 +02:00