Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

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.

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

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.

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

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

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

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.

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

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

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

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

return: \stdClass