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.

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

Backend generic code.

Copyright: 2013 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 201 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

tool_generator_backend:: (5 methods):
  __construct()
  size_for_name()
  log()
  dot()
  end_log()


Class: tool_generator_backend  - X-Ref

Backend generic code for all tool_generator commands.

__construct($size, $fixeddataset = false, $filesizelimit = false, $progress = true)   X-Ref
Generic generator class

param: int $size Size as numeric index
param: bool $fixeddataset To use fixed or random data
param: int|bool $filesizelimit The max number of bytes for a generated file
param: bool $progress True if progress information should be displayed

size_for_name($sizename)   X-Ref
Converts a size name into the numeric constant.

param: string $sizename Size name e.g. 'L'
return: int Numeric version

log(string $langstring, $a = null, bool $leaveopen = false, string $module = 'tool_generator')   X-Ref
Displays information as part of progress.

param: string $langstring Part of langstring (after progress_)
param: mixed $a Optional lang string parameters
param: bool $leaveopen If true, doesn't close LI tag (ready for dots)
param: string $module module for language string

dot(int $number, int $total)   X-Ref
Outputs dots. There is up to one dot per second. Once a minute, it
displays a percentage.

param: int $number Number of completed items
param: int $total Total number of items to complete

end_log()   X-Ref
Ends a log string that was started using log function with $leaveopen.