Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 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.

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