427 Commits

Author SHA1 Message Date
tjhunt
3fc3ebf26b MDL-11951 - supplemental - need capability checks in the outer if of the file too. Merged from MOODLE_19_STABLE. 2007-10-30 10:50:20 +00:00
toyomoyo
602654f358 merged fix for MDL-11532, updatesql needs to run after every 'round' otherwises nothing to pull from the context table 2007-10-26 07:58:23 +00:00
stronk7
b738808bb3 Commenting some more debug...
Merged from MOODLE_19_STABLE
2007-10-18 16:04:54 +00:00
stronk7
6100dad06e Commenting out some excess of debug info.
Merged from MOODLE_19_STABLE
2007-10-18 15:57:15 +00:00
toyomoyo
cb8cb8bf88 MDL-11241, adding logs for roles management 2007-10-18 05:53:14 +00:00
skodak
a2cf7f1b8a MDL-11658 shared rdef definition - reduced memory usage in cron 2007-10-17 09:19:39 +00:00
gustav_delius
84dfbdd2f6 Fixed error in the SQL in get_users_by_capability() that made many things not work properly on the course front page. 2007-10-16 08:42:23 +00:00
toyomoyo
13c7c8183e adding missing context 2007-10-12 07:41:30 +00:00
skodak
03cedd6283 MDL-11432 eliminated majority of RecordCount uses, added several missing rs_close() - this should help improve perf on some platforms - Eloy says ;-) 2007-10-10 12:19:27 +00:00
skodak
3f7d592598 add proper rs_close() into cleanup_contexts() - we have to close even when now records returned 2007-10-10 08:43:25 +00:00
skodak
8a4d32d8a3 MDL-11688 makes sure all course and user contexts exist during upgrade (all contexts when going from in 1.6) - this is needed for grade_letter upgrade; other minor tweaks - the USER->access is now loaded automatically, feedback parameters added 2007-10-10 08:33:06 +00:00
nicolasconnault
b7064779f5 Updated copyright notice in header 2007-10-10 05:25:14 +00:00
skodak
b51ece5b3b MDL-11660
* user_lastaccess deleted when deleting course
* rewritten deleting of contexts - does not use get_context_instance() anymore because it is much more strict now
* added deleting of grade_letters and settings when deleting course
2007-10-09 16:07:15 +00:00
skodak
128f098418 MDL-11640
* improved handling of dirty contexts in general - caching, switching in cron, marking, loading, etc.
* role_assing() and role_unassign() now marks dirty contexts because we use has_capability() in this function - we can not do it later outside to speedup bulk operations
* fixed some inline docs
* fixed notice from rs closing
* removed cached $CONTEXT from has_capability() - $context is now required parameter; this was hiding serious bugs when context did not exist or ppl passed false as parameter
* removed some ===, we can not use these on function parameters - we must support ints, strings, '', nulls, etc. - this could be a source of really dangerous bugs in future
* some other improvements and fixes - documented inline
2007-10-09 12:49:54 +00:00
skodak
5c8e6cb179 MDL-11621 removed recursion from create_contexts() 2007-10-05 20:47:08 +00:00
skodak
9a81a6060a MDL-11621 new create_contexts() function that makes sure all contexts exist, optionally initialises the paths and depths too 2007-10-05 20:16:51 +00:00
skodak
7d0c81b3ba MDL-11521 fixed problems when creating contexts and aprents does not exist yet
MDL-11527 fixed warning from $CFG->defaultuserroleid when installing and upgrading
+ removed reusing of previous contexts in has_capability() and get_context_instance()  because it was hiding critical errors when context was false, not specified, etc.
+ tweaked roles defaults - faster and defaults are applied when roles exist
+ SYSCONTEXTID may be specified in config.php to eliminate 1 db query
+ static context cache is now reset after rebuilding of context paths
+ path field in context table is now nullable - pg compatibility requirement
+ other minor fixes
2007-10-05 15:06:38 +00:00
skodak
3d811bc167 MDL-11143 fixed defaultfrongpageroleid typo and fixed notices during install and upgrade cause by undefined $CFG->defaultfrontpageroleid 2007-10-03 14:38:55 +00:00
moodler
2125f23e19 Make sure that the role names gets filtered in get_assignable_roles() 2007-10-03 03:33:57 +00:00
skodak
1f41940f20 MDL-11523 fixed - moving categories and courses around breaks paths and depths in context table + some notice fixes 2007-10-02 22:34:12 +00:00
martinlanghoff
5903fbf5e7 accesslib: dirty context handling now uses cache_flags
get_dirty_contexts() and mark_context_dirty() now use cache_flags
infrastructure. Remove deprecated cleanup_dirty_contexts() - this is
now handled by gc_cache_flags() in a more generic way.
2007-10-02 08:46:27 +00:00
toyomoyo
349a4aea81 fixing a typo 2007-09-27 03:02:01 +00:00
toyomoyo
4d7e30b3d8 modifying get_user_by_capability to handle requests on frontpage courses and sub contexts. MDL-11143 2007-09-27 01:46:41 +00:00
tjhunt
4827029b92 MDL-11454 - hard-coded mdl_ prefix. Also, wrong logic in is_siteadmin in accesslib.php. 2007-09-26 09:40:28 +00:00
toyomoyo
a6df7ee6fa get_default_frontpage_role_access() should prolly not load overrides below course level 2007-09-26 07:19:30 +00:00
toyomoyo
4e1fe7d109 MDL-11143, adding a new setting "defaultfrontpageroleid" where you choose a role for all users on the front page 2007-09-26 07:12:38 +00:00
skodak
a075996572 fixed notice during upgrade from 1.8 2007-09-24 19:00:39 +00:00
stronk7
5cf8d1d9fc temp table usage is out and now we are using the
new permanent context_temp table. Update for
Oracle added, extra NOT EXISTS cluse to avoid
insertion of duplicate records in potential
concurrency and minor refinements. MDL-11347
2007-09-21 08:52:43 +00:00
moodler
7e17f43b1c Just a small change to make this function a bit more robust, there's still a bug here though 2007-09-21 04:33:50 +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
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
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
skodak
2e0eade37f MDL-11347 temporary patch for mysql trouble in build_context_path() 2007-09-19 15:51:04 +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