vfremaux / moodle-local_vmoodle

A shifted version of VMoodle starting from Moodle 2.8 ahead
3 stars 2 forks source link

Fails badly on PostgreSQL #3

Open mudrd8mz opened 6 years ago

mudrd8mz commented 6 years ago

When installed on a PostgreSQL site, the plugin fails badly due to MySQL-specific SQL. In fact, it blocks access to the administration completely: {code} Debug info: ERROR: column "blocks/vmoodle%" does not exist LINE 1: SELECT FROM mdl_mnet_rpc WHERE xmlrpcpath LIKE "blocks/vm... ^ SELECT FROM mdl_mnet_rpc WHERE xmlrpcpath LIKE "blocks/vmoodle%" [array ( )] Error code: dmlreadexception Stack trace: line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown line 242 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end() line 776 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end() line 1387 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql() line 61 of /local/vmoodle/db/install.php: call to moodle_database->get_records_select() line 29 of /local/vmoodle/settings.php: call to xmldb_local_vmoodle_late_install() line 67 of /lib/classes/plugininfo/local.php: call to include() line 627 of /admin/settings/plugins.php: call to core\plugininfo\local->load_settings() line 7999 of /lib/adminlib.php: call to require() line 4153 of /lib/navigationlib.php: call to admin_get_root() line 4016 of /lib/navigationlib.php: call to settings_navigation->load_administration_settings() line 759 of /lib/pagelib.php: call to settings_navigation->initialise() line 820 of /lib/pagelib.php: call to moodle_page->magic_get_settingsnav() line 136 of /blocks/settings/block_settings.php: call to moodle_page->__get() line 288 of /blocks/moodleblock.class.php: call to block_settings->get_content() line 230 of /blocks/moodleblock.class.php: call to block_base->formatted_contents() line 1200 of /lib/blocklib.php: call to block_base->get_content_for_output() line 1252 of /lib/blocklib.php: call to block_manager->create_block_contents() line 579 of /lib/outputrenderers.php: call to block_manager->ensure_content_created() line 39 of /theme/bootstrapbase/renderers/core_renderer.php: call to core_renderer->standard_head_html() line 36 of /theme/clean/layout/columns2.php: call to theme_bootstrapbase_core_renderer->standard_head_html() line 1162 of /lib/outputrenderers.php: call to include() line 1092 of /lib/outputrenderers.php: call to core_renderer->render_page_layout() line 2685 of /lib/outputrenderers.php: call to core_renderer->header() line 395 of /lib/setuplib.php: call to core_renderer->fatal_error() line ? of unknownfile: call to default_exception_handler() {code}

py-steph commented 6 years ago

You have to simply exchange ' to " and vice versa in line 61,63,69,71 in file local/vmoodle/db/install.php

local/vmoodle/db/install.php at lin 61:

// Cleanup all old mnetrpc functions related to blocks.
$oldfunctions = $DB->get_records_select('mnet_rpc', " xmlrpcpath LIKE 'blocks/vmoodle%' ");
if ($oldfunctions) {
    $DB->delete_records_select('mnet_rpc', " xmlrpcpath LIKE 'blocks/vmoodle%' ", array());
    foreach ($oldfunctions as $f) {
        $DB->delete_records('mnet_service2rpc', array('rpcid' => $f->id));
    }
}

$oldfunctions = $DB->get_records_select('mnet_remote_rpc', " xmlrpcpath LIKE 'blocks/vmoodle%' ");
if ($oldfunctions) {
    $DB->delete_records_select('mnet_remote_rpc', " xmlrpcpath LIKE 'blocks/vmoodle%' ", array());
    foreach ($oldfunctions as $f) {
        $DB->delete_records('mnet_remote_service2rpc', array('rpcid' => $f->id));
    }
}