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.

(no description)

Copyright: 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 165 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

restore_step:: (4 methods):
  __construct()
  get_restoreid()
  apply_date_offset()
  decrypt()

restore_step_exception:: (1 method):
  __construct()


Class: restore_step  - X-Ref

Abstract class defining the needed stuf for one restore step

TODO: Finish phpdocs
__construct($name, $task = null)   X-Ref
Constructor - instantiates one object of this class


get_restoreid()   X-Ref
No description

apply_date_offset($value)   X-Ref
Apply course startdate offset based in original course startdate and course_offset_startdate setting
Note we are using one static cache here, but *by restoreid*, so it's ok for concurrence/multiple
executions in the same request

Note: The policy is to roll date only for configurations and not for user data. see MDL-9367.

param: int $value Time value (seconds since epoch), or empty for nothing
return: int Time value after applying the date offset, or empty for nothing

decrypt($value)   X-Ref
Returns symmetric-key AES-256 decryption of base64 encoded contents.

This method is used in restore operations to decrypt contents encrypted with
{@link encrypted_final_element} automatically decoding (base64) and decrypting
contents using the key stored in backup_encryptkey config.

Requires openssl, cipher availability, and key existence (backup
automatically sets it if missing). Integrity is provided via HMAC.

param: string $value {@link encrypted_final_element} value to decode and decrypt.
return: string|null decoded and decrypted value or null if the operation can not be performed.

Class: restore_step_exception  - X-Ref

__construct($errorcode, $a=NULL, $debuginfo=null)   X-Ref
No description