Tsugi

AdminService
in package

Helpers that used to be required from admin/.

Callers use these methods. The passphrase session is still $_SESSION['admin'] === 'yes'.

Table of Contents

Constants

MAIL_ADMIN_PURGE_DAYS  : mixed = 30
Helpers to purge old mail audit rows (admin only).

Properties

$issuerClientDuplicateRows  : array<int, array<string, mixed>>|null

Methods

addRepoInfo()  : mixed
Load Information for a github repo
addSlash()  : mixed
adminEmailAllowed()  : mixed
Whether the current session email may attempt admin unlock.
adminUnlockBanned()  : mixed
adminUnlockCacheKey()  : mixed
adminUnlockClearFails()  : mixed
adminUnlockCount()  : mixed
adminUnlockRecordFail()  : mixed
clientConfigColumns()  : array<string, string>
URL columns that would move onto one client row for an issuer and client id.
clientConfigConflictGroups()  : array<int, array{lms_issuer: string, lms_client: string, fields: array, keys: array>}>
Keys that share an issuer and client id but disagree on URL configuration.
clientConfigConflictNotice()  : mixed
Red warning for the admin console and the key list. Empty when URLs agree.
clientIdCheckNotices()  : mixed
The five client id warnings, or one warning when a check cannot run.
doClone()  : mixed
findAllFolders()  : mixed
findAllRegistrations()  : mixed
findAllRegistrationsInternal()  : mixed
findAllTools()  : mixed
findFiles()  : mixed
findToolFiles()  : mixed
findTools()  : mixed
get_count_table()  : mixed
get_expirable_records()  : mixed
get_expirable_where()  : mixed
Get expirable WHERE clause with parameterized query Returns array with 'sql' and 'params' keys
get_pii_count()  : mixed
get_pii_where()  : mixed
Get PII WHERE clause with parameterized query Returns array with 'sql' and 'params' keys
get_safe_key_where()  : mixed
getClusterInfo()  : mixed
getClusterIPs()  : mixed
Get a list of IPs of the other servers in the cluster
getRepoDefaultBranch()  : mixed
Best-effort default branch (origin/HEAD, current, then main/master).
getRepoOrigin()  : mixed
ghostBust()  : mixed
installClusterServers()  : array<int, stdClass>
Per-server tool status for the admin install cluster tab.
installModuleReport()  : array{status: string, version: string, detail: string, available: array, installed: array, required: array, error?: string, errors?: array, available_error?: string, available_error_detail?: string}
Installed, available, and required modules for the admin install page.
isAdmin()  : mixed
issuerClientDuplicateCount()  : mixed
How many (client id, issuer, deployment id) tuples are used by more than one key.
issuerClientDuplicateNotice()  : mixed
Red warning for the admin console and the key list. Empty when there are no duplicates.
issuerClientDuplicateRows()  : array<int, array<string, mixed>>
Tenant keys that share an issuer, client id, and deployment id.
keyDeploymentConflictGroups()  : array<int, array{key_id: int, key_title: string, deleted: int, values: array}>}>
Keys whose deployment id is not a single value.
keyDeploymentConflictNotice()  : mixed
Red warning for the admin console and the key list. Empty when each key has a single deployment id.
keyTypeLabel()  : mixed
Status label for a tenant key on the admin list and detail page.
mail_admin_delete_delivery_events()  : int
Delete SES delivery / ignore_delivery audit rows.
mail_admin_delete_delivery_events_form()  : mixed
Render button to delete all delivery (ignored) SES events.
mail_admin_delivery_event_count()  : mixed
Count SES delivery events that were logged as ignore_delivery.
mail_admin_purge_count()  : int
mail_admin_purge_cutoff()  : string
mail_admin_purge_delete()  : int
mail_admin_purge_form()  : mixed
Render purge form for a mail audit table.
mail_context_audience()  : array<string|int, mixed>
mail_context_audience_by_email()  : array<string|int, mixed>
Single-recipient audience: one context member matching email (case-insensitive).
mail_context_audience_count()  : int|false
Count distinct users matching audience filters (no LIMIT).
mail_context_audience_from_where()  : array{0: string, 1: array}|false
Build FROM/JOIN/WHERE for context audience (shared by select + counts).
mail_context_audience_sql()  : array{0: string, 1: array}|false
Shared audience query for context mailing-list export and bulk mail.
mail_context_audience_stats()  : array{matched_login: int, excluded_recent_bulk: int, eligible_no_limit: int, limit: int, will_send: int, exclude_recent_bulk_days: int}|false
Audience size breakdown for bulk preview / CLI dry-run.
nonAsciiValues()  : array<int, array{label: string, table: string, column: string, row_id: int, key_id: int, length: int, bytes: int, sample: string, redacted: bool}>
Identity values that contain a character outside ASCII.
nonAsciiValuesNotice()  : mixed
Red warning for the admin console and the key list. Empty when every checked identifier is ASCII.
normalize_deploy_key_input()  : string|null
Normalize LTI 1.3 deployment id from a form field for database storage.
repoHasRef()  : mixed
True if ref exists locally or as origin/<ref>.
requireAdmin()  : mixed
requireLogin()  : mixed
resolve_lti13_issuer_client()  : array{issuer_sha256: string, issuer_client: string}|null
Resolve the LTI 1.3 (issuer URL, client id) pair for a tenant key.
resolveGitCheckout()  : mixed
Resolve checkout target. Empty or stale "master" falls back to the repo default (often main).
sanity_check_days()  : mixed
searchTwoLevels()  : mixed
trimAsMuchAsYouCan()  : mixed
updateToolStatus()  : mixed
validate_issuer_client_unique()  : mixed
Reject a new or updated tenant when another live key already has this issuer, client id, and deployment id.
validate_key_details()  : mixed
Pre-save checks for a tenant key.
valuesLongerThan255()  : array<int, array{label: string, table: string, column: string, row_id: int, key_id: int, length: int, sample: string, redacted: bool}>
Identity values that do not fit in varchar(255).
valuesLongerThan255Notice()  : mixed
Red warning for the admin console and the key list. Empty when every issuer, client id, deployment id, context id, resource link id, consumer key, and secret fits in varchar(255).
clientConfigCompareValue()  : mixed
Value used to decide whether two configuration URLs are the same.
deploymentIdCopies()  : array<int, array{table: string, column: string, id_column: string, label: string, via_context?: bool}>
Tables that store an LTI deployment id which should be a function of key_id.
diagnosticRows()  : array<int, array<string, mixed>>
Rows for a client id check. A failed query throws so the caller can keep going. allRowsDie() would end the upgrade.
ltiKeyColumnNames()  : array<int, string>
Column names for lti_key. A failed describe throws so an unread table is not reported as an empty result.
nonAsciiSample()  : mixed
A short window of a non-secret value, centered on the first character outside ASCII when that character is in the fetched prefix.
valuesLongerThan255Copies()  : array<int, array{table: string, column: string, label: string, id_column: string, via_context?: bool, redact?: bool}>
TEXT columns that store an issuer, client id, deployment id, context id, resource link id, LTI 1.1 consumer key, or secret.

Constants

MAIL_ADMIN_PURGE_DAYS

Helpers to purge old mail audit rows (admin only).

public mixed MAIL_ADMIN_PURGE_DAYS = 30

Properties

$issuerClientDuplicateRows

private static array<int, array<string, mixed>>|null $issuerClientDuplicateRows = null

Methods

addRepoInfo()

Load Information for a github repo

public static addRepoInfo(mixed $detail, mixed $repo) : mixed

Does not set name or description

Parameters
$detail : mixed
$repo : mixed

addSlash()

public static addSlash(mixed $path) : mixed
Parameters
$path : mixed

adminEmailAllowed()

Whether the current session email may attempt admin unlock.

public static adminEmailAllowed() : mixed

Unset / empty $CFG->adminemails keeps legacy "any email" behavior.

adminUnlockBanned()

public static adminUnlockBanned() : mixed

adminUnlockCacheKey()

public static adminUnlockCacheKey() : mixed

adminUnlockClearFails()

public static adminUnlockClearFails() : mixed

adminUnlockCount()

public static adminUnlockCount() : mixed

adminUnlockRecordFail()

public static adminUnlockRecordFail() : mixed

clientConfigColumns()

URL columns that would move onto one client row for an issuer and client id.

public static clientConfigColumns() : array<string, string>
Return values
array<string, string> —

