Skip to content

Bug: On new Moodle installations, Boost Union tries to access the mdl_files table before it is created #1058

@abias

Description

@abias

When you place Boost Union on a brand new and uninitialized Moodle installation, it tries to access the mdl_files table before it is created:

Warning: Attempt to read property "id" on null in /var/www/moodle/theme/boost_union/locallib.php on line 1907



Debug info: ERROR: relation "mdl_files" does not exist
LINE 2: FROM mdl_files f
^
SELECT f.id AS id, f.contenthash, f.pathnamehash, f.contextid, f.component, f.filearea, f.itemid, f.filepath, f.filename, f.userid, f.filesize, f.mimetype, f.status, f.source, f.author, f.license, f.timecreated, f.timemodified, f.sortorder, f.referencefileid, r.repositoryid AS repositoryid, r.reference AS reference, r.lastsync AS referencelastsync
FROM mdl_files f
LEFT JOIN mdl_files_reference r
ON f.referencefileid = r.id
WHERE f.contextid = $1
AND f.component = $2
AND f.filearea = $3
AND f.filename != $4

ORDER BY itemid
[array (
0 => NULL,
1 => 'theme_boost_union',
2 => 'touchiconsios',
3 => '.',
)]
Error code: dmlreadexception
Stack trace:
line 497 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
line 358 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->read_slave_query_end()
line 1044 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
line 668 of /lib/filestorage/file_storage.php: call to pgsql_native_moodle_database->get_records_sql()
line 1907 of /theme/boost_union/locallib.php: call to file_storage->get_area_files()
line 1976 of /theme/boost_union/locallib.php: call to theme_boost_union_touchicons_for_ios_checkin()
line 2184 of /theme/boost_union/locallib.php: call to theme_boost_union_get_touchicons_html_for_page()
line 47 of /theme/boost_union/classes/local/hook/output/before_standard_head_html_generation.php: call to theme_boost_union_callbackimpl_before_standard_html()
line ? of unknownfile: call to theme_boost_union\local\hook\output\before_standard_head_html_generation::callback()
line 318 of /lib/classes/hook/manager.php: call to call_user_func()
line 195 of /lib/classes/output/core_renderer.php: call to core\hook\manager->dispatch()
line 219 of /lib/mustache/src/Mustache/Context.php: call to core\output\core_renderer->standard_head_html()
line 138 of /lib/mustache/src/Mustache/Context.php: call to Mustache_Context->findVariableInStack()
line 34 of /home/moodle/moodledata/localcache/mustache/1/boost/__Mustache_32ae05b43438e456572991e6324b64e3.php: call to Mustache_Context->findDot()
line 66 of /lib/mustache/src/Mustache/Template.php: call to __Mustache_32ae05b43438e456572991e6324b64e3->renderInternal()
line 192 of /lib/classes/output/renderer_base.php: call to Mustache_Template->render()
line 34 of /theme/boost/layout/maintenance.php: call to core\output\renderer_base->render_from_template()
line 972 of /lib/classes/output/core_renderer.php: call to include()
line 888 of /lib/classes/output/core_renderer.php: call to core\output\core_renderer->render_page_layout()
line ? of unknownfile: call to core\output\core_renderer->header()
line 130 of /lib/classes/output/plugin_renderer_base.php: call to call_user_func_array()
line 42 of /admin/renderer.php: call to core\output\plugin_renderer_base->__call()
line 225 of /admin/index.php: call to core_admin_renderer->install_licence_page()

This call is happening here:

$files = $fs->get_area_files($systemcontext->id, 'theme_boost_union', 'touchiconsios', false, 'itemid', false);

It should be fairly easy to avoid that flaw.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething which isn't workinggood first issueSomething which can be addressed by newcomers in reasonable time

    Projects

    Status

    Ready for DEV

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions