DDL sql execution error Error after trying to install plugins

DDL sql execution error Error after trying to install plugins

Frank Madison
Vastuste arv 7
environ:

moodle 3.11.7
wins server 2016
maria db 10.4.20
php 7.4.29

Was able to get moodle up and running. So now was trying to install a plugin (qtype_mulitchoiceset) from the moodle directory. When it went to install it came up with this error:




I did try to delete the mdl_recent_block_activity from the moodle database inside mariadb, but no luck after that. 

I was able to restore webpage access by removing the new plug folder. But will need to still figure out error so i can get it installed
Keskmine hinnang: -
Vastuses Frank Madison

Re: DDL sql execution error Error after trying to install plugins

Ken Task
Particularly helpful Moodlers pilt

Recent Activity Block is part of core.  Anything core you don't want to use should be hidden ... not erased ... especially not removing entries in DB related because the code is still there.

You recently installed and had issues with installing ... related to DB ... your solution to that was to use utf8 character set - is that correct?  

Debug shows table for recent activity block is using utf8mb4_unicode_ci collation.   Character sets and collations should match.

There is a command line only php script in admin/cli/ that can sort that out for ya.   Matter of fact, there are 3 or 4 that relate to DB.   Suggest you run them.

When installing plugins, the web based interface does an environment check to see if the plugin you are attempting to install meets requirements/versions.   Mind sharing the link to that plugin found in Moodle.org plugins?

'SoS', Ken

Vastuses Ken Task

Re: DDL sql execution error Error after trying to install plugins

Frank Madison
I got it up and running. Afterwards, I got the utf8 message, and i did run the script that for ($ php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci); to make the changes to the db. That worked as well.

This is the plugin i initially tried, but got error on any plugin i tried to install

https://moodle.org/plugins/qtype_multichoiceset
Vastuses Frank Madison

Re: DDL sql execution error Error after trying to install plugins

Ken Task
Particularly helpful Moodlers pilt

That plugin ...

https://moodle.org/plugins/qtype_multichoiceset/versions

You need the

1.9.1 (Build: 2021071200) (2021071200)

Moodle 3.9, 3.10, 3.11, 4.0
version.  Not the one seen on initial entry page of that plugin.

Still getting errors?

'SoS', Ken

Vastuses Ken Task

Re: DDL sql execution error Error after trying to install plugins

Frank Madison
Yes, I redownloaded current version, but still get same error when I try to install:





I turned of debugging, and this was the output:

[12-May-2022 12:35:23 America/Los_Angeles] Default exception handler: Coding error detected, it must be fixed by a programmer: A lock was created but not released at:
[dirroot]\lib\classes\task\manager.php on line 719

 Code should look like:

 $factory = \core\lock\lock_config::get_lock_factory('type');
 $lock = $factory->get_lock(b18f97c33329b8434e3d14151141eed768d77a86);
 $lock->release();  // Locks must ALWAYS be released like this.

 Debug: 
Error code: codingerror
* line 122 of \lib\classes\lock\lock.php: coding_exception thrown
* line 73 of \lib\cronlib.php: call to core\lock\lock->__destruct()
* line 178 of \admin\cli\cron.php: call to cron_run()