column => label

clientConfigConflictGroups()

Keys that share an issuer and client id but disagree on URL configuration.

public static clientConfigConflictGroups() : array<int, array{lms_issuer: string, lms_client: string, fields: array, keys: array>}>

A blank value is ignored. Two different non-blank values for one column collide when those keys collapse onto one client row. Scheme and host case does not. Path, query, and fragment case does.

Return values
array<int, array{lms_issuer: string, lms_client: string, fields: array, keys: array>}>

clientConfigConflictNotice()

Red warning for the admin console and the key list. Empty when URLs agree.

public static clientConfigConflictNotice() : mixed

Same lti_key scan shape as the duplicate notice. Not a per-launch query.

clientIdCheckNotices()

The five client id warnings, or one warning when a check cannot run.

public static clientIdCheckNotices() : mixed

doClone()

public static doClone(mixed $remote, mixed $folder[, mixed $record = true ]) : mixed
Parameters
$remote : mixed
$folder : mixed
$record : mixed = true

findAllFolders()

public static findAllFolders(mixed $paths) : mixed
Parameters
$paths : mixed

findAllRegistrations()

public static findAllRegistrations([mixed $folders = false ][, mixed $appStore = false ]) : mixed
Parameters
$folders : mixed = false
$appStore : mixed = false

findAllRegistrationsInternal()

public static findAllRegistrationsInternal([mixed $folders = false ][, mixed $appStore = false ]) : mixed
Parameters
$folders : mixed = false
$appStore : mixed = false

findFiles()

public static findFiles([mixed $filename = "index.php" ][, mixed $reldir = false ]) : mixed
Parameters
$filename : mixed = "index.php"
$reldir : mixed = false

findToolFiles()

public static findToolFiles([mixed $filename = "index.php" ][, mixed $reldir = false ]) : mixed
Parameters
$filename : mixed = "index.php"
$reldir : mixed = false

findTools()

public static findTools(mixed $dir, mixed &$retval[, mixed $filenames = array("index.php", "tsugi.php") ]) : mixed
Parameters
$dir : mixed
$retval : mixed
$filenames : mixed = array("index.php", "tsugi.php")

get_count_table()

public static get_count_table(mixed $table) : mixed
Parameters
$table : mixed

get_expirable_records()

public static get_expirable_records(mixed $table, mixed $days) : mixed
Parameters
$table : mixed
$days : mixed

get_expirable_where()

Get expirable WHERE clause with parameterized query Returns array with 'sql' and 'params' keys

public static get_expirable_where(mixed $days) : mixed

Note: We use both :DAYS and :DAYS2 even though they have the same value. PDO requires unique placeholder names within a single query - you cannot reuse the same placeholder name (:DAYS) multiple times in one SQL statement. Both parameters check the same number of days but are used in different parts of the WHERE clause (created_at vs login_at).

Parameters
$days : mixed

get_pii_count()

public static get_pii_count(mixed $days) : mixed
Parameters
$days : mixed

get_pii_where()

Get PII WHERE clause with parameterized query Returns array with 'sql' and 'params' keys

public static get_pii_where(mixed $days) : mixed

Note: We use both :DAYS and :DAYS2 even though they have the same value. PDO requires unique placeholder names within a single query - you cannot reuse the same placeholder name (:DAYS) multiple times in one SQL statement. Both parameters check the same number of days but are used in different parts of the WHERE clause (created_at vs login_at).

Parameters
$days : mixed

get_safe_key_where()

public static get_safe_key_where() : mixed

getClusterInfo()

