Commit graph

5838 commits

Author SHA1 Message Date
toyomoyo
05a71b3341 change restore code to use the more efficient get_user_courses_bycap 2007-09-20 09:16:49 +00:00
skodak
eedae98ef2 MDL-11357 removed _grade_updated() from activities and grade_item class 2007-09-20 07:43:57 +00:00
skodak
ecbf2954da MDL-11347 adding comments with description of UPDATE related problems; minor whitespace and coding style changes 2007-09-20 07:37:50 +00:00
martinlanghoff
85cab9d8cd eaccelerator: never set the mode if we failed to init 2007-09-20 06:51:13 +00:00
moodler
0b9dcf3df4 Bumping the date and the context path upgrade in case anyone was stuck from yesterday MDL-11347 2007-09-20 06:47:14 +00:00
martinlanghoff
78c3ec2fe8 Revert - dmllib: check $MCACHE->status() before using it 2007-09-20 06:45:29 +00:00
martinlanghoff
369a572502 dmllib: check $MCACHE->status() before using it 2007-09-20 06:42:57 +00:00
moodler
bb2c22bda5 I renamed these to help general readability of accesslib:
$ad -> $accessdata
    has_cap_fad ->  has_capability_in_accessdata()
    aggr_roles_fad  -> aggregate_roles_from_accessdata()

Resolves MDL-11173
2007-09-20 04:52:54 +00:00
martinlanghoff
21f10eb03e accesslib: load_all_capabilities() - remember to check_enrolment_plugins()!
When setting up accessdata for a newly-logged-in user, call the
enrolment plugins. Thanks to Matt Clarkson for the heads up.

Affects: MDL-11180
2007-09-20 03:23:12 +00:00
toyomoyo
ba82dd3134 group should probably be passed into get_role_users() 2007-09-20 03:11:51 +00:00
martinlanghoff
55a814399f accesslib:build_context_path() refer to dbfamily instead of dbtype
so mysql's various drivers can be used.
2007-09-20 02:45:57 +00:00
toyomoyo
163a5eee2c MDL-11356, set display of grade items to database default (-1) 2007-09-20 02:39:25 +00:00
martinlanghoff
d20559f3e4 accesslib: build_context_path() - better UPDATE SQL
A bit of cleanup on the SQL we use for updates. Unfortunately, MySQL
uses non-SQL-standard syntax for updates reading or updating multiple
tables. After much testing across Pg and MySQL, I boiled it down to
the minimal differences -- but we still have different SQL.

The timings for this on a large reference install, calling
build_context_path(true):

 - MySQL incompatible 1s
 - Petr's fixes 60s -- DB complains of too many writes
 - This commit 24s  -- DB complains of too many writes

Also - fixed a remaining problem with $emptyclause

Affects MDL-11347
2007-09-20 01:03:35 +00:00
martinlanghoff
92b34bdd6c accesslib:build_Context_path() fix $emptyclause
We need 2 different empty clauses, one for updates, anotherone for
selects.
2007-09-20 00:16:22 +00:00
martinlanghoff
413a19dd4c accesslib:build_context_path() - fix $emptyclause to avoid Oracle's dirty hack
accesslib is now clean of Oracle's dirty hack. Thanks Eloy for the idea.

