MDL-77338 backup: Added class properties that are not declared.

In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
This commit is contained in:
Meirza 2023-03-27 09:18:52 +07:00
parent fba0658777
commit 8a5485a714
12 changed files with 28 additions and 12 deletions

View File

@ -123,7 +123,7 @@ class cc112moodle extends cc2moodle {
if (array_key_exists("index", self::$instances)) {
if (!file_put_contents(static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'moodle.xml', $result_xml)) {
static::log_action('Cannot save the moodle manifest file: ' . static::$path_to_tmp_folder . DIRECTORY_SEPARATOR . 'moodle.xml', true);
static::log_action('Cannot save the moodle manifest file: ' . static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'moodle.xml', true);
} else {
$status = true;
}

View File

@ -206,7 +206,7 @@ class cc2moodle {
if (array_key_exists("index", self::$instances)) {
if (!file_put_contents(static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'moodle.xml', $result_xml)) {
static::log_action('Cannot save the moodle manifest file: ' . static::$path_to_tmp_folder . DIRECTORY_SEPARATOR . 'moodle.xml', true);
static::log_action('Cannot save the moodle manifest file: ' . static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'moodle.xml', true);
} else {
$status = true;
}

View File

@ -1042,6 +1042,9 @@ class cc_assesment_itemfeedbacktype extends cc_question_metadata_base {
protected $solution = null;
protected $hint = null;
/** @var cc_assignment_displayfeedbacktype item feedback. */
protected $itemfeedback;
public function __construct() {
$this->set_setting(cc_qti_tags::ident, cc_helpers::uuidgen('I_'));
$this->set_setting(cc_qti_tags::title);
@ -1386,6 +1389,12 @@ class cc_assesment_flow_labeltype extends cc_question_metadata_base {
*/
protected $response_label = null;
/** @var cc_assesment_material assesment material. */
protected $material;
/** @var cc_assesment_response_matref assesment response material ref. */
protected $material_ref;
public function __construct() {
$this->set_setting(cc_qti_tags::t_class);
}

View File

@ -42,7 +42,8 @@ class cc_organization implements cc_i_organization {
private $metadata = null;
private $sequencing = null;
/** @var bool true if empty, otherwise false. */
protected $isempty;
public function __construct($node=null, $doc=null) {
if (is_object($node) && is_object($doc)) {
@ -140,7 +141,8 @@ class cc_item implements cc_i_item {
private $parentItem = null;
private $isempty = true;
/** @var mixed node structure. */
public $structure;
public function __construct($node=null,$doc=null) {
if (is_object($node)) {

View File

@ -37,6 +37,9 @@ class cc_version1 extends cc_version_base {
const discussiontopic = 'imsdt_xmlv1p0';
const weblink = 'imswl_xmlv1p0';
/** @var array CC URL profiles. */
protected $ccnsnames = [];
public static $checker = array(self::webcontent,
self::assessment,
self::associatedcontent,

View File

@ -210,7 +210,6 @@ class cc_validate_type {
* @return boolean
*/
public function validate($element) {
$this->last_error = null;
$celement = realpath($element);
$cvalidator = realpath($this->location.DIRECTORY_SEPARATOR.$this->type);
$result = (empty($celement) || empty($cvalidator));

View File

@ -43,6 +43,9 @@ abstract class base_controller extends backup implements loggable {
*/
protected $copy;
/** @var int Backup mode. */
protected $mode;
/**
* Gets the progress reporter, which can be used to report progress within
* the backup or restore process.

View File

@ -6169,6 +6169,9 @@ abstract class restore_questions_activity_structure_step extends restore_activit
use restore_question_reference_data_trait;
use restore_question_set_reference_data_trait;
/** @var \question_engine_attempt_upgrader manages upgrading all the question attempts. */
private $attemptupgrader;
/**
* Attach below $element (usually attempts) the needed restore_path_elements
* to restore question attempt data from Moodle 2.0.

View File

@ -144,7 +144,7 @@ class restore_stepslib_date_test extends \restore_date_testcase {
$fordb->status = BADGE_STATUS_INACTIVE;
$fordb->nextcron = time();
$this->badgeid = $DB->insert_record('badge', $fordb, true);
$DB->insert_record('badge', $fordb, true);
// Do a backup and restore.
$newcourseid = $this->backup_and_restore($course);
$newcourse = get_course($newcourseid);

View File

@ -459,11 +459,6 @@ class mock_base_setting extends base_setting {
$this->set_visibility($setting->get_visibility());
$this->set_status($setting->get_status());
}
public function get_ui_info() {
// Return an array with all the ui info to be tested
return array($this->ui_type, $this->ui_label, $this->ui_values, $this->ui_options);
}
}
/**

View File

@ -49,6 +49,9 @@ abstract class xml_output {
protected $running; // To know if output is running
/** @var string|float finish microtime. */
protected $finishtime;
public function __construct($usebuffer = true) {
$this->inittime = microtime(true);
$this->finishtime = $this->inittime;

View File

@ -85,7 +85,6 @@ class progressive_parser {
$this->file = null;
$this->contents = null;
$this->procesor = null;
$this->level = 0;
$this->path = '';
$this->accum = '';