Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.
/lib/ -> licenselib.php (source)

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403]

A namespace contains license specific functions

Copyright: 2010 Dongsheng Cai <dongsheng@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 398 lines (13 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

license_manager:: (16 methods):
  save()
  add()
  create()
  read()
  update()
  delete()
  get_licenses()
  change_license_sortorder()
  get_license_by_shortname()
  enable()
  disable()
  set_active_licenses()
  get_active_licenses()
  get_active_licenses_as_array()
  install_licenses()
  reset_license_cache()


Class: license_manager  - X-Ref

save($license)   X-Ref
Save a license record.

param: object $license {

add()   X-Ref


create($license)   X-Ref
Create a license record.

param: object $license the license to create record for.

read(array $params = [])   X-Ref
Read licens record(s) from database.

param: array $params license parameters to return licenses for.
return: array $filteredlicenses object[] of licenses.

update($license)   X-Ref
Update a license record.

param: object $license the license to update record for.

delete($licenseshortname)   X-Ref
Delete a custom license.

param: string $licenseshortname the shortname of license.

get_licenses()   X-Ref
Get license records.

return: array|false object[] of license records of false if none.

change_license_sortorder(int $direction, string $licenseshortname)   X-Ref
Change the sort order of a license (and it's sibling license as a result).

param: int $direction value to change sortorder of license by.
param: string $licenseshortname the shortname of license to changes sortorder for.

get_license_by_shortname(string $name)   X-Ref
Get license record by shortname

param: string $name the shortname of license
return: object|null the license or null if no license found.

enable($license)   X-Ref
Enable a license

param: string $license the shortname of license
return: boolean

disable($license)   X-Ref
Disable a license

param: string $license the shortname of license
return: boolean

set_active_licenses()   X-Ref
Store active licenses in global config.


get_active_licenses()   X-Ref
Get the globally configured active licenses.

return: array of license objects.

get_active_licenses_as_array()   X-Ref
Get the globally configured active licenses as an array.

return: array $licenses an associative array of licenses shaped as ['shortname' => 'fullname']

install_licenses()   X-Ref
Install moodle built-in licenses.


reset_license_cache()   X-Ref
Reset the license cache so it rebuilds next time licenses are fetched.