MDL-11347
2007-09-19 23:46:37 +00:00
stronk7
351e55fba6 Delete one excess parenthesis... Applying Bryce's patch to MDL-11347 2007-09-19 22:40:58 +00:00
skodak
203d964a4a MDL-11347 yet more beautification proposed by Eloy 2007-09-19 19:20:18 +00:00
skodak
b37453d73d MDL-11347 yet more beautification proposed by Eloy 2007-09-19 19:13:49 +00:00
skodak
40c670d416 MDL-11347 improving sql syntax - thanks Eloy for comments 2007-09-19 19:01:32 +00:00
skodak
554bda0538 MDL-11347 fixed context c in update which Tim's pg did not like much 2007-09-19 17:40:20 +00:00
tjhunt
1ced9d7b73 MDL-10903 - Wrong capability checked in get_all_instances_in_course should be moodle/course:viewhiddenactivities, not moodle/course:viewhiddencourses. Merged from MOODLE_18_STABLE. 2007-09-19 17:06:31 +00:00
skodak
2e0eade37f MDL-11347 temporary patch for mysql trouble in build_context_path() 2007-09-19 15:51:04 +00:00
nicolasconnault
41f22daa71 MDL-11353 Completed the implementation. This included a new method in grade_item: get_displaytype(), since that value could be set to default, and we must then look up to course, then site values. And the get_letter() method in grade_grade has been modified to first check the grade_letters table. All works like a dream! 2007-09-19 15:37:46 +00:00
nicolasconnault
dbdffd2c96 MDL-11340 Almost complete: Just need the "Add grade letter" button 2007-09-19 12:45:44 +00:00
tjhunt
fca490bca0 MDL-6315 - When processing a manul grading action, if both the comment and the score are blank - as might be the case on the 'Grade all' page of the manual grading when the teacher uses it to grade some, but not all of the students - then do not record the question as graded. Merged from MOODLE_18_STABLE. 2007-09-19 10:56:24 +00:00
moodler
95ffcee0bf Only show SQL feedback during full forced update (ie upgrade) 2007-09-19 09:55:31 +00:00
moodler
c122ad2a49 Just enabling SQL feedback so that errors like we're seeing in MySQL right now are exposed 2007-09-19 09:43:13 +00:00
martinlanghoff
dcd6a7755f accesslib: update PHPDoc with intro to code
Explain what we mean by _fad(), $ad and $ctx. Might help resolve MDL-11173
2007-09-19 07:57:10 +00:00
martinlanghoff
4c4fc4ffb1 accesslib: janitorial - use $ad for accessdata everywhere
Make sure we always say $ad when we talk about accessdata. This patch
fixes a few leftover bits and pieces...
2007-09-19 07:56:56 +00:00
martinlanghoff
f2a7ad77ec accesslib: cleanup_dirty_contexts() - also forget about CAST()s 2007-09-19 07:56:43 +00:00
martinlanghoff
70981363bf accesslib: get_dirty_contexts() - fix race condition, forget about CAST()s
In one tiny patch we do two things.

First, we fix the race condition around dirty context and accessdata
timestamps -- it is saner to offset the check than to offset the
recording of the change (as an earlier patch did).

    On a cluster, you still need NTP.

Second, we do away with CAST(). Ideally, the values should be compared
as ints but it's hard to get a CAST() syntax that is portable enough
to work on all our supported DBs. And Eloy pointed out (and I
corroborated testing) that we'll never have problems with the string
length, as our timestamps are always 10 chars as a string... and the
day they go to 11 chars we'll hit the unix Year-2038 bug.
2007-09-19 07:56:30 +00:00
martinlanghoff
99be2a7fad accesslib: build_context_path() now sets path/depth for other blocks
Blocks not on the coursepage should have their context "hanging" from the
site context. get_context_instance() was doing this correctly, but not
build_context_path().
2007-09-19 07:56:14 +00:00
martinlanghoff
348648a2a5 Revert "accesslib: mark_context_dirty() - fix race condition"
This reverts commit 2b65045c5e8259f5997b3bbf457ec9d05027a93c.
2007-09-19 07:55:59 +00:00
martinlanghoff
ac0b19ffe9 lib/setup: Cleanup warnings in apacheloguser handling 2007-09-19 07:55:46 +00:00
martinlanghoff
c6f01310ad weblib: print_user_picture() fix typoed classname when faking user object 2007-09-19 07:55:29 +00:00
martinlanghoff
45ea1afb16 accesslib: make_context_subobj() now expects ctxlevel, and fix all callers
make_context_subobj() was not providing a contextlevel property, and
no callers fetched the field. This comes from its humble origins where
it was only ever called for course objects. These days it's used in
many other situations, so this patch DTRT and

 - fixes make_context_subobj() expect a cxtlevel and turn it into
   contextlevel

 - fixes all callers (accesslib, datalib) to provide it
