v3.9.1+(20200827) - Unable to Add Activity/Resouce

v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Sam Black -
Number of replies: 13

I though I saw something about this a couple of weeks ago but haven't been able to really dig in to troubleshoot until now.  And, now I can't find what was around before on the issue.

No matter which course I have on my site (old or new), I click the [+ Add an Activity or Resource] button and I get this in the popup:

I turn on the Debugging info and everything to full details and I get nothing at all. 

I am able to force a workaround by importing an assignment from an older course and then editing it with the new information, but this is not the ideal solution.  Can someone help me out with the fix?  I've updated just tonight to the latest weekly update.  Still no luck.

Thanks in advance.

Average of ratings: -
In reply to Sam Black

Re: v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Sam,

It sounds as though your site may be affected by MDL-69079 which is fixed in 3.9.2 (due for release on 14 September 2020).

An alternative workaround would be to temporarily disable the activity chooser via your user menu then Preferences > Course preferences.

In reply to Helen Foster

Re: v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Sam Black -
That workaround just caused a more critical breakage when I turn on editing
Error message
In reply to Sam Black

Re: v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Ken Task -
Picture of Particularly helpful Moodlers
@Sam ... do you have mod_security running? Reason asked ... another user recently reported similar issue(s).

If so put it in 'Detection only mode' ... then TIA (try it again). If that works, check the audit log for mod_security for the web application firewall rule that tripped (a number) and the moodle URL. Make an exception for the rule in config of mod_security to allow if coming from the URL seen. URL should show as coming from Moodle itself ... not another IP.


BTW, Greetings from San Antonio!   Hows the Pan Handle?   Hot?! :|
'SoS', Ken
Average of ratings: Useful (1)
In reply to Ken Task

Re: v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Sam Black -
@Ken, actually I do. I tried turning it off and still no luck. Dreamhost a few years back decided the users didn't need sudo access anymore so I can't tweak the mod_security settings. ugh. I have gotten into my logs and they are empty. This is becoming really annoying. I'm hoping whatever the fix that's coming on the 14th actually does.

Hot and dry up here, except we've had the humidity levels of Houston the last few days and everyone is dying. LOL Between the heat and the covid spikes happening this week, virtual is coming sooner than later. Keep the Alamo safe and sound!

Thanks for the attempt at help.

Sam
In reply to Sam Black

Re: v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Sam Black -
Alright, I've just updated to 3.9.2 and tried to add an activity and I STILL get the same error message. I'm just about at a loss. This is killing me. I'm a month into my school year and I'm behind because I can't get some activities to work through duplicating and editing. I'm getting close to rage quitting.
In reply to Sam Black

Re: v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Ken Task -
Picture of Particularly helpful Moodlers

Been a change to the chooser in 3.9.x and it has some issues.

Have you turned on debugging to see what else your moodle might be saying now that you've upgraded to 3.9.2?

Could try this ... get the old behavior back ...

add the following to config.php file:

// act chooser 0=old 1=new
$CFG->modchooserdefault=0;

Purge the cache on server.  Purge your browser cache as well.

That should bring back the old drop down pick list for resources and the old drop down pick list for activities.

'SoS', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Sam Black -
Okay, here is what I get from the debugging info after changing the config.php file as suggested and purging all the caches:  (btw, no old-school drop down activity menu)

  • 1.541177 secs
  • RAM: 45.9MB
  • RAM peak: 46.9MB
  • Included 688 files
  • Contexts for which filters were loaded: 40
  • Filters created: 123
  • Pieces of content filtered: 40
  • Strings filtered: 0
  • get_string calls: 2002
  • DB reads/writes: 68/0
  • DB queries time: 0.32487 secs
  • ticks: 154 user: 111sys: 5 cuser: 0 csys: 0
  • Load average: 0.04
  • Session (core\session\database): 10.2KB
