Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Developer settings

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.

$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.

$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.

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

Other useful debugging settings:

$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.

$CFG->debugallowscheduledtaskoverride = true;

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

sudo -u www-data /usr/bin/php server/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.

// 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
];

GraphQL

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

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

Tui assets

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

npm ci
npm run tui-build

For more information and tips for developing Vue and Tui, see Setting up your development environment in the Tui documentation.

Legacy assets

Legacy CSS requires a build process as well, as do any changes to legacy JavaScript modules.

cd server/
npm ci
npx grunt
cd ../
  • No labels