2007-09-19 07:54:37 +00:00
martinlanghoff
b1cff118c7 datalib:get_courses_wmanagers() handle empty $CFG->coursemanager more gracefully
Having no roles set as coursemanager is a valid setting.
get_courses_wmanagers() should not produce invalid SQL on it...
actually, it should not even try to get the course managers.
2007-09-19 07:54:23 +00:00
martinlanghoff
aba5f469f6 accesslib: get_user_access_sitewide() was skipping rdefs
The SQL query that would fetch rdefs not associated with any ra was
not being executed. Duh! For example, a user with a teacher RA sitewide
would never be affected by a role override at the category
level, because it was not being loaded into accessdata.
2007-09-19 07:54:06 +00:00
martinlanghoff
53fb75dc1f accesslib: get_user_access_bycontext() fetches all relevant rdefs
get_user_access_bycontext() was narrowing down too much the rdefs it
was fetching. With this patch, it now correctly retrieves the rdefs for
new roles assigned in lower contexts, and also correctly retrieves
rdefs present in the course context (fixing MDL-11220).

This also means that we now do the job in 2 DB queries (instead of 3),
and we move a bit more data, but those rows are actually needed ;-)
2007-09-19 07:53:49 +00:00
martinlanghoff
dd14fecfa4 accesslib upgrade: remove stray build_context_rel(), force path rebuild
Fixes problems during upgrades from 1.7x/1.8.x to mdl19-perf.
2007-09-19 07:53:00 +00:00
martinlanghoff
8f9a180282 weblib: build_navigation() try to avoid pointless capchecks
Prevent calls to has_capability() in build_navigation() from messing
with upgrades.

Most calls to has_capability() in weblib should be moved to the callers.
2007-09-19 07:52:42 +00:00
martinlanghoff
c7a8ec8cf0 accesslib: has_cap_fad() respect local-context-wins permissions rule
The initial implementation of has_cap_fad() just added the permission
values regardless of the locality of the context. This patch adds
support (read: fixes bug) for the "local context wins" rule.

Additionally, it removes a related bug where we were exiting early
if we found a CAP_PROHIBIT, ignoring the $doanything flag.
2007-09-19 07:52:06 +00:00
martinlanghoff
bbfed0ec61 datalib: get_my_courses() honour $fields array
If the caller passes a fields array, then merge it as we say we will do.
2007-09-19 07:51:36 +00:00
martinlanghoff
b9e9491a89 accesslib: get_my_courses() fix when called when empty sort
get_my_courses() was failing if called with an empty sortorder on a
cached courselist. Fix.
2007-09-19 07:51:19 +00:00
martinlanghoff
015e19287b Revert "textlib: Don't require_once() class.t3lib_div.php which we never use"
Turns out class.t3lib_cs.php depends on class.t3lib_div.php. Will drop
the two commits before we go into HEAD.

This reverts commit 5768bf6fb4dfa334dc81a80d26111904c4d13abd.
2007-09-19 07:49:49 +00:00
martinlanghoff
1dcf763428 accesslib: get_user_access_bycontext() remove 2 unused var declarations (trivial) 2007-09-19 07:49:35 +00:00
martinlanghoff
e89f157b0a datalib: get_courses_wmanagers() exclude the sitecourse
Should never return the sitecourse - so we exclude it explicitly.
2007-09-19 07:49:10 +00:00
martinlanghoff
987e7eb19a accesslib: is_siteadmin() bugfixes
Fixed two horrid bugs in is_siteadmin(). Both userid and the check for
matching cpabilities lines were wrong.
2007-09-19 07:48:43 +00:00
martinlanghoff
9f560a0ccb accesslib: fix SQL CAST()s to work on MySQL and PostgreSQL
CAST() target types aren't very portable. Use DECIMAL which works
for MySQL and Pg.

DECIMAL does seem to be supported in Oracle - but the syntax seems
different. We may still need a compat function.
2007-09-19 07:48:31 +00:00
martinlanghoff
9264620341 accesslib: remove has_capability_including_child_contexts()
No code is calling it, and it never appeared in any release.
2007-09-19 07:48:19 +00:00