Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space TDDM and version 1

Developer settings

Note

None of these settings should be turned on for a production site, they can lead to performance and security issues.

Debugguing

Enabling debugging can be done in either the config.php file by adding the following or enabled in the Development section of the quick-access menu. The setting for debug below enables DEVELOPER debugging which shows all errors/warnings/notices that occur.

Code Block
$CFG->debugging = 1;
$CFG->debug = (E_ALL | E_STRICT);

Debug messages are by default written to the web server logs adding the following will ensure they are output on the page. However there may be some situations where errors are still written to the webserver log, such as a problem in an event that has been triggered.

Code Block
$CFG->debugdisplay = 1;

The following settings when enabled will add performance statistics to the footer of every page including page load time and DB query count.

Code Block
$CFG->perfdebug = 15;
$CFG->profilingenabled = true;

Other useful debugging settings:

Code Block
$CFG->debugstringids = true;
$CFG->allowthemechangeonurl = true;
$CFG->passwordpolicy = false;
$CFG->allowuserthemes = true;
$CFG->allowcoursethemes = true;
$CFG->noemailever = true;

Scheduled tasks

Scheduled tasks are run on a schedule making them hard to debug, adding this unlocks functionality to override tasks on the scheduled task page forcing them to execute the next time the cron is run.

Code Block
$CFG->debugallowscheduledtaskoverride = true;

Scheduled tasks can also be run manually using the schedule_task.php cli script below is an example.

Code Block
sudo -u www-data /usr/bin/php admin/tool/task/cli/scheduled_task.php --execute=\\core\\task\\session_cleanup_task

Caching

While developing caching can cause problems when back-end changes aren't immediately reflected on a page. There are several settings we can change to reduce the caching in a development environment.

Code Block
$CFG->themedesignermode = true;
$CFG->langstringcache = false;
$CFG->cachejs = false;

GraphQL

By default the GraphQL schema is not exposed, the following with enable access to it for debugging and prevent schema caching.

Code Block
define('GRAPHQL_DEVELOPMENT_MODE', true);
$CFG->cache_graphql_schema = false;

Tui

Tui requires a build process to bundle src files into build files. The following command will build both production and development builds.

Code Block
npm install
npm run tui-build