Mode Cache item Static H M Primary store H M S
App core/capabilities ** static accel. ** 4954 1 default_application 1 0 0
App core/completion ** static accel. ** 6 1 default_application 1 0 0
App core/contextwithinsights ** static accel. ** 0 1 default_application 1 0 0
Ses core/coursecat default_session 2 0 1
Req core/coursecatrecords default_request 3 1 1
App core/coursecompletion ** static accel. ** 0 12 default_application 12 0 0
App core/coursemodinfo default_application 2 0 0
App core/databasemeta ** static accel. ** 9 16 default_application 14 2 2
App core/eventinvalidation ** static accel. ** 0 2 default_application 0 2 0
App core/fontawesomeiconmapping ** static accel. ** 0 1 default_application 1 0 0
App core/groupdata ** static accel. ** 5 1 default_application 1 0 0
App core/langmenu ** static accel. ** 1 1 default_application 1 0 0
App core/message_processors_enabled ** static accel. ** 0 1 default_application 1 0 0
App core/observers ** static accel. ** 0 2 default_application 2 0 0
App core/plugin_functions ** static accel. ** 1 16 default_application 15 1 1
App core/plugin_manager default_application 2 0 0
Req core/repositories default_request 5 4 6
App core/roledefs ** static accel. ** 0 1 default_application 0 1 1
App core/string ** static accel. ** 2355 134 default_application 132 2 2
App core/user_group_groupings ** static accel. ** 29 1 default_application 1 0 0
App core/yuimodules default_application 3 0 0
App tool_usertours/tourdata ** static accel. ** 0 1 default_application 1 0 0
Store name Cache store H M S
** static accel. ** 7360 192 0
default_application cachestore_file 191 8 6
default_request cachestore_static 8 5 7
default_session cachestore_session 2 0 1
Total 7561 205 14

In reply to Sam Black

Re: v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Ken Task -
Picture of Particularly helpful Moodlers

Uhh ... fraid that's not debugging info we seek.

Go to your Site Administration Menu -> Development -> Debugging

Set 'Debugging Messages' drop down to 'Developer'.  Turn off (uncheck) 'Performance Info' (which is what you shared here as debugging info).

Then try to add an activity or resource.

The line you entered in config.php file ... mind sharing back what your config.php file looks like now ... (without DB login information).

Or, as Helen suggested ... can turn off the new via your accounts preferences by going to your:    Dashboard ->  Preferences -> User account
-> Course preferences and 'untick' box in row that is labeled ... 'Enable activity chooser' (ie, disable it).

Your issue supposedly fixed in 3.9.2 (Build: 20200914) which is the latest release, but you say you have upgraded and issue is still present.   Is that correct?

Also, you might need to check your web servers error logs + if running mod_security the audit.log for it might also need to be checked to see if a mod security rule is tripping (falsely) and preventing you from addding.

Web server access logs should show several hits for the images of the activities/resources .... like this:

ipaddress - - [14/Sep/2020:00:13:32 -0500] "GET /moodle39/theme/image.php/boost/scorm/1600059881/icon HTTP/1.1" 200 662
ipaddress - - [14/Sep/2020:00:13:32 -0500] "GET /moodle39/theme/image.php/boost/survey/1600059881/icon HTTP/1.1" 200 731
ipaddress - - [14/Sep/2020:00:13:32 -0500] "GET /moodle39/theme/image.php/boost/wiki/1600059881/icon HTTP/1.1" 200 834

If you notice the access shows site I am using uses 'boost' as the theme.

Which reminds me to ask ... is your site running boost?   If not, switch it to boost and let's see if issues go away.

Know this doesn't help you but, I have a 3.9.2 (Build: 20200914) and it's working just fine either way ... old or new.

