Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

Model configuration manager.

Copyright: 2019 David Monllao {@link http://www.davidmonllao.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 327 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

model_config:: (7 methods):
  __construct()
  export()
  import()
  check_dependencies()
  get_class_component()
  extract_import_contents()
  export_model_data()


Class: model_config  - X-Ref

Model configuration manager.

__construct(?model $model = null)   X-Ref
Constructor.

param: \core_analytics\model|null $model

export(string $zipfilename, bool $includeweights = true)   X-Ref
Exports a model to a zip using the provided file name.

param: string $zipfilename
param: bool $includeweights Include the model weights if available
return: string

import(string $zipfilepath)   X-Ref
Imports the provided model configuration into a new model.

Note that this method assumes that self::check_dependencies has already been called.

param: string $zipfilepath Path to the zip file to import
return: \core_analytics\model

check_dependencies(\stdClass $modeldata, bool $ignoreversionmismatches)   X-Ref
Check that the provided model configuration can be deployed in this site.

param: \stdClass $modeldata
param: bool $ignoreversionmismatches
return: string|null Error string or null if all good.

get_class_component(string $fullclassname)   X-Ref
Returns the component the class belongs to.

Note that this method does not work for global space classes.

param: string $fullclassname Qualified name including the namespace.
return: string|null Frankenstyle component

extract_import_contents(string $zipfilepath)   X-Ref
Extracts the import zip contents.

param: string $zipfilepath Zip file path
return: array [0] => \stdClass, [1] => string

export_model_data()   X-Ref
Exports the configuration of the model.

return: \stdClass