[12-May-2022 12:35:52 America/Los_Angeles] PHP Notice:  Did you remember to make the first column something unique in your call to get_records? Duplicate value 'filterall' found in column 'name'.<ul style="text-align: left" data-rel="backtrace"><li>line 1282 of \lib\dml\mysqli_native_moodle_database.php: call to debugging()</li><li>line 1500 of \lib\dml\moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()</li><li>line 1451 of \lib\dml\moodle_database.php: call to moodle_database->get_records_select()</li><li>line 1540 of \lib\dml\moodle_database.php: call to moodle_database->get_records()</li><li>line 1519 of \lib\moodlelib.php: call to moodle_database->get_records_menu()</li><li>line 808 of \lib\environmentlib.php: call to get_config()</li><li>line 466 of \lib\environmentlib.php: call to environment_check_moodle()</li><li>line 106 of \lib\environmentlib.php: call to environment_check()</li><li>line 553 of \admin\index.php: call to check_moodle_environment()</li></ul> in C:\inetpub\wwwroot\moodle\lib\weblib.php on line 3257
[12-May-2022 12:37:35 America/Los_Angeles] PHP Notice:  Did you remember to make the first column something unique in your call to get_records? Duplicate value 'filterall' found in column 'name'.<ul style="text-align: left" data-rel="backtrace"><li>line 1282 of \lib\dml\mysqli_native_moodle_database.php: call to debugging()</li><li>line 1500 of \lib\dml\moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()</li><li>line 1451 of \lib\dml\moodle_database.php: call to moodle_database->get_records_select()</li><li>line 1540 of \lib\dml\moodle_database.php: call to moodle_database->get_records()</li><li>line 1519 of \lib\moodlelib.php: call to moodle_database->get_records_menu()</li><li>line 629 of \lib\classes\string_manager_standard.php: call to get_config()</li><li>line 1674 of \lib\moodlelib.php: call to core_string_manager_standard->reset_caches()</li><li>line 1643 of \lib\moodlelib.php: call to purge_caches()</li><li>line 1925 of \lib\upgradelib.php: call to purge_all_caches()</li><li>line 713 of \admin\index.php: call to upgrade_noncore()< in C:\inetpub\wwwroot\moodle\lib\weblib.php on line 3257
[12-May-2022 12:37:38 America/Los_Angeles] Default exception handler: DDL sql execution error Debug: Table 'mdl_block_recent_activity' already exists
CREATE TABLE mdl_block_recent_activity (
    id BIGINT(10) NOT NULL auto_increment,
    courseid BIGINT(10) NOT NULL,
    cmid BIGINT(10) NOT NULL,
    timecreated BIGINT(10) NOT NULL,
    userid BIGINT(10) NOT NULL,
    action TINYINT(1) NOT NULL,
    modname VARCHAR(20) COLLATE utf8mb4_unicode_ci,
CONSTRAINT  PRIMARY KEY (id)
, KEY mdl_blocreceacti_coutim2_ix (courseid, timecreated)
)
 ENGINE = InnoDB
 DEFAULT COLLATE = utf8mb4_unicode_ci ROW_FORMAT=Compressed
 COMMENT='Recent activity block'
Error code: ddlexecuteerror
* line 492 of \lib\dml\moodle_database.php: ddl_change_structure_exception thrown
* line 1098 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end()
* line 77 of \lib\ddl\database_manager.php: call to mysqli_native_moodle_database->change_database_structure()
* line 427 of \lib\ddl\database_manager.php: call to database_manager->execute_sql_arr()
* line 372 of \lib\ddl\database_manager.php: call to database_manager->install_from_xmldb_structure()
* line 1041 of \lib\upgradelib.php: call to database_manager->install_from_xmldb_file()
* line 578 of \lib\upgradelib.php: call to upgrade_plugins_blocks()
* line 1929 of \lib\upgradelib.php: call to upgrade_plugins()
* line 713 of \admin\index.php: call to upgrade_noncore()

[12-May-2022 12:37:43 America/Los_Angeles] PHP Warning:  rename(C:\inetpub\moodledata/cache/cachestore_file/default_application/core_plugin_functions/aft-cache/toOb2iXkgP.627d6207b116a2.40106914.temp,C:\inetpub\moodledata/cache/cachestore_file/default_application/core_plugin_functions/aft-cache/after_config_libphp-94dd61d81c144696e6ed38a44b9e084f.cache): Access is denied. (code: 5) in C:\inetpub\wwwroot\moodle\cache\stores\file\lib.php on line 733
[12-May-2022 12:37:43 America/Los_Angeles] PHP Warning:  rename(C:\inetpub\moodledata/cache/cachestore_file/default_application/core_plugin_functions/aft-cache/ABHGycnZxN.627d6207b16480.65023043.temp,C:\inetpub\moodledata/cache/cachestore_file/default_application/core_plugin_functions/aft-cache/after_config_libphp-94dd61d81c144696e6ed38a44b9e084f.cache): Access is denied. (code: 5) in C:\inetpub\wwwroot\moodle\cache\stores\file\lib.php on line 733
[12-May-2022 12:37:43 America/Los_Angeles] PHP Warning:  rename(C:\inetpub\moodledata/cache/cachestore_file/default_application/core_plugin_functions/aft-cache/mxY7FEDlfn.627d6207b143e8.73742796.temp,C:\inetpub\moodledata/cache/cachestore_file/default_application/core_plugin_functions/aft-cache/after_config_libphp-94dd61d81c144696e6ed38a44b9e084f.cache): Access is denied. (code: 5) in C:\inetpub\wwwroot\moodle\cache\stores\file\lib.php on line 733
[12-May-2022 12:37:49 America/Los_Angeles] PHP Warning:  rename(C:\inetpub\moodledata/cache/cachestore_file/default_application/core_yuimodules/874-cache/ZBmAQQEBIm.627d620d4b4e33.80412597.temp,C:\inetpub\moodledata/cache/cachestore_file/default_application/core_yuimodules/874-cache/874674eec87240d64e32d8c46778a8824fc01888.cache): Access is denied. (code: 5) in C:\inetpub\wwwroot\moodle\cache\stores\file\lib.php on line 733
[12-May-2022 12:37:49 America/Los_Angeles] PHP Warning:  rename(C:\inetpub\moodledata/cache/cachestore_file/default_application/core_string/en_-cache/ZBmAQQEBIm.627d620d78e7b6.36636309.temp,C:\inetpub\moodledata/cache/cachestore_file/default_application/core_string/en_-cache/en_core_repository_1652384255-277226e45591af7469fb4178ae34f5fc.cache): Access is denied. (code: 5) in C:\inetpub\wwwroot\moodle\cache\stores\file\lib.php on line 733


