...
This page describes regularly-used settings for development sites, and operations that developers may need to carry out in order to make things happen in the system.
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->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 php server/admin/tool/task/cli/scheduledschedule_task.php --execute=\\core\\task\\session_cleanup_task |
To run all pending tasks (scheduled and ad-hoc tasks):
Code Block |
---|
php server/admin/cli/cron.php |
Forcing downgrade
When switching between work-in-progress branches it can be necessary to make the system pretend that an upgrade hasn’t happened yet. Note that this doesn’t actually roll back the upgrade, it merely adjusts the database to pretend that an older version of a plugin is currently installed. Use at your own risk.
Replace totara_program
with the component name that needs an earlier version number, and replace 2018112202
with that earlier version number.
Code Block |
---|
php server/admin/cli/cfg.php --name=version --component=totara_program --set=2018112202 |
Always back up your database in pre-upgrade state when writing or testing upgrade scripts.
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 |
---|
// Do not enable themedesignermode until you actually need it, site can get very slow. //$CFG->themedesignermode = true; $CFG->langstringcache = false; $CFG->cachejs = false; $CFG->forced_plugin_settings['totara_tui'] = [ 'cache_js' => false, // Disable JS caching of Tui JS 'cache_scss' => false, // Disable JS caching of Tui CSS 'development_mode' => true, // Put Tui into development mode so that you get non-minified source ]; |
And of course all caches can be purged:
Code Block |
---|
php server/admin/cli/purge_caches.php |
GraphQL
By default the GraphQL schema is not exposed, the following with enable access to it for debugging and prevent schema caching.
...