public static getClusterInfo() : mixed

getClusterIPs()

Get a list of IPs of the other servers in the cluster

public static getClusterIPs([mixed $rows = false ]) : mixed
Parameters
$rows : mixed = false

getRepoDefaultBranch()

Best-effort default branch (origin/HEAD, current, then main/master).

public static getRepoDefaultBranch(mixed $repo) : mixed
Parameters
$repo : mixed

getRepoOrigin()

public static getRepoOrigin(mixed $repo) : mixed
Parameters
$repo : mixed

installClusterServers()

Per-server tool status for the admin install cluster tab.

public static installClusterServers() : array<int, stdClass>
Return values
array<int, stdClass>

installModuleReport()

Installed, available, and required modules for the admin install page.

public static installModuleReport() : array{status: string, version: string, detail: string, available: array, installed: array, required: array, error?: string, errors?: array, available_error?: string, available_error_detail?: string}

Also records each installed checkout in lms_tools. GitHub's tsugitools list is cached for ten minutes.

Return values
array{status: string, version: string, detail: string, available: array, installed: array, required: array, error?: string, errors?: array, available_error?: string, available_error_detail?: string}

issuerClientDuplicateCount()

How many (client id, issuer, deployment id) tuples are used by more than one key.

public static issuerClientDuplicateCount() : mixed

issuerClientDuplicateNotice()

Red warning for the admin console and the key list. Empty when there are no duplicates.

public static issuerClientDuplicateNotice() : mixed

issuerClientDuplicateRows()

Tenant keys that share an issuer, client id, and deployment id.

public static issuerClientDuplicateRows() : array<int, array<string, mixed>>

A blank deployment id is its own value in that tuple. This does not change any unique key.

The cache is set only after the query returns. A throw leaves it unset so a later call retries instead of reporting zero duplicates.

Return values
array<int, array<string, mixed>>

keyDeploymentConflictGroups()

Keys whose deployment id is not a single value.

public static keyDeploymentConflictGroups() : array<int, array{key_id: int, key_title: string, deleted: int, values: array}>}>

The key's own deployment id and every copy on a context (and a link, when that column exists) are read together. A blank value, or the literal word "null" in any ASCII case, does not count. That matches how the key form stores a blank deployment id. Every other value is compared as stored bytes, so a difference in case or accents is a conflict. Deleted rows are included.

Return values
array<int, array{key_id: int, key_title: string, deleted: int, values: array}>}>

keyDeploymentConflictNotice()

Red warning for the admin console and the key list. Empty when each key has a single deployment id.

public static keyDeploymentConflictNotice() : mixed

Reads lti_key and the contexts that stored a deployment id. Admin only.

keyTypeLabel()

Status label for a tenant key on the admin list and detail page.

public static keyTypeLabel(array<string, mixed> $row) : mixed

A consumer key with a secret is LTI 1.1. A consumer key without a secret is LTI 1.1 and Draft. An issuer makes the key LTI 1.3. It stays Draft until the client id, OIDC login URL, keyset URL, and token URL are set.

Parameters
$row : array<string, mixed>

mail_admin_delete_delivery_events()

Delete SES delivery / ignore_delivery audit rows.

public static mail_admin_delete_delivery_events() : int
Return values
int —

Rows deleted, or -1 on failure

mail_admin_delete_delivery_events_form()

Render button to delete all delivery (ignored) SES events.

public static mail_admin_delete_delivery_events_form(string $action_url) : mixed
Parameters
$action_url : string

Relative form action

mail_admin_delivery_event_count()

Count SES delivery events that were logged as ignore_delivery.

public static mail_admin_delivery_event_count() : mixed

mail_admin_purge_count()

public static mail_admin_purge_count(mixed $table[, mixed $days = self::MAIL_ADMIN_PURGE_DAYS ]) : int
Parameters
$table : mixed
$days : mixed = self::MAIL_ADMIN_PURGE_DAYS
Return values
int —

Number of rows older than $days

mail_admin_purge_cutoff()

