Skip to content

Updating

Stephen Vickers edited this page Jul 31, 2023 · 5 revisions

Updating from version 4

Version 5 updates the library for use with PHP 8.1+. These updates include a number of backward incompatible code changes, but there are no changes to the underlying database tables. In addition all elements deprecated in version 4 have been removed.

Updated class definition documentation is available.

When trying to support both versions 4 and 5 of this library, a check like the following can be made to determine which is active:

$isV5 = function_exists('enum_exists') && enum_exists('ceLTIc\\LTI\\Enum\\LtiVersion');

Enumerations

Sets of pre-defined constants have been implemented as enumerations using a namespace of ceLTIc\LTI\Enum. In each case the underlying values remain unchanged.

LtiVersion

In version 4 a number of constants were defined to represent the different version values of LTI. These used the ceLTIc\LTI\Util namespace.

Version 4 Version 5
Util::LTI_VERSION1 LtiVersion::V1
Util::LTI_VERSION1P3 LtiVersion::V1P3
Util::LTI_VERSION2 LtiVersion::V2

IdScope

In version 4 a number of constants were defined to represent the different types of scope for user IDs. These used the ceLTIc\LTI\Tool namespace.

Version 4 Version 5
Tool::ID_SCOPE_ID_ONLY IdScope::IdOnly
Tool::ID_SCOPE_GLOBAL IdScope::Platform
Tool::ID_SCOPE_CONTEXT IdScope::Context
Tool::ID_SCOPE_RESOURCE IdScope::Resource

LogLevel

In version 4 a number of constants were defined to represent the different levels of logging which are supported. These used the ceLTIc\LTI\Util namespace.

Version 4 Version 5
Util::LOGLEVEL_NONE LogLevel::None
Util::LOGLEVEL_ERROR LogLevel::Error
Util::LOGLEVEL_INFO LogLevel::Info
Util::LOGLEVEL_DEBUG LogLevel::Debug

So, for example, references to ceLTIc\LTI\Util::LOGLEVEL_DEBUG should typically be changed to ceLTIc\LTI\LogLevel::Debug, or to ceLTIc\LTI\LogLevel::Debug->value if the underlying value is needed. The default value of Util::$logLevel remains as none; i.e.

public static LogLevel $logLevel = LogLevel::None;

Enumeration methods of logNone(), logInfo(), logError() and logDebug() can be used to determine whether a particular level of logging is active. For example, to check whether debug-level logging is active use:

$debugLevelLogging = Util::$logLevel->logDebug();

ServiceAction

In version 4 a number of constants were defined to represent the different types of action for service requests. These used the ceLTIc\LTI\ResourceLink namespace.

Version 4 Version 5
ResourceLink::EXT_READ ServiceAction::Read
ResourceLink::EXT_WRITE ServiceAction::Write
ResourceLink::EXT_DELETE ServiceAction::Delete
ResourceLink::EXT_CREATE ServiceAction::Create
ResourceLink::EXT_UPDATE ServiceAction::Update

OutcomeType

In version 4 a number of constants were defined to represent the different types of outcome values. These used the ceLTIc\LTI\ResourceLink namespace.

Version 4 Version 5
ResourceLink::EXT_TYPE_DECIMAL OutcomeType::Decimal
ResourceLink::EXT_TYPE_PERCENTAGE OutcomeType::Percentage
ResourceLink::EXT_TYPE_RATIO OutcomeType::Ratio
ResourceLink::EXT_TYPE_LETTER_AF OutcomeType::LetterAF
ResourceLink::EXT_TYPE_LETTER_AF_PLUS OutcomeType::LetterAFPlus
ResourceLink::EXT_TYPE_PASS_FAIL OutcomeType::PassFail
ResourceLink::EXT_TYPE_TEXT OutcomeType::Text

ToolSettingsMode

In version 4 a number of constants were defined to represent the different levels being requested in Tool Settings service requests. These used the ceLTIc\LTI\Service\ToolSettings namespace.

Version 4 Version 5
ToolSettings::MODE_CURRENT_LEVEL Use null
ToolSettings::MODE_ALL_LEVELS ToolSettingsMode::All
ToolSettings::MODE_DISTINCT_NAMES ToolSettingsMode::Distinct

Type hinting

Type hinting is used for method definitions so these should match if overridden when extending any classes. For example, the following methods are defined in the ceLTIc\LTI\Tool class:

protected function onInitiateLogin(array $requestParameters, array &$authParameters): void

protected function onLaunch(): void

Deprecations

All methods, constants and properties which are deprecated in version 4 have been removed:

  • Class ApiToolConsumer
  • Class ApiToolProvider
  • Class CanvasApiToolProvider
  • Class ConsumerNonce
  • Class ContentItem
  • Class ContentItemImage
  • Class ContentItemPlacement
  • Method Context::fromConsumer ($consumer, $ltiContextId)
  • Method Context::getConsumer ()
  • Method Context::getMembership ()
  • Method Context::hasMembershipService ()
  • Method Context::setConsumerId ($consumerId)
  • Const DataConnector::CONSUMER_TABLE_NAME
  • Method DataConnector::deleteConsumerNonce ($nonce)
  • Method DataConnector::deleteToolConsumer ($consumer)
  • Method DataConnector::getRandomString ($length=8)
  • Method DataConnector::getToolConsumers ()
  • Method DataConnector::loadConsumerNonce ($nonce)
  • Method DataConnector::loadToolConsumer ($consumer)
  • Method DataConnector::saveConsumerNonce ($nonce)
  • Method DataConnector::saveToolConsumer ($consumer)
  • Class DataConnector_mysql
  • Class HTTPMessage
  • Method ResourceLink::doMembershipsService ($withGroups=false)
  • Method ResourceLink::fromConsumer ($consumer, $ltiResourceLinkId, $tempId=null)
  • Method ResourceLink::getConsumer ()
  • Method ResourceLink::getConsumerId ()
  • Method ResourceLink::getMembership ()
  • Method ResourceLink::hasMembershipService ()
  • Method ResourceLink::setConsumerId ($consumerId)
  • Method Service::getConsumer ()
  • Property Tool::$consumer
  • Method Tool::getConsumers ()
  • Method Tool::sendForm ($url, $params, $target='')
  • Class ToolConsumer
  • Class ToolProvider
  • Const ToolProvider::LTI_VERSION1
  • Const ToolProvider::LTI_VERSION2

See the class definition documentation for more details of deprecated elements.

Removed methods

The following public methods are no longer used by the library and have been removed:

  • ceLTIc\LTI\DataConnector\DataConnector::escape()
  • ceLTIc\LTI\DataConnector\DataConnector::quoted()