Tsugi

ConfigInfo
in package

A class that contains the configuration fields and defaults.

The normal way you configure Tsugi is copy the file config-dist.php to config.php and then edit the fields. you generally leave the default values in this file unchanged and overide the fields in your config.php.

Attributes
#[AllowDynamicProperties]

Table of Contents

Properties

$adminemails  : mixed
Optional list of Google emails allowed to unlock the Administration console.
$adminpw  : mixed
This is the PW that you need to access the Administration features of this application.
$allow_course_create  : mixed
Offer Add Course and Apply to add course on the instructor home.
$analytics_key  : mixed
$analytics_name  : mixed
$apphome  : mixed
The Application URL when Tsugi is *part* of an application
$author_allow  : mixed
Enable lesson authoring. Only set to true on localhost - never in production.
$autoapprovekeys  : mixed
$badge_assert_salt  : mixed
$badge_encrypt_password  : mixed
Badge generation settings - once you start issuing badges - don't change these
$badge_issuer_email  : mixed
Email address for Open Badges issuer (OB2 required field)
$badge_ob3_secret_key  : mixed
OB3 DataIntegrityProof signing - Base64-encoded Ed25519 secret key (64 bytes).
$badge_ob3_verification_method_id  : mixed
OB3 verification method URL for proof (e.g. issuer URL + #key-0).
$badge_organization  : mixed
Organization name for badge issuer assertions
$badge_organization_logo  : mixed
Organization logo URL for badge issuer assertions
$badge_organization_url  : mixed
Organization URL for badge issuer assertions
$badge_path  : mixed
$badge_url  : mixed
$beacon  : mixed
Post an upgrade beacon to www.tsugi.org at the end of admin/upgrade.php.
$bootswatch  : mixed
$bootswatch_color  : mixed
$branch_override  : mixed
$certification  : mixed
$checktranslation  : mixed
Enable translation checking/recording
$context_title  : mixed
$cookiename  : mixed
$cookiepad  : mixed
$cookiesecret  : mixed
Shared secret used to encrypt LTI secrets in the session, sign OIDC state JWTs, and related tokens. cookiepad is mixed into a few of those constructions.
$dataroot  : mixed
Configure where TSUGI will store uploaded files.
$dbpass  : mixed
Database password for the PDO connection
$dbprefix  : mixed
A prefix to prepend to all table names.
$dbuser  : mixed
Database user for the PDO connection
$dbversion  : mixed
$defaultmenu  : mixed
A default menu for pages
$DEVELOPER  : mixed
Enable developer features of the application.
$dirroot  : mixed
Top level file system folder for the application
$enable_secure_cookie_login  : mixed
Deprecated: long-lived TSUGIAUTO auto-login (loginSecureCookie).
$eventcheck  : mixed
$eventpushcount  : mixed
$eventpushtime  : mixed
$eventtime  : mixed
$expire_context_days  : mixed
$expire_pii_days  : mixed
The defaults for data expiration. Data expiration is not done by default, but can be triggered in the Tsugi Admin UI or via a php CLI program.
$expire_tenant_days  : mixed
$expire_user_days  : mixed
$extensions  : mixed
Extensions
$fallbacklocale  : mixed
Fallback locale when Accept-Language header is not available
$fontawesome  : mixed
$giftquizzes  : mixed
Path (on disk) to the gift quiz content.
$git_command  : mixed
Configure git for auto-installation
$google_classroom_logo  : mixed
(legacy) This should be an absolute URL that will be used to populate previews in Google Classroom
$google_classroom_secret  : mixed
Legacy: Google Classroom support - this was an experiment and is no longer supported First, Go to https://console.developers.google.com/apis/credentials And add access to "Google Classroom API" to your google_client_id (above)
$google_client_id  : mixed
$google_client_secret  : mixed
$google_login_new  : mixed
$google_login_redirect  : mixed
Explicit Google OAuth redirect URI (optional)
$google_map_api_key  : mixed
$google_translate  : mixed
Enable Google Translate on this site
$home_path  : mixed
URL for the site Home brand and Exit course. Any URL.
$install_folder  : mixed
Indicate which folder to install new modules into.
$lang  : mixed
$launchactivity  : mixed
$launcherror  : mixed
The path to an LTI-launch error handling page
$lessons  : mixed
$linkedin_organization_id  : mixed
LinkedIn organization ID for badge sharing
$linkedin_url  : mixed
LinkedIn organization/company page URL
$loader  : mixed
The autoloader to be used when loading classes.
$login_return_url  : mixed
$logout_return_url  : mixed
Defaults to $CFG->apphome if defined and $CFG->wwwroot if that is not defined or false
$lti_pnp_baseurl  : mixed
$lti_pnp_use_email  : mixed
$mail_from  : string|false
From address for all mail transports (SES and PHP mail()).
$mail_reply_to  : string|false
Optional Reply-To for all transports (inbox humans should reply to).
$maildomain  : mixed
Configure mail sending.
$maileol  : mixed
$mailsecret  : mixed
$memcache  : mixed
Support memcache for session caching
$memcached  : mixed
Support memcached for session caching
$migrateblobs  : mixed
This turns on auto-migration of blobs from the database to dataroot, as blobs are accessed
$noncecheck  : mixed
Set the nonce clearing factor
$noncetime  : mixed
Set the expiration time for nonces in seconds
$notification_dedupe_window  : mixed
Notification de-duplication time window (in seconds)
$notification_expiration_days  : mixed
Notification expiration period (in days)
$OFFLINE  : mixed
Effectively an "airplane mode" for the appliction.
$owneremail  : mixed
$ownername  : mixed
Information on the owner of this system
$pdo  : mixed
Database connection information to configure the PDO connection
$pdo_options  : mixed
Additional parameter for the PDO constructor with an array of key-value options
$prefer_lti1_for_grade_send  : mixed
$privacy_url  : mixed
If defined, this is displayed as the privacy URL when Tsugi is used as an "App Store". If you want to use Google login, you need these URLs available on the OAuth application.
$providekeys  : mixed
Whether or not we accept key requests on this system
$qa_allow_local_jwks  : mixed
Allow an LTI token grant to fetch a tool key set from loopback or a private address.
$qa_demo_login  : mixed
Simulated Google site login at /login/simulate for local testing.
$qa_demo_secret  : mixed
Secret typed into the /login/simulate form.
$redis  : mixed
Adding in support for using Redis for session caching.
$require_conformance_parameters  : mixed
$resource_type_prefix  : mixed
Prefix for tool registration codes.
$service_worker  : mixed
Enable service worker for push notifications and offline support
$servicedesc  : mixed
This is how the system will describe itself.
$servicename  : mixed
This is how the system will refer to itself.
$ses_configuration_set  : string|false
Optional SES Configuration Set for transactional mail (and bulk fallback).
$ses_configuration_set_bulk  : string|false
Optional SES Configuration Set for sendBulk() only. Falls back to ses_configuration_set when unset.
$ses_key  : string|false
$ses_region  : string|false
$ses_secret  : string|false
$sessionlifetime  : mixed
Set the session timeout - in seconds
$sessions_in_db  : mixed
Store sessions in database instead of default PHP session storage
$sessionsalt  : mixed
Configure the security for constructing LTI Launch session IDs
$show_course_catalog  : mixed
Course catalog link in the courses waffle footer. Off by default.
$show_courses_widget  : mixed
Site-menu courses waffle (tsugi-courses). Off by default.
$sla_url  : mixed
If defined, this is displayed as the SLA URL when Tsugi is used as an "App Store". If you want to use Google login, you need these URLs available on the OAuth application.
$slow_query  : mixed
The slow_query setting indicated when we want PDOX to log a query for being too slow.
$staticroot  : mixed
Set the URL prefix for the static content folder (i.e. on a CDN)
$storehide  : mixed
Tools to hide in the store for non-admin users. Each tool sets their status in their register.php with a line like: "tool_phase" => "sample", If this is null, then all tools are shown.
$tdiscus  : mixed
The url of the installed instance of the tdiscus tool.
$testblobs  : mixed
Configure lti keys that go into blob_blob regardless of $dataroot
$theme  : mixed
An array of css styles to apply to css variables used to skin Tsugi.
$theme_base  : mixed
The color to be used as the theme base This could optionally be overridden by a launch parameter
$theme_dark_mode  : mixed
A boolean indicator as to whether dark mode should be used This could optionally be overridden by a launch parameter
$timezone  : mixed
Default time zone - see http://www.php.net/.
$tool_folders  : mixed
Indicate which directories to scan for tools.
$top_menu_callback  : mixed
Optional callable that returns a MenuSet for the enclosing site.
$topics  : mixed
$trust_forwarded_ip  : mixed
If the web server is NOT behind a reverse proxy, you may optionally wish to ignore forwarded IP headers such as x-forwarded-for and variations by setting this to false. This will help to preserve authenticity of IPs by only trusting IP addresses directly seen by the server.
$unify  : mixed
$universal_analytics  : mixed
$upgrade_report_url  : mixed
$upgrading  : mixed
Set to true to redirect all requests to the upgrading.php script
$vapid_private_key  : mixed
$vapid_public_key  : mixed
VAPID keys for push notifications
$vapid_subject  : mixed
$vendorinclude  : mixed
$vendorroot  : mixed
$vendorstatic  : mixed
$verifypeer  : mixed
Indicate whether the PHP on this server wants to verify SSL or not
$wwwroot  : mixed
The URL where tsugi is located
$youtube_playlist  : mixed
YouTube playlist ID for embedding or linking
$youtube_url  : mixed
The url of the installed YouTube tool
$youtube_use_labnol  : mixed
Use labnol lightweight YouTube embeds in Lessons

Methods

__construct()  : mixed
Create the configuration object.
canAuthor()  : mixed
Is lesson authoring allowed?
enabledQaSettings()  : array<int, string>
QA setting names that are turned on.
getBadgeOrganization()  : string
Get the badge organization name with fallback logic
getCurrentFile()  : mixed
getCurrentFileUrl()  : mixed
getCurrentUrl()  : mixed
Get the current URL we are executing - no query parameters
getCurrentUrlFolder()  : mixed
Get the current folder of the URL we are executing - no trailing slash
getExtension()  : mixed
getHomeUrl()  : mixed
URL for the site Home brand and Exit course.
getLoginUrl()  : mixed
getPwd()  : mixed
Get the current working directory of a file
getScriptFolder()  : mixed
getScriptName()  : mixed
Get the name of the script relative to the server document root
getScriptPath()  : mixed
getScriptPathFull()  : mixed
getUrlFull()  : mixed
hasHomeUrl()  : mixed
True when Home/Exit have an enclosing-site URL (home_path or apphome).
hasSiteContextTitle()  : mixed
Is a Google-wide site course configured?
hasSiteLessons()  : mixed
Is a site-level lessons.json configured for the Google-wide course?
isPremiumAvailable()  : bool
Whether supporter/premium signup is configured on this site.
isPremiumProviderConfigured()  : bool
Whether the configured premium payment provider extension is present and usable.
isStripeConfigured()  : bool
Whether Stripe checkout is configured (stripe extension with required keys).
isSupporterUiAvailable()  : bool
Whether supporter UI (status, invite, renew) may be shown.
localhost()  : mixed
Are we on localhost?
premiumConfig()  : array<string, mixed>
Premium extension config block.
premiumMonths()  : mixed
premiumMonthsLabel()  : mixed
premiumProvider()  : string|false
Payment provider id from the premium extension (e.g. "stripe").
premiumProviderConfig()  : array<string, mixed>
Config block for the configured premium payment provider.
refundPolicy()  : mixed
Optional refund policy text from the premium extension (plain text).
serverPrefix()  : string
Return a prefix unique to this server for things like shared cache keys
setExtension()  : mixed
Set an extension value
stripeConfig()  : array<string, mixed>
Stripe extension config block.
supporterLabel()  : mixed
supporterPriceLabel()  : mixed
Human-facing price from the premium extension (e.g. "$4.20").
supporterPricePhrase()  : mixed
supporterSiteLabel()  : mixed
Human-facing site label for supporter copy (servicedesc, then servicename).
supporterSiteName()  : mixed
supporterUrl()  : string|false
Optional supporter landing URL from the premium extension.
normalizeHomeUrl()  : mixed
promotedExtensionProperty()  : string|null
Extension keys that are now first-class ConfigInfo properties.

Properties

$adminemails

Optional list of Google emails allowed to unlock the Administration console.

public mixed $adminemails = false

false (default) keeps legacy behavior: any logged-in user who knows $adminpw can unlock admin. Set to an array of emails to restrict unlock to those accounts (comparison is case-insensitive). A single string is treated as a one-element list.

$CFG->adminemails = array('you@umich.edu', 'other@umich.edu');

$adminpw

This is the PW that you need to access the Administration features of this application.

public mixed $adminpw = 'warning:please-change-adminpw-89b543!'

You should change this from the default.

$allow_course_create

Offer Add Course and Apply to add course on the instructor home.

public mixed $allow_course_create = false

Off by default. Independent of show_courses_widget and show_course_catalog. When false, neither link is shown and /instructor/apply returns to the instructor page.

$analytics_key

public mixed $analytics_key = false

$analytics_name

public mixed $analytics_name = false

$apphome

The Application URL when Tsugi is *part* of an application

public mixed $apphome = null

Do not add a trailing slash to this string

An example configuration might be:

$wwwroot = 'http://localhost:8888/wa4e/tsugi';
$apphome = 'http://localhost:8888/wa4e';

This is not required, its default for this is $wwwroot.

$author_allow

Enable lesson authoring. Only set to true on localhost - never in production.

public mixed $author_allow = false

When true, the /lessons/_author interface is available to instructors. When false (default), authoring is only allowed when wwwroot contains localhost or 127.0.0.1.

$autoapprovekeys

public mixed $autoapprovekeys = false

$badge_assert_salt

public mixed $badge_assert_salt = null

$badge_encrypt_password

Badge generation settings - once you start issuing badges - don't change these

public mixed $badge_encrypt_password = null

$badge_issuer_email

Email address for Open Badges issuer (OB2 required field)

public mixed $badge_issuer_email = null

This email address is used in badge issuer assertions. If not set, defaults to "badge_issuer_email_not_set@example.com"

$CFG->badge_issuer_email = 'py4e@learnxp.com';

$badge_ob3_secret_key

OB3 DataIntegrityProof signing - Base64-encoded Ed25519 secret key (64 bytes).

public mixed $badge_ob3_secret_key = null

Run: php scripts/badge_ob3_keygen.php to generate. Required for 1EdTech OB3 certification. $CFG->badge_ob3_secret_key = 'base64-encoded-key';

$badge_ob3_verification_method_id

OB3 verification method URL for proof (e.g. issuer URL + #key-0).

public mixed $badge_ob3_verification_method_id = null

$CFG->badge_ob3_verification_method_id = 'https://yoursite.com/tsugi/assertions/issuer.json#key-0';

$badge_organization

Organization name for badge issuer assertions

public mixed $badge_organization = null

If not set, defaults to the result of getBadgeOrganization() method, which falls back to "$CFG->servicedesc ($CFG->servicename)" format, or just $CFG->servicename if servicedesc is not set.

$CFG->badge_organization = 'Learning Experiences';

Organization logo URL for badge issuer assertions

public mixed $badge_organization_logo = null

Optional logo image URL to include in OB3 issuer profiles. If set, will be included as an "image" property in the issuer JSON.

$CFG->badge_organization_logo = 'https://www.learnxp.com/logo-square.png';

$badge_organization_url

Organization URL for badge issuer assertions

public mixed $badge_organization_url = null

The URL that represents the badge issuing organization. If not set, defaults to $CFG->apphome.

$CFG->badge_organization_url = 'https://www.learnxp.com';

$beacon

Post an upgrade beacon to www.tsugi.org at the end of admin/upgrade.php.

public mixed $beacon = true

The post is unauthenticated JSON: the site host, service name, owner, Tsugi version, one database version, and the PHP and MySQL versions. No passwords, database credentials, or user rows. A failed post does not fail the upgrade. Set this to false to skip it. php upgrade.php beacon still runs the upgrade and sends the beacon at the end when this is false. The admin console page Send Beacon sends one report and does not migrate.

$CFG->beacon = false;

upgrade_report_url sends the same post somewhere other than https://www.tsugi.org. A site root is enough; /api/beacon/upgrade is added when it is missing. Null keeps the default URL. False, or any other non-string, skips the post.

$CFG->upgrade_report_url = 'http://localhost:8888/tsugi-org';
$CFG->upgrade_report_url = false;

$bootswatch_color

public mixed $bootswatch_color = false

$branch_override

public mixed $branch_override = false

$certification

public mixed $certification = false

$checktranslation

Enable translation checking/recording

public mixed $checktranslation = false

When enabled, Tsugi will record all translatable strings to the database for translation management.

$CFG->checktranslation = true;

$context_title

public mixed $context_title = false

$cookiename

public mixed $cookiename = 'TSUGIAUTO'

$cookiepad

public mixed $cookiepad = '390b246ea9'

$cookiesecret

Shared secret used to encrypt LTI secrets in the session, sign OIDC state JWTs, and related tokens. cookiepad is mixed into a few of those constructions.

public mixed $cookiesecret = 'warning:please-change-cookie-secret-a289b543'

These are not login cookies. The old TSUGIAUTO auto-login cookie is gone; see the legacy enable_secure_cookie_login / cookiename properties.

$dataroot

Configure where TSUGI will store uploaded files.

public mixed $dataroot = false

It is ideal for this not to be in the same folder as the rest of the application, but you may have no other choice to leave this false (default). Make sure that this folder is readable and writable by the web server.

If you set $dataroot to a writeable folder, Tsugi will store blobs on disk instead of the database using the following folder / file pattern tsugi_blobs/1f/84/00001754/1f84ab151...56a tsugi_blobs/67/fb/00001754/67fba23c8...123b The folders are based on the sha256 of file contents

In a normal setup - make sure the folder is writable by the web server, backed up and not in the document root hierarchy.

It is important to note that changing dataroot does not migrate the data. Tsugi stores the blob path in the blob_file table. Data uploaded to a blob will stay there and data uploaded to a path will stay there regardless of this setting. There will are separate migration processes to move blob data from the database to dataroot. See tsugi/admin/blob-maint for more detail.

You can set dataroot to a temporary folder for dev but never for production

$dbpass

Database password for the PDO connection

public mixed $dbpass = 'ltipassword'

$dbprefix

A prefix to prepend to all table names.

public mixed $dbprefix = 't_'

The dbprefix allows you to give all the tables a prefix in case your hosting only gives you one database. This can be short like "t_" and can even be an empty string if you can make a separate database for each instance of TSUGI. This allows you to host multiple instances of TSUGI in a single database if your hosting choices are limited. For example, you might only have one MySql database and host Moodle tables with an "mdl_" prefix and Tsugi tables with a "t_" prefix.

$dbuser

Database user for the PDO connection

public mixed $dbuser = 'ltiuser'

$defaultmenu

A default menu for pages

public mixed $defaultmenu = false

Normally, when you navigate to a site like www.py4e.com it defines a default top navigation menu and stores it in the session. The $OUTPUT code adds this menu when it generates pages. But sometimes the user navigates to a subfolder link in a Tsugi/Koseu site and sees the default menu - which is not too pretty. This value allows you to define a menu (must be a MenuSet object) to be used when Tsugi's $OUTPUT code has no other menu.

$set = new \Tsugi\UI\MenuSet(); $set->addLeft('Lessons', $CFG->apphome.'/lessons'); ... $CFG->defaultmenu = $set;

$DEVELOPER

Enable developer features of the application.

public mixed $DEVELOPER = true

When this is true it enables a Developer test harness that can launch tools using LTI. It allows quick testing without setting up an LMS course, etc.

If you turn this on in a production environment, you should change the developer PW (in lti_key table) for the 12345 key to something other than 'secret'.

$dirroot

Top level file system folder for the application

public mixed $dirroot

This should not be changed. It allows included PHP files to reference library files with an absolute path.

This is usually set automatically in config.php to be the folder containing config.php.

Unless you are using a CDN, this should be the same as wwwroot.

Deprecated: long-lived TSUGIAUTO auto-login (loginSecureCookie).

public mixed $enable_secure_cookie_login = false

Ignored. The cookie is no longer set or read. These properties remain so existing config.php assignments do not warn. Setting either has no effect.

$eventpushcount

public mixed $eventpushcount = 0

$eventtime

public mixed $eventtime = 7 * 24 * 60 * 60

$expire_context_days

public mixed $expire_context_days = 600

$expire_pii_days

The defaults for data expiration. Data expiration is not done by default, but can be triggered in the Tsugi Admin UI or via a php CLI program.

public mixed $expire_pii_days = 150

$expire_tenant_days

public mixed $expire_tenant_days = 800

$expire_user_days

public mixed $expire_user_days = 400

$fallbacklocale

Fallback locale when Accept-Language header is not available

public mixed $fallbacklocale = false

If set, this locale will be used when the browser doesn't provide an Accept-Language header or when locale detection fails.

$CFG->fallbacklocale = 'de_DE';

$fontawesome

public mixed $fontawesome = false

$giftquizzes

Path (on disk) to the gift quiz content.

public mixed $giftquizzes

You can maintain a set of gift quizes as text files in github if you like. These can be part of your main Koseu repository or a separate checked-out private repository. When you are configuring a quiz, quiz content can be loaded from these files. There is a '.lock' file in the folder if you want to hide the quiz content from those using the test feature in the store.

$CFG->giftquizzes = $CFG->dirroot.'/../py4e-private/quiz';

$git_command

Configure git for auto-installation

public mixed $git_command = false

On Windows, to run the automatic install of modules:

(1) Make sure Git is installed (https://git-scm.com/download/win Maybe also install a GIT GUI https://git-scm.com/downloads/guis

(2) Open "cmd" and type "git --version" this should give you the current version of git. If this fails then git is not setup in your path (Control Panel > System and Security > System > Advanced System Settings > Environment Variables)

(3) Then in "config.php": $CFG->git_command = 'git'

In order to run git from the a PHP script, we may need a setuid version of git - example commands if you are not root:

cd /home/csev cp /usr/bin/git . chmod a+s git

If you are root, your web area and git must belong to the user that owns the web process. You can check this using:

apache2ctl -S .. User: name="www-data" id=33 Group: name="www-data" id=33

cd /var/www/html chown -R 33:33 site-folder chown 33:33 /home/csev/git

This of course is something to consider carefully. $CFG->git_command = '/home/csev/git';

(legacy) This should be an absolute URL that will be used to populate previews in Google Classroom

public mixed $google_classroom_logo = null

$google_classroom_secret

Legacy: Google Classroom support - this was an experiment and is no longer supported First, Go to https://console.developers.google.com/apis/credentials And add access to "Google Classroom API" to your google_client_id (above)

public mixed $google_classroom_secret = null

(legacy) Set the secret to a long random string - this is used for internal url Tsugi signing - not for Google interactions. Don't change it once you set it.

$google_client_id

public mixed $google_client_id = false

$google_client_secret

public mixed $google_client_secret = false

$google_login_new

public mixed $google_login_new = true

$google_login_redirect

Explicit Google OAuth redirect URI (optional)

public mixed $google_login_redirect = false

If set, this will be used as the redirect URI for Google OAuth login. This should match exactly what you configure in Google's OAuth console.

Example: $CFG->google_login_redirect = 'https://local.ca4e.com/login';

If not set, the redirect URI is automatically constructed from $wwwroot based on the $google_login_new setting.

$google_map_api_key

public mixed $google_map_api_key = false

$google_translate

Enable Google Translate on this site

public mixed $google_translate = false

You must go to Google Translate and set up your web site

http://translate.google.com/manager/website/

$home_path

URL for the site Home brand and Exit course. Any URL.

public mixed $home_path = false

When false/empty, Home is apphome if that is a non-empty string, otherwise wwwroot.

$CFG->home_path = $CFG->apphome;
$CFG->home_path = $CFG->wwwroot;
$CFG->home_path = 'https://example.com/';

Legacy configs may still call setExtension('home_path', ...); that writes this property too.

$install_folder

Indicate which folder to install new modules into.

public mixed $install_folder = false

By default we use the built-in admin tools, and install new tools (see /admin/modules/) into mod. If this is left to false, it will suppress automatic tool installation in Tsugi admin.

$CFG->install_folder = $CFG->dirroot.'/mod';

$launchactivity

public mixed $launchactivity = true

$launcherror

The path to an LTI-launch error handling page

public mixed $launcherror

When the LTI runtime (LTIX.php) is lost and confused because something is broken with the launch, it pops up an error modal with a "Continue" button. When you press the button, it goes to "https://www.tsugi.org/launcherror" and passed a "detail" parameter. This allows www.tsugi.org to have much longer error explanations. But if you want to provide your own error handling endpoint you can send these errors to your own code.

$CFG->launcherror = $CFG->apphome . "/launcherror";

$linkedin_organization_id

LinkedIn organization ID for badge sharing

public mixed $linkedin_organization_id = null

The numeric organization ID used when generating LinkedIn "Add to Profile" URLs. This replaces organizationName in LinkedIn certification URLs.

$CFG->linkedin_organization_id = '4264503';

$linkedin_url

LinkedIn organization/company page URL

public mixed $linkedin_url = null

If set, displays a LinkedIn link on badge pages and may be included in badge issuer extensions.

$CFG->linkedin_url = 'https://www.linkedin.com/company/learn-xp';

$loader

The autoloader to be used when loading classes.

public mixed $loader = false

This is part of configuration startup and should be left as-is from config.dist

$login_return_url

public mixed $login_return_url = false

$logout_return_url

Defaults to $CFG->apphome if defined and $CFG->wwwroot if that is not defined or false

public mixed $logout_return_url

$lti_pnp_baseurl

public mixed $lti_pnp_baseurl = false

$lti_pnp_use_email

public mixed $lti_pnp_use_email = false

$mail_from

From address for all mail transports (SES and PHP mail()).

public string|false $mail_from = false

Defaults to no-reply@$maildomain. May include a display name: 'Course Name no-reply@example.com'.

$mail_reply_to

Optional Reply-To for all transports (inbox humans should reply to).

public string|false $mail_reply_to = false

$maildomain

Configure mail sending.

public mixed $maildomain = false

If you leave maildomain false, mail will not be sent. If you set maildomain to a real domain, best practice is for it to be a real address with a wildcard box that you check periodially.

Optional Amazon SES (async-aws/ses): when ses_region is set, outbound mail uses SES; otherwise PHP mail() is used. See docs/ses.md.

$mailsecret

public mixed $mailsecret = 'warning:please-change-mailsecret-92ds29'

$memcache

Support memcache for session caching

public mixed $memcache

Memcache is php-only and so is likely to require less overall dependencies.

http://php.net/manual/en/memcache.sessions.php

Installed on Ubuntu using

apt-get install -y php${TSUGI_PHP_VERSION}-memcache

You should only select one of memcache and memcached

$CFG->memcache = 'tcp://memcache-tsugi.4984vw.cfg.use2.cache.amazonaws.com:11211';

In addition to setting this variable, your config.php must include the code to configure the PHP session save handler as shown in config-dist.php

$memcached

Support memcached for session caching

public mixed $memcached

Memcached is a combination of PHP and C and so may require extra dependencies.

http://php.net/manual/en/memcached.sessions.php

Installed on Ubuntu using

apt-get install -y php${TSUGI_PHP_VERSION}-memcached

You should only select one of memcache and memcached

$CFG->memcached = 'memcache-tsugi.4984vw.cfg.use2.cache.amazonaws.com:11211';

Note no "tcp://" for the memcached version of the url

In addition to setting this variable, your config.php must include the code to configure the PHP session save handler as shown in config-dist.php

$migrateblobs

This turns on auto-migration of blobs from the database to dataroot, as blobs are accessed

public mixed $migrateblobs = false

$noncecheck

Set the nonce clearing factor

public mixed $noncecheck = 100

If this is zero, we do not store nonces in the database. If this is non-zero we take a modulo of the current time in seconds and if the remainder is zero, we remove old entries from the nonce table based on the $noncetime setting. Setting this to 1 causes the process to run every time a launch happens - which is nice for testing the nonce clearing process.

$noncetime

Set the expiration time for nonces in seconds

public mixed $noncetime = 1800

This is enforced probabilistically depending on the value for $noncecheck - We can be assured that when the cleanup run executes we will purge all nonces that are older than the expiration time. But unitl the cleanup runs we might have older nonces in the tables for a while. It is not harmful to check against more nonces - we just don't want the table to grow forever.

$notification_dedupe_window

Notification de-duplication time window (in seconds)

public mixed $notification_dedupe_window = 900

When two notifications with the same dedupe_key are created for the same user within this time window, the second will update the first instead of creating a new notification.

Defaults to 900 seconds (15 minutes). Set to 0 to disable de-duplication.

Example: $CFG->notification_dedupe_window = 900; // 15 minutes

$notification_expiration_days

Notification expiration period (in days)

public mixed $notification_expiration_days = 30

Notifications older than this number of days will be automatically deleted during opportunistic cleanup operations. Cleanup runs when notifications are accessed, but at most once per hour to avoid performance impact.

Defaults to 30 days (1 month). Set to 0 to disable expiration.

Example: $CFG->notification_expiration_days = 30; // 1 month

$OFFLINE

Effectively an "airplane mode" for the appliction.

public mixed $OFFLINE = false

Setting this to true makes it so that when you are completely disconnected, various tools * will not access network resources like Google's map library and hang. Also the Google login will be faked. Don't run this in production.

$ownername

Information on the owner of this system

public mixed $ownername = false

The $ownername and $owneremail can be generic values like "Support Team at Example Com" and "support@example.com"

$pdo

Database connection information to configure the PDO connection

public mixed $pdo = 'mysql:host=127.0.0.1;dbname=tsugi'

You need to point this at a database with am account and password that can create tables. To make the initial tables go into Admin to run the upgrade.php script which auto-creates the tables.

As an example, to run this on MAMP with its database server on port 8889 you might use:

$pdo = 'mysql:host=127.0.0.1;port=8889;dbname=tsugi';

You will need to create a database, user, and password like this:

CREATE DATABASE tsugi DEFAULT CHARACTER SET utf8mb4;
GRANT ALL ON tsugi.* TO 'ltiuser'@'localhost' IDENTIFIED BY 'ltipassword';
GRANT ALL ON tsugi.* TO 'ltiuser'@'127.0.0.1' IDENTIFIED BY 'ltipassword';

Of course clever people would choose wiser passwords.

$pdo_options

Additional parameter for the PDO constructor with an array of key-value options

public mixed $pdo_options = false

$CFG->pdo_options = array(\PDO::MYSQL_ATTR_SSL_CA => './BaltimoreCyberTrustRoot.crt.pem'))

See also: https://www.php.net/manual/en/pdo.construct.php

$prefer_lti1_for_grade_send

public mixed $prefer_lti1_for_grade_send = false

$privacy_url

If defined, this is displayed as the privacy URL when Tsugi is used as an "App Store". If you want to use Google login, you need these URLs available on the OAuth application.

public mixed $privacy_url = false

You can see sample wording at:

https://www.py4e.com/service.php

$providekeys

Whether or not we accept key requests on this system

public mixed $providekeys = false

Tsugi has a workflow to allow users to come directly to the Tsugi web site and request an LTI 1.x or 2.x key. If this value is 'false', this feature is not available. To enable this feature, you must configure both the $ownername and $owneremail parameters so the system knows who to send the mail for key requests to.

$qa_allow_local_jwks

Allow an LTI token grant to fetch a tool key set from loopback or a private address.

public mixed $qa_allow_local_jwks = false

QA back door for local testing. The fetch is HTTPS-only either way. Leave this false on a public platform. Set it true only on a development machine, where a local tool such as https://local.py4e.com publishes its key set on this host.

$qa_demo_login

Simulated Google site login at /login/simulate for local testing.

public mixed $qa_demo_login = false

QA back door. Never enable in production. Any request to /login/simulate is HTTP 403 unless this is boolean true and $qa_demo_secret is a non-empty string.

$qa_demo_secret

Secret typed into the /login/simulate form.

public mixed $qa_demo_secret = false

QA back door. Plaintext or sha256:... (same pattern as $adminpw). Required when $qa_demo_login is true; an empty/false value keeps the route at 403.

$redis

Adding in support for using Redis for session caching.

public mixed $redis

$CFG->redis = 'tcp://localhost:6379?auth=addYourRedisPasswordHere';

$require_conformance_parameters

public mixed $require_conformance_parameters = false

$resource_type_prefix

Prefix for tool registration codes.

public mixed $resource_type_prefix = 'tsugi_'

For LTI 2.0 registrations: This is a prefix applied to the tool registration codes for LTI 2.0. You may want to keep this default if you want LMS's to use the local equivalent for the tools hosted herein.

$service_worker

Enable service worker for push notifications and offline support

public mixed $service_worker = false

When set to true, enables the service worker registration script in the page footer. The service worker is required for web push notifications to work.

Defaults to false. Set to true to enable service worker functionality. Note: You must also configure VAPID keys for push notifications to work.

Example: $CFG->service_worker = true;

$servicedesc

This is how the system will describe itself.

public mixed $servicedesc = false

This should be a sentance and end with a period. It can include HTML tags - so be careful.

$servicename

This is how the system will refer to itself.

public mixed $servicename = 'TSUGI (dev)'

$ses_configuration_set

Optional SES Configuration Set for transactional mail (and bulk fallback).

public string|false $ses_configuration_set = false

When set, SendEmail attaches it so bounce/complaint events can be published to SNS (see docs/ses.md).

$ses_configuration_set_bulk

Optional SES Configuration Set for sendBulk() only. Falls back to ses_configuration_set when unset.

public string|false $ses_configuration_set_bulk = false

$ses_key

public string|false $ses_key = false

Optional access key; omit for IAM role / default chain

$ses_region

public string|false $ses_region = false

AWS region for SES, e.g. 'us-east-1'

$ses_secret

public string|false $ses_secret = false

Optional secret key paired with ses_key

$sessionlifetime

Set the session timeout - in seconds

public mixed $sessionlifetime = 3000

$sessions_in_db

Store sessions in database instead of default PHP session storage

public mixed $sessions_in_db = false

When enabled, Tsugi will use database-backed session storage instead of the default PHP session handler.

$CFG->sessions_in_db = false;

$sessionsalt

Configure the security for constructing LTI Launch session IDs

public mixed $sessionsalt = "warning:please-change-sessionsalt-89b543"

Since we want to reuse sessions across multiple LTI launches we construct our session ids from launch data. See LTIX::getCompositeKey() for detail on how this operates. But we do not want folks to be able to guess a session id solely on the launch data so we add a bit of secret info to each pre-hash string before we hash it.

Just make this a long random string - the longer and randomer - the better.

$show_course_catalog

Course catalog link in the courses waffle footer. Off by default.

public mixed $show_course_catalog = false

The /catalog page itself is public. Legacy configs may still call setExtension('show_course_catalog', true); that writes this property too.

$show_courses_widget

Site-menu courses waffle (tsugi-courses). Off by default.

public mixed $show_courses_widget = false

Leave false in production until there is more than one course to switch between. Course-nav editing is separate.

Legacy configs may still call setExtension('show_courses_widget', true); that writes this property as well so sites can migrate slowly.

$sla_url

If defined, this is displayed as the SLA URL when Tsugi is used as an "App Store". If you want to use Google login, you need these URLs available on the OAuth application.

public mixed $sla_url = false

You can see sample wording at:

https://www.py4e.com/service.php

$slow_query

The slow_query setting indicated when we want PDOX to log a query for being too slow.

public mixed $slow_query

$staticroot

Set the URL prefix for the static content folder (i.e. on a CDN)

public mixed $staticroot

This allows you to serve the materials in the static folder using a content distribution network - it is normal and typical for this to be the same as wwwroot

This field is generally left as default.

$storehide

Tools to hide in the store for non-admin users. Each tool sets their status in their register.php with a line like: "tool_phase" => "sample", If this is null, then all tools are shown.

public mixed $storehide = null

$tdiscus

The url of the installed instance of the tdiscus tool.

public mixed $tdiscus

When you set this, and you add discussions to lessons.json LTI links to your dicussions are added to exported common cartridges. It also enables the "/discussions" Koseu tool as well.

$CFG->tdiscus = $CFG->apphome . '/mod/tdiscus/';

$testblobs

Configure lti keys that go into blob_blob regardless of $dataroot

public mixed $testblobs = false

The use case for this can be for testing. Many servers set up the 12345/secret ask key and secret to allow testing. The Admin tool has the ability to clear out the 12345 data regularly. We want to wipe out any blob data that is stored whlist testing with 12345.

Blobs in the blob_blob table get removed during the 12345 cleanup.

This can also be used for testing to route a particular key into blob_blob.

$theme

An array of css styles to apply to css variables used to skin Tsugi.

public mixed $theme

Example:

$CFG->theme = array( "primary" => "#336791", //default color for nav background, splash background, buttons, text of tool menu "secondary" => "#EEEEEE", // Nav text and nav item border color, background of tool menu "text" => "#111111", // Standard copy color "text-light" => "#5E5E5E", // A lighter version of the standard text color for elements like "small" "font-url" => "https://fonts.googleapis.com/css2?family=Open+Sans", // Optional custom font url for using Google fonts "font-family" => "'Open Sans', Corbel, Avenir, 'Lucida Grande', 'Lucida Sans', sans-serif", // Font family "font-size" => "14px", // This is the base font size used for body copy. Headers,etc. are scaled off this value );

$theme_base

The color to be used as the theme base This could optionally be overridden by a launch parameter

public mixed $theme_base

$theme_dark_mode

A boolean indicator as to whether dark mode should be used This could optionally be overridden by a launch parameter

public mixed $theme_dark_mode

$timezone

Default time zone - see http://www.php.net/.

public mixed $timezone = 'America/New_York'

...

$tool_folders

Indicate which directories to scan for tools.

public mixed $tool_folders = array("admin", "mod", "tool")

This allows you to include various tool folders. These are scanned for register.php, database.php and index.php files to do automatic table creation as well as making lists of tools in various UI places such as ContentItem and Deep Linking.

$top_menu_callback

Optional callable that returns a MenuSet for the enclosing site.

public mixed $top_menu_callback = false

Set this in the site's config (not in Tsugi core). On cookie-session pages, topNav() invokes it before using $CFG->defaultmenu.

$CFG->top_menu_callback = function() { global $CFG; $buildmenu = $CFG->dirroot.'/../buildmenu.php'; if ( ! file_exists($buildmenu) ) { return false; } require_once $buildmenu; return buildMenu(); };

$trust_forwarded_ip

If the web server is NOT behind a reverse proxy, you may optionally wish to ignore forwarded IP headers such as x-forwarded-for and variations by setting this to false. This will help to preserve authenticity of IPs by only trusting IP addresses directly seen by the server.

public mixed $trust_forwarded_ip = true

Never set this to false if you ARE behind a reverse proxy, otherwise all requests will appear to originate from the same IP address (the proxy).

If behind a reverse proxy, set to true: $CFG->trust_forwarded_ip = true; // (default)

If not using a reverse proxy, set to false: $CFG->trust_forwarded_ip = false;

$universal_analytics

public mixed $universal_analytics = false

$upgrade_report_url

public mixed $upgrade_report_url = null

$upgrading

Set to true to redirect all requests to the upgrading.php script

public mixed $upgrading = false

This allows you to turn off access to the application with a single variable. Also copy upgrading-dist.php to upgrading.php and add your message.

$vapid_private_key

public mixed $vapid_private_key = false

$vapid_public_key

VAPID keys for push notifications

public mixed $vapid_public_key = false

VAPID (Voluntary Application Server Identification) keys are required for web push notifications. These keys identify your server to push notification services.

To generate VAPID keys:

  1. Use an online generator: https://giga.tools/developer-tools/vapid-key-generator
  2. Or use Node.js: npm install -g web-push && web-push generate-vapid-keys
  3. Or use the PHP script: php tsugi/scripts/generate-vapid-keys.php

See docs/vapid.md for detailed instructions.

The vapid_subject should be a mailto: URL with your email address. This is used to identify your server to push notification services.

Example: $CFG->vapid_public_key = 'BKx...long_base64_string...'; $CFG->vapid_private_key = 'xYz...long_base64_string...'; $CFG->vapid_subject = 'mailto:admin@example.com';

$vapid_subject

public mixed $vapid_subject = false

$vendorinclude

public mixed $vendorinclude = false

$vendorstatic

public mixed $vendorstatic = false

$verifypeer

Indicate whether the PHP on this server wants to verify SSL or not

public mixed $verifypeer

$wwwroot

The URL where tsugi is located

public mixed $wwwroot = 'http://localhost/tsugi'

Do not add a trailing slash to this string If you get this value wrong, the first problem will be that CSS files will not load

If you are using MAMP, you should set this to something like:

$wwwroot = 'http://localhost:8888/tsugi';

$youtube_playlist

YouTube playlist ID for embedding or linking

public mixed $youtube_playlist = false

When set, this is added to the global _TSUGI JavaScript variable so tools can access it. Example: PLlRFEj9h3CjHjgV3xeKMJGj7HHoQhCQZ

$CFG->youtube_playlist = 'PLlRFEj9h3CjHjgV3xeKMJGj7HHoQhCQZ';

$youtube_url

The url of the installed YouTube tool

public mixed $youtube_url = false

If you want lessons to launch YouTube URLs using the tracking tool, put its path here. If you have not installed this tool, leave this value blank.

$CFG->youtube_url = $CFG->apphome . '/mod/youtube/';

$youtube_use_labnol

Use labnol lightweight YouTube embeds in Lessons

public mixed $youtube_use_labnol = false

When true, YouTube videos use the labnol embed pattern (overlay with lazy-loaded player). When false (default), YouTube links render as simple links.

Note: As of early 2026, it is likely pointless to turn this on, because YouTube and browser security / privacy / cookie changes have largely broken YouTube embedding.this mostly is an old deprecated feature that will likely be removed unless YouTube embedding is fixed.

$CFG->youtube_use_labnol = true;

Methods

__construct()

Create the configuration object.

public __construct(mixed $dirroot, mixed $wwwroot[, mixed $dataroot = false ]) : mixed

Generally this is done once to create the global variable $CFG in the file config.php.

Example call with constants:

$CFG = new \Tsugi\Config\ConfigInfo('/Applications/MAMP/htdocs/tsugi',
    'http://localhost:8888/tsugi');

Example call in config.php that does not hard-code the actual path:

$CFG = new \Tsugi\Config\ConfigInfo(realpath(dirname(__FILE__)),
    'http://localhost:8888/tsugi');

Once the variable is constructed, the public member variables are overridden directly by setting them in the PHP code in config.php.

$CFG = new \Tsugi ...
$CFG->pdo = 'mysql:host=127.0.0.1;port=8889;dbname=tsugi'; // MAMP
$CFG->dbuser = 'zippy';
...
Parameters
$dirroot : mixed

The full path of the Tsugi source code. This value is used throughout Tsugi to include files with absolute paths. Make sure not to include a trailing slash.

$wwwroot : mixed

The URL where Tsugi is being hosted. Make sure not to include a trailing slash.

$dataroot : mixed = false

An optional parameter that is and absolute path preferably not a sub-folder of $dirroot that is readable and writeable by the PHP code. Tsugi uses this folder to store and serve uploaded file blobs. If this parameter is left off Tsugi will attempt to use a folder named '/_files/a/' within $dirroot as its blob storage area.

canAuthor()

Is lesson authoring allowed?

public canAuthor() : mixed

Returns true if localhost/127.0.0.1 in wwwroot, or if $CFG->author_allow is true. Use author_allow for dev domains like local.dj4e.com - only enable on localhost.

enabledQaSettings()

QA setting names that are turned on.

public enabledQaSettings() : array<int, string>

Boolean true counts. A non-empty string counts, so a QA secret is listed without its value. False, null, and an empty string do not. reqscope_debug is included when that extension is true.

Return values
array<int, string>

getBadgeOrganization()

Get the badge organization name with fallback logic

public getBadgeOrganization() : string

Returns $badge_organization if set, otherwise falls back to "$servicedesc ($servicename)" format, or just $servicename if servicedesc is not set.

Return values
string —

The badge organization name

getCurrentFile()

public getCurrentFile(mixed $file) : mixed
Parameters
$file : mixed

getCurrentFileUrl()

public getCurrentFileUrl(mixed $file) : mixed
Parameters
$file : mixed

getCurrentUrl()

Get the current URL we are executing - no query parameters

public getCurrentUrl() : mixed

http://localhost:8888/py4e/mod/peer-grade/maint.php

getCurrentUrlFolder()

Get the current folder of the URL we are executing - no trailing slash

public getCurrentUrlFolder() : mixed

input: http://localhost:8888/py4e/mod/peer-grade/maint.php output: http://localhost:8888/py4e/mod/peer-grade

getExtension()

public getExtension(mixed $key[, mixed $default = null ]) : mixed
Parameters
$key : mixed
$default : mixed = null

getHomeUrl()

URL for the site Home brand and Exit course.

public getHomeUrl() : mixed

Set $CFG->home_path to any URL. When it is empty, Home is apphome if that is a non-empty string, otherwise wwwroot.

Legacy configs may still call setExtension('home_path', ...).

getPwd()

Get the current working directory of a file

public getPwd(mixed $file) : mixed
Parameters
$file : mixed

getScriptFolder()

public getScriptFolder() : mixed

getScriptName()

Get the name of the script relative to the server document root

public static getScriptName() : mixed

/py4e/mod/peer-grade/maint.php

getScriptPath()

public getScriptPath() : mixed

getScriptPathFull()

public static getScriptPathFull() : mixed

getUrlFull()

public getUrlFull(mixed $file) : mixed
Parameters
$file : mixed

hasHomeUrl()

True when Home/Exit have an enclosing-site URL (home_path or apphome).

public hasHomeUrl() : mixed

Standalone Tsugi (wwwroot only) returns false so Exit course stays hidden.

hasSiteContextTitle()

Is a Google-wide site course configured?

public hasSiteContextTitle() : mixed

$CFG->context_title defaults to false, so isset($CFG->context_title) is always true.

hasSiteLessons()

Is a site-level lessons.json configured for the Google-wide course?

public hasSiteLessons() : mixed

Requires both a lessons path and hasSiteContextTitle(). Course manifests can still provide Lessons under /courses/{id}/ even when this returns false.

isPremiumAvailable()

Whether supporter/premium signup is configured on this site.

public isPremiumAvailable() : bool
Return values
bool

isPremiumProviderConfigured()

Whether the configured premium payment provider extension is present and usable.

public isPremiumProviderConfigured() : bool
Return values
bool

isStripeConfigured()

Whether Stripe checkout is configured (stripe extension with required keys).

public isStripeConfigured() : bool
Return values
bool

isSupporterUiAvailable()

Whether supporter UI (status, invite, renew) may be shown.

public isSupporterUiAvailable() : bool

Requires premium display config plus the provider named in premium_provider.

Return values
bool

localhost()

Are we on localhost?

public localhost() : mixed

Returns true if wwwroot contains localhost or 127.0.0.1.

premiumConfig()

Premium extension config block.

public premiumConfig() : array<string, mixed>
Return values
array<string, mixed>

premiumMonths()

public premiumMonths() : mixed

premiumMonthsLabel()

public premiumMonthsLabel() : mixed

premiumProvider()

Payment provider id from the premium extension (e.g. "stripe").

public premiumProvider() : string|false
Return values
string|false

premiumProviderConfig()

Config block for the configured premium payment provider.

public premiumProviderConfig() : array<string, mixed>
Return values
array<string, mixed>

refundPolicy()

Optional refund policy text from the premium extension (plain text).

public refundPolicy() : mixed

serverPrefix()

Return a prefix unique to this server for things like shared cache keys

public serverPrefix() : string
Return values
string

setExtension()

Set an extension value

public setExtension(mixed $key, mixed $value) : mixed

For show_courses_widget, show_course_catalog, and home_path, also writes the matching ConfigInfo property so old setExtension() configs keep working.

Parameters
$key : mixed
$value : mixed

stripeConfig()

Stripe extension config block.

public stripeConfig() : array<string, mixed>
Return values
array<string, mixed>

supporterLabel()

public supporterLabel() : mixed

supporterPriceLabel()

Human-facing price from the premium extension (e.g. "$4.20").

public supporterPriceLabel() : mixed

supporterPricePhrase()

public supporterPricePhrase() : mixed

supporterSiteLabel()

Human-facing site label for supporter copy (servicedesc, then servicename).

public supporterSiteLabel() : mixed

supporterSiteName()

public supporterSiteName() : mixed

supporterUrl()

Optional supporter landing URL from the premium extension.

public supporterUrl() : string|false
Return values
string|false

normalizeHomeUrl()

private static normalizeHomeUrl(mixed $url) : mixed
Parameters
$url : mixed

promotedExtensionProperty()

Extension keys that are now first-class ConfigInfo properties.

private static promotedExtensionProperty(mixed $key) : string|null

TODO: Delete this compatibility shim (and the promoted branches in getExtension / setExtension) once sites have migrated to the ConfigInfo properties. Revisit 1 November 2026.

Parameters
$key : mixed
Return values
string|null

        
On this page

Search results