public static mail_admin_purge_cutoff([mixed $days = self::MAIL_ADMIN_PURGE_DAYS ]) : string
Parameters
$days : mixed = self::MAIL_ADMIN_PURGE_DAYS
Return values
string —

Cutoff datetime for purge (UTC/server local as MySQL NOW()-compatible)

mail_admin_purge_delete()

public static mail_admin_purge_delete(mixed $table[, mixed $days = self::MAIL_ADMIN_PURGE_DAYS ]) : int
Parameters
$table : mixed
$days : mixed = self::MAIL_ADMIN_PURGE_DAYS
Return values
int —

Rows deleted

mail_admin_purge_form()

Render purge form for a mail audit table.

public static mail_admin_purge_form(string $action_url, string $table, string $label) : mixed
Parameters
$action_url : string

Relative form action (current script)

$table : string

Logical table name without prefix (mail_ses_events|mail_sent)

$label : string

Human label for the table

mail_context_audience()

public static mail_context_audience(mixed $context_id, mixed $days[, mixed $include_opted_out = false ][, mixed $premium_only = false ][, mixed $exclude_recent_bulk_days = 0 ][, mixed $limit = 0 ]) : array<string|int, mixed>
Parameters
$context_id : mixed
$days : mixed
$include_opted_out : mixed = false
$premium_only : mixed = false
$exclude_recent_bulk_days : mixed = 0
$limit : mixed = 0
Return values
array<string|int, mixed> —

List of audience rows

mail_context_audience_by_email()

Single-recipient audience: one context member matching email (case-insensitive).

public static mail_context_audience_by_email(mixed $context_id, mixed $email) : array<string|int, mixed>
Parameters
$context_id : mixed
$email : mixed
Return values
array<string|int, mixed> —

Zero or one audience row (same shape as mail_context_audience)

mail_context_audience_count()

Count distinct users matching audience filters (no LIMIT).

public static mail_context_audience_count(mixed $context_id, mixed $days[, mixed $include_opted_out = false ][, mixed $premium_only = false ][, mixed $exclude_recent_bulk_days = 0 ]) : int|false
Parameters
$context_id : mixed
$days : mixed
$include_opted_out : mixed = false
$premium_only : mixed = false
$exclude_recent_bulk_days : mixed = 0
Return values
int|false

mail_context_audience_from_where()

Build FROM/JOIN/WHERE for context audience (shared by select + counts).

public static mail_context_audience_from_where(mixed $context_id, mixed $days[, mixed $include_opted_out = false ][, mixed $premium_only = false ][, mixed $exclude_recent_bulk_days = 0 ]) : array{0: string, 1: array}|false
Parameters
$context_id : mixed
$days : mixed
$include_opted_out : mixed = false
$premium_only : mixed = false
$exclude_recent_bulk_days : mixed = 0
Return values
array{0: string, 1: array}|false

mail_context_audience_sql()

Shared audience query for context mailing-list export and bulk mail.

public static mail_context_audience_sql(mixed $context_id, mixed $days[, mixed $include_opted_out = false ][, mixed $premium_only = false ][, int $exclude_recent_bulk_days = 0 ][, int $limit = 0 ]) : array{0: string, 1: array}|false
Parameters
$context_id : mixed
$days : mixed
$include_opted_out : mixed = false
$premium_only : mixed = false
$exclude_recent_bulk_days : int = 0

When > 0, exclude users who already have a successful bulk send (mail_sent with bulk_id, status sent) in this context within that many days. Scoped per context_id.

$limit : int = 0

When > 0, return only the most recently logged-in N users (ORDER BY login_at DESC LIMIT N). 0 = no limit (email-domain sort).

Return values
array{0: string, 1: array}|false —

SQL + params, or false if args invalid

mail_context_audience_stats()

Audience size breakdown for bulk preview / CLI dry-run.