Vastuses Frank Madison

Re: DDL sql execution error Error after trying to install plugins

Ken Task
Particularly helpful Moodlers pilt

Difficult to read your post ... but here goes ....

So your moodle version is 3.11.7

Earlier, you said ...
"I did try to delete the mdl_recent_block_activity from the moodle database inside mariadb"

One should never have to resort to manual removal of rows in DB for Moodle IN the DB interface.   Did you remove rows or the table?

That block is a core block ... comes with moodle.

Do the admin/cli/mysql_ scripts again and pay attention to the tables it shows especially
mdl_block_recent_activity

mysql> show tables like '%recent%';
+---------------------------------+
| Tables_in_moodle311 (%recent%)  |
+---------------------------------+
| mdl_block_recent_activity       |
| mdl_block_recentlyaccesseditems |


explain mdl_block_recent_activity;

+-------------+-------------+------+-----+---------+----------------+
| Field       | Type        | Null | Key | Default | Extra          |
+-------------+-------------+------+-----+---------+----------------+
| id          | bigint(10)  | NO   | PRI | NULL    | auto_increment |
| courseid    | bigint(10)  | NO   | MUL | NULL    |                |
| cmid        | bigint(10)  | NO   |     | NULL    |                |
| timecreated | bigint(10)  | NO   |     | NULL    |                |
| userid      | bigint(10)  | NO   |     | NULL    |                |
| action      | tinyint(1)  | NO   |     | NULL    |                |
| modname     | varchar(20) | YES  |     | NULL

Can that table be queried?

select * from mdl_block_recent_activity;


Screen shot shows the plugin is already installed????!!!!

"A lock was created but not released"

Is there a 'locks' directory in your moodledata directory?
IF there is, manually remove the contents of it ... leaving the directory.


PHP Warning:  rename(C:\inetpub\moodledata/cache/cachestore_file/default_application/core_string/en_-cache/ZBmAQQEBIm.627d620d78e7b6.36636309.temp,C:\inetpub\moodledata/cache/cachestore_file/default_application/core_string/en_-cache/en_core_repository_1652384255-277226e45591af7469fb4178ae34f5fc.cache): Access is denied. (code: 5)

Error 5 indicates that you do not have the required permissions to access a file. With File Manager, all the read/write permissions are taken from the username and password used at login.

We sure are having to 'work to work' on this.   All of this is not typical experience with new sites.   If you've not created courses yet and this is a fresh install, you might consider starting over!

'SoS', Ken

Vastuses Ken Task

Re: DDL sql execution error Error after trying to install plugins

Frank Madison
Waved the white flag and decided to start from scratch. Thank you for your responses though, not sure what the issue was; but too much time to spend on just get started lol
Vastuses Frank Madison

Re: DDL sql execution error Error after trying to install plugins

Ken Task
Particularly helpful Moodlers pilt

Might be wise!

https://docs.moodle.org/400/en/Windows_installation

Is there a reason for Windows server?  If one looks at platform, mariadb/mysql not really native to Windows.   Neither is Apache.   While programmers of PHP apps used to use Windows for development, they were developing to run on Linux.   Many are not using Windows any more but Ubuntu.

One can find more support if Moodle installed on Linux ...

https://docs.moodle.org/400/en/Step-by-step_Installation_Guide_for_Ubuntu

'SoS', Ken