'SoS', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Sam Black -
Ken, Thanks for being honest with me and not just laughing at me behind your screen while scrolling by (you can do that too, it's okay--I know I don't know what I don't know and I find it amusing as well considering I've been using Moodle (not programming or debugging it mind you) since like 1.4 or so -- you'd think I'd know what I didn't know by now smile )

Okay here's something new.  When I unticked that box on the user prefs page, this time I got more than just the invalid user and a broken rest of the page:
Moodle breakage

Here is my *hopefully* sanitized config file linked here.

Also, I've forced my entire site to use the Boost Theme and that didn't change anything.  I'm getting this on both Firefox and Chrome.   And, I have been digging through my server and I have empty log files.  And, I turned off the mod_security flag when we thought that might be triggering something before. This is rather frustrating.  I do completely appreciate your patience and help.

In reply to Sam Black

Re: v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Ken Task -
Picture of Particularly helpful Moodlers
Since 1.4!!! Me since 1.5 me thinks! But we aren't in Kansas any more with 3.9.x ... many having bizzare issues ... at least to me.

LIke your invalid user ... 0 => 1 !!!! Can you use phpmyadmin or mysql client and make this query?

mysql> select id,username,timecreated,timemodified from mdl_user where id <= 3;

ID 1 should be guest ... ID 2 the first account created when Moodle was installed ... 'admin' was default, if I re-call. And 1 and 2 won't have timecreated data.

Also ... can't see the santized config file for some reason.

But see this:
same issue .... and the fix provided by Leon!!!!

'SoS', Ken
Average of ratings: Useful (2)
In reply to Ken Task

Re: v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Sam Black -
I'll head over to the other post in a sec,but just for fun, I performed the query and here is what I've got:query results

I'm reattaching the config below.
In reply to Sam Black

Re: v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Sam Black -
And it was the value of deleted that was the root of all the evil. *sigh*

I'm ready for a stiff drink but it's a school night!

Thanks for your help, @Ken! And your patience!!
In reply to Sam Black

Re: v3.9.1+(20200827) - Unable to Add Activity/Resouce

by Ken Task -
Picture of Particularly helpful Moodlers

Always the little things!   Question is ... how/why did that happen!!!   Oh, well, chaulk it up to 'hickup'.

Now about the sanitized config file ... you upgrade via directions that tells you to copy the backup of config.php into new code.

Yes, they tell ya that ... but don't remind there are probably some new stuff you want to look at ... so let's begin the journey into the DB of a 3.9.x and beyond.   Some stuff you might not be able to do - depending upon hosting and access to DB config ...

Your config.php file:

$CFG->dboptions = array(
    'dbpersist' => true,       // should persistent database connections be
                                //  used? set to 'false' for the most stable
                                //  setting, 'true' can improve performance
                                //  sometimes
    'dbsocket'  => false,       // should connection via UNIX socket be used?
                                //  if you set it to 'true' or custom path
                                //  here set dbhost to 'localhost',
                                //  (please note mysql is always using socket
                                //  if dbhost is 'localhost' - if you need
                                //  local port connection use '127.0.0.1')
    'dbport'    => '',          // the TCP port number to use when connecting
                                //  to the server. keep empty string for the
                                //  default port

Do an Environment Check on your server and see what it says about DB.

Look in config-dist.php and the DB array.

Then look at:

https://docs.moodle.org/39/en/MySQL

and from a 3.9.2 git acquired code, clip from config-dist.php - DB array:

    'dbcollation' => 'utf8mb4_unicode_ci', // MySQL has partial and full UTF-8
                                // support. If you wish to use partial UTF-8
                                // (three bytes) then set this option to
                                // 'utf8_unicode_ci', otherwise this option
                                // can be removed for MySQL (by default it will
                                // use 'utf8mb4_unicode_ci'. This option should
                                // be removed for all other databases.

All this to warn if you have errors that kinda hint at text, could be related to above.

Remember, we aren't in Kansas anymore! smile

'Stiff drinks' ... yeah, I remember thinking the same thing ... but on nights where I could not resist, did notice I could tolerate a lot more the following day (only a JH/HS classroom teacher might understand that!).  Can only imagine what it's like with Zoom! :|

Hang in there!  Have a GREAT Year! smile

Anyway ... all is well that ends well!

'SoS', Ken