The original commit was:
mod/chat - use empty value instead of erroring out if $USER->lastIP and getremoteaddr() don't yield any interesting value
Sometimes we can't get any useful IP for the user -- and this may even be a
valid situation. So fudge an empty value -- the DB needs it as the IP field
is NOT NULL.
Sometimes we can't get any useful IP for the user -- and this may even be a
valid situation. So fudge an empty value -- the DB needs it as the IP field
is NOT NULL.
This is an alternative version of jsupdate.php that acts
as a long-running daemon. It will feed/stall/feed JS updates
to the client. From the module configuration select "Stream"
updates.
The client connection is not forever though. Once we reach
CHAT_MAX_CLIENT_UPDATES (currently 1000), it will force
the client to re-fetch it.
This buys us all the benefits that chatd has, minus the setup,
as we are using apache to do the daemon handling.
Chat still defaults to the normal update method, which is now
optimised to take advantage of keepalives -- so this change is
safe. The instructions in the config page also indicate that this
mode may not be well supported everywhere. It hasn't been
tested on IIS for starters.
In terms of relative cost -- if each hit on jsupdate.php incurs
on ~20 db queries and delivers one update to the client, each hit
on jsupdate takes ~20 queries, and then roughly 2~3 queries to
serve each of the next 1000 updates. On busy sites, the difference
is huge.
There is still room for enhancements in both keepalive and stream
update methods. I am pretty sure we can trim DB queries more.
$USER->lastIP is sometimes not set properly during login, fetch it if we can
or error out clearly -- we won't be able to login the user to the chat if
we don't have an IP address to match him/her against.
User's pane now also uses keepalives -- if the refresh freq is below
the disconnect timeout, then it is a win. Otherwise it wastes memory
at the server end.
By using output buffering, we now support HTTP Keep-Alive, which means
that each client gets tightly bound to a single apache child - this means
that we get
+ lower resource usage on the webserver
+ _much_ lower resource usage on webserver and dbserver if pconnects are used
+ a good case for further caching (memcache/mmcache)
Using ab via localhost or fast LAN using keepalives is actually slower from the
client perspective -- still lighter on the server. Via slower links (DSL/modem)
the responses are faster.
+ we are now more conservative in the fields it asks from the db
+ also more conservative with upates to chat_users
+ messages are now added via POST requests instead of GET
Added default values to migrate2utf8.xml, for any varchar and text field types, if the default values for these fields were not defined as '' in the MySQL table creation script.
Committed by vyshane
Added new function, import_backup_file_silently
Changed everything that prints stuff to check for a constant first.
Backup_flush checks a different constant, this is so that output can still
get flushed to the browser when necessary but not print <li>s everywhere.
Please test this!
This patch allows the much requested selection of individual instances of modules within a course to backup and restore.
It needs A LOT of testing and probably some prettyifying too.
Three improvements:
1. $nomoodlecookie = true. I just found out about this undocumented(?) hack(?)
in lib/setup.php which is the perfect way to suppress some warnings. We
don't need a session cookie for the chatd.
2. If allow_call_time_pass_reference is Off, socket_getpeername can't work.
3. Suppress "call time pass by reference is deprecated" messages for
socket_getpeername, we don't have any choice here.
Complete refactoring of the system that was really awful (my fault!).
Now everything is in its place and working like a charm, making things really
easier to be implemented and amplied. Bug 3678
(http://moodle.org/bugs/bug.php?op=show&bugid=3678)
(http://moodle.org/mod/forum/discuss.php?d=26530)
Note: Everything is merged from stable but the quiz module because it has
other changes not merged for now. I've skyped a message to Gustav about it.
Merged from MOODLE_15_STABLE