public static mail_context_audience_stats(mixed $context_id, mixed $days[, mixed $include_opted_out = false ][, mixed $premium_only = false ][, mixed $exclude_recent_bulk_days = 0 ][, mixed $limit = 0 ]) : array{matched_login: int, excluded_recent_bulk: int, eligible_no_limit: int, limit: int, will_send: int, exclude_recent_bulk_days: int}|false
Parameters
$context_id : mixed
$days : mixed
$include_opted_out : mixed = false
$premium_only : mixed = false
$exclude_recent_bulk_days : mixed = 0
$limit : mixed = 0
Return values
array{matched_login: int, excluded_recent_bulk: int, eligible_no_limit: int, limit: int, will_send: int, exclude_recent_bulk_days: int}|false

nonAsciiValues()

Identity values that contain a character outside ASCII.

public static nonAsciiValues() : array<int, array{label: string, table: string, column: string, row_id: int, key_id: int, length: int, bytes: int, sample: string, redacted: bool}>

These columns are utf8, so a character outside ASCII is more than one byte. LENGTH counts bytes and CHAR_LENGTH counts characters. An ascii column, including ascii_bin, cannot store that character. Blank values are ASCII, so they are absent. Deleted rows are included. A secret is reported by its lengths only.

Return values
array<int, array{label: string, table: string, column: string, row_id: int, key_id: int, length: int, bytes: int, sample: string, redacted: bool}>

nonAsciiValuesNotice()

Red warning for the admin console and the key list. Empty when every checked identifier is ASCII.

public static nonAsciiValuesNotice() : mixed

Same columns and same admin-only scan as the varchar(255) length notice.

normalize_deploy_key_input()

Normalize LTI 1.3 deployment id from a form field for database storage.

public static normalize_deploy_key_input(mixed $v) : string|null

Empty string, whitespace only, or the literal "null" are stored as NULL. Leaving the field blank means the key accepts any deployment id sent by the LMS; Tsugi still uses the deployment id from the launch JWT for LTI 1.3 services (for example grading). Any other non-empty string is trimmed and stored as the specific deployment id.

Parameters
$v : mixed

Raw POST value

Return values
string|null

repoHasRef()

True if ref exists locally or as origin/<ref>.

public static repoHasRef(mixed $repo, mixed $ref) : mixed
Parameters
$repo : mixed
$ref : mixed

resolve_lti13_issuer_client()

Resolve the LTI 1.3 (issuer URL, client id) pair for a tenant key.

public static resolve_lti13_issuer_client(mixed $lms_issuer, mixed $lms_client) : array{issuer_sha256: string, issuer_client: string}|null
Parameters
$lms_issuer : mixed
$lms_client : mixed
Return values
array{issuer_sha256: string, issuer_client: string}|null

resolveGitCheckout()

Resolve checkout target. Empty or stale "master" falls back to the repo default (often main).

public static resolveGitCheckout(mixed $repo, mixed $gitversion) : mixed
Parameters
$repo : mixed
$gitversion : mixed

sanity_check_days()

public static sanity_check_days([mixed $base = false ][, mixed $days = false ]) : mixed
Parameters
$base : mixed = false
$days : mixed = false

searchTwoLevels()

public static searchTwoLevels(mixed $filename, mixed $dir) : mixed
Parameters
$filename : mixed
$dir : mixed

trimAsMuchAsYouCan()

public static trimAsMuchAsYouCan(mixed $path, mixed $root) : mixed
Parameters
$path : mixed
$root : mixed

updateToolStatus()

public static updateToolStatus(mixed $tool_path, mixed $detail) : mixed
Parameters
$tool_path : mixed
$detail : mixed

validate_issuer_client_unique()

Reject a new or updated tenant when another live key already has this issuer, client id, and deployment id.

public static validate_issuer_client_unique(mixed $lms_issuer, mixed $lms_client, mixed $deploy_key[, mixed $exclude_key_id = null ]) : mixed

A blank deployment id is its own value. Two blank deployment ids for the same issuer and client id collide. A specific deployment id collides only with that same deployment id.

Parameters
$lms_issuer : mixed
$lms_client : mixed
$deploy_key : mixed
$exclude_key_id : mixed = null

validate_key_details()

Pre-save checks for a tenant key.

public static validate_key_details(mixed $key_key, mixed $deploy_key, mixed $lms_issuer[, mixed $old_key_key = null ][, mixed $old_deploy_key = null ][, mixed $lms_client = null ][, mixed $exclude_key_id = null ]) : mixed

A draft (no OAuth consumer key, and not both an issuer and a client id) is saved with no checks. A deployment id alone leaves the key a draft. An OAuth consumer key must be unique. Issuer, client id, and deployment id must be unique together. A blank deployment id collides with another blank deployment id. A specific deployment id collides only with the same deployment id. $old_deploy_key stays in the signature for existing callers.

Parameters
$key_key : mixed
$deploy_key : mixed
$lms_issuer : mixed
$old_key_key : mixed = null
$old_deploy_key : mixed = null
$lms_client : mixed = null
$exclude_key_id : mixed = null

valuesLongerThan255()

Identity values that do not fit in varchar(255).

public static valuesLongerThan255() : array<int, array{label: string, table: string, column: string, row_id: int, key_id: int, length: int, sample: string, redacted: bool}>

CHAR_LENGTH counts characters, which is the varchar limit. Blank values are short, so they are absent. Deleted rows are included.

Return values
array<int, array{label: string, table: string, column: string, row_id: int, key_id: int, length: int, sample: string, redacted: bool}>

valuesLongerThan255Notice()

Red warning for the admin console and the key list. Empty when every issuer, client id, deployment id, context id, resource link id, consumer key, and secret fits in varchar(255).

public static valuesLongerThan255Notice() : mixed

Same admin-only scan as the other Client ID Check notices.

clientConfigCompareValue()

Value used to decide whether two configuration URLs are the same.

private static clientConfigCompareValue(mixed $value) : mixed

Scheme and host are case-insensitive. The path, query, and fragment are compared as stored, so a path that differs only by case still conflicts.

Parameters
$value : mixed

deploymentIdCopies()

Tables that store an LTI deployment id which should be a function of key_id.

private static deploymentIdCopies() : array<int, array{table: string, column: string, id_column: string, label: string, via_context?: bool}>

lti_link is listed so a column added later is included. It has none today. lti_tool_deployment.deployment_id is an outbound tool id. One key may have many.

Return values
array<int, array{table: string, column: string, id_column: string, label: string, via_context?: bool}>

diagnosticRows()

Rows for a client id check. A failed query throws so the caller can keep going. allRowsDie() would end the upgrade.

private static diagnosticRows(mixed $sql) : array<int, array<string, mixed>>
Parameters
$sql : mixed
Return values
array<int, array<string, mixed>>

ltiKeyColumnNames()

Column names for lti_key. A failed describe throws so an unread table is not reported as an empty result.

private static ltiKeyColumnNames(mixed $table) : array<int, string>
Parameters
$table : mixed
Return values
array<int, string>

nonAsciiSample()

A short window of a non-secret value, centered on the first character outside ASCII when that character is in the fetched prefix.

private static nonAsciiSample(mixed $raw, mixed $truncated) : mixed
Parameters
$raw : mixed
$truncated : mixed

valuesLongerThan255Copies()

TEXT columns that store an issuer, client id, deployment id, context id, resource link id, LTI 1.1 consumer key, or secret.

private static valuesLongerThan255Copies() : array<int, array{table: string, column: string, label: string, id_column: string, via_context?: bool, redact?: bool}>

These are the values a varchar(255) column would have to hold, and the values an ascii column would have to hold. The length check and the non-ASCII check both read this list. Outbound lti_tool_registration.lti13_client_id, lti_tool_registration.lti11_key, and lti_tool_deployment.deployment_id are already varchar(255). lti_link is listed so a deployment column added later is included. It has none today. A link's resource link id is link_key. lti_content keeps its own copy. cal_context keeps the course id. A secret column is marked redact so a check can report the row without returning the secret.

Return values
array<int, array{table: string, column: string, label: string, id_column: string, via_context?: bool, redact?: bool}>

        
On this page

Search results