Comments (5)
Hi,
this issue has been stale for 1.5 years now.
While we still would like to see this issue fixed, it won't be done anymore as we are foreseeably transitioning our own usage of this block to the Dashboard blocks which have been dramatically improved from Moodle 3.6 on and thus can't spend any more substantial resources on this plugin.
Fixing this problem would require to change the logic of storing hidden courses not in (length-limited) user preferences but in a custom table, including the creation of custom webservices for getting and setting the values.
Since this issue was reported, only one of our own users has hit the limit and turned his Dashboard unusable.
We decided to go with this hack for the time being:
[root@moodle1 moodle_prod]# git diff lib/moodlelib.php
diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index 79c93fe..8ab9a9f 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -1893,7 +1893,13 @@ function set_user_preference($name, $value, $user = null) {
}
// Value column maximum length is 1333 characters.
$value = (string)$value;
+/* KIZ MODIFICATION START
+ REASON: Invalid value in set_user_preference() call, value is is too long for the value column */
+ if (core_text::strlen($value) > 3000) {
+/* KIZ MODIFICATION END */
+/* ORIGINAL START
if (core_text::strlen($value) > 1333) {
+ ORIGINAL END */
throw new coding_exception('Invalid value in set_user_preference() call, value is is too long for the value column');
}
This hack has to be accompanied by a SQL change of the user preferences table which, in Postgres, looks like this:
ALTER TABLE mdl_user_preferences ALTER COLUMN value TYPE varchar(3000);
As soon as we retire this block, we can change the table back with
ALTER TABLE mdl_user_preferences ALTER COLUMN value TYPE varchar(1333);
I am really sorry for the hassle which this bug has caused, but I rely on your understanding of our limited resources.
I will keep this issue open as a reference for anyone who also stumbles into the problem.
Cheers,
Alex
from moodle-block_course_overview_campus.
Hi Klaus,
first of all, I am sorry to hear that you encountered this problem. This shouldn't have happened.
Then, this problem only occurs if you are using our plugin local_boostcoc at the same time. Can you please confirm that you also use this plugin?
The underlying problem is that we decided to store the list of not-shown courses for local_boostcoc in a user preference. Unfortunately, user preferences are quite limited in length (see https://github.com/moodle/moodle/blob/master/lib/moodlelib.php#L1898) which we were not aware of until now.
If we calculate with 5-digit course IDs, this limit will be broken at approx. 160 enrolled courses. That's why we haven't hit this limit in our instance yet.
If you read through https://tracker.moodle.org/browse/MDL-46739, you will see that there were plans to change user preferences to a (longer) text field in DB, but there were objections / discussions about side-effects and the thing was neither finished nor closed as won't fix.
As a long-term solution, I will rebuild the storage of this data in a separate table. But this will take some time and won't be finished before the end of october, I'm afraid.
As an intermediate-solution, I can only recommend you to replace the existing line https://github.com/moodleuulm/moodle-block_course_overview_campus/blob/master/locallib.php#L436
which currently reads
// Store the current status of not shown courses.
set_user_preference('local_boostcoc-notshowncourses', $jsonstring);
with
if (core_text::strlen($jsonstring) < 1333) {
// Store the current status of not shown courses.
set_user_preference('local_boostcoc-notshowncourses', $jsonstring);
}
For the users who had the debug message which you quoted before, filtering the courses in Boosts nav drawer will be broken then until there is a real fix, but all other user will still have the same functionality.
I will keep you updated.
Thanks,
Alex
from moodle-block_course_overview_campus.
hi Alex,
thanks for the workaround! Only i took
if (core_text::strlen($jsonstring) < 1333) {
best
Ludwig
from moodle-block_course_overview_campus.
thanks for the workaround! Only i took
if (core_text::strlen($jsonstring) < 1333) {
Damn, you're right, of course. That was a copy & paste mistake. I fixed it in my comment above.
from moodle-block_course_overview_campus.
thanks Alex for your help. the workaround does work as you described.
We would appreciate a "real" fix as soon as you find time to do it.
Again, thanks for your great work!
from moodle-block_course_overview_campus.
Related Issues (20)
- Wrong id used for teacher filter HOT 4
- Eye icon not work HOT 1
- Notification : duplicate value - Debug Mode HOT 9
- Missing course category attribute HOT 1
- Suggestion: Students see list of all courses they are enrolled to, but can only access those available. HOT 2
- Bug: Refreshing VLE page shows category as empty HOT 13
- Suggestions HOT 4
- "Undefined variable: modchoices" error whenever I perform an upgrade HOT 2
- Problem with dropdown after logging back in HOT 3
- Plugin Name in language file HOT 7
- pix_url is depraceted in Moodle 3.4 HOT 1
- User can see hidden categories HOT 1
- Moodle 3.5 compability? HOT 1
- Suggestion: Separate link for category/top category at course list output HOT 2
- PHP Notice: Undefined variable / PHP Warning: array_key_exists() expects parameter HOT 3
- Plugin breaks behat tests
- "No courses" text HOT 1
- Please add a "Reset filters" button HOT 3
- Remove course news functionality as it does not work anymore from Moodle 3.7 on HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moodle-block_course_overview_campus.