MDL-81960 core: Update namespace of progress_trace classes

This commit is contained in:
Andrew Nicols 2024-06-11 12:44:38 +08:00
parent a9869ff0a7
commit b6d08ad1d7
No known key found for this signature in database
GPG Key ID: 6D1E3157C8CFBF14
9 changed files with 96 additions and 4 deletions

View File

@ -2,6 +2,28 @@ issueNumber: MDL-81960
notes:
core:
- message: >-
The `\moodle_url` class has been renamed to `\core\url` and now supports
autoloading. Existing uses are currently unaffected.
The following classes have been renamed and now support autoloading.
Existing classes are currently unaffected.
| Old class name | New class name |
| --- | --- |
| `\moodle_url` | `\core\url` |
| `\progress_trace` | `\core\output\progress_trace` |
| `\combined_progress_trace` | `\core\output\progress_trace\combined_progress_trace` |
| `\error_log_progress_trace` | `\core\output\progress_trace\error_log_progress_trace` |
| `\html_list_progress_trace` | `\core\output\progress_trace\html_list_progress_trace` |
| `\html_progress_trace` | `\core\output\progress_trace\html_progress_trace` |
| `\null_progress_trace` | `\core\output\progress_trace\null_progress_trace` |
| `\progress_trace_buffer` | `\core\output\progress_trace\progress_trace_buffer` |
| `\text_progress_trace` | `\core\output\progress_trace\text_progress_trace` |
type: improved

View File

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\output;
/**
* Progress trace class.
*
@ -42,3 +44,8 @@ abstract class progress_trace {
public function finished() {
}
}
// Alias this class to the old name.
// This file will be autoloaded by the legacyclasses autoload system.
// In future all uses of this class will be corrected and the legacy references will be removed.
class_alias(progress_trace::class, \progress_trace::class);

View File

@ -14,6 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\output\progress_trace;
use core\output\progress_trace;
/**
* Special type of trace that can be used for redirecting to multiple other traces.
*
@ -21,7 +25,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core
*/
class combined_progress_trace extends progress_trace {
class combined_progress_trace extends \progress_trace {
/**
* Constructs a new instance.
*
@ -50,3 +54,8 @@ class combined_progress_trace extends progress_trace {
}
}
}
// Alias this class to the old name.
// This file will be autoloaded by the legacyclasses autoload system.
// In future all uses of this class will be corrected and the legacy references will be removed.
class_alias(combined_progress_trace::class, \combined_progress_trace::class);

View File

@ -14,6 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\output\progress_trace;
use core\output\progress_trace;
/**
* This subclass of progress_trace outputs to error log.
*
@ -41,3 +45,8 @@ class error_log_progress_trace extends progress_trace {
error_log($this->prefix . str_repeat(' ', $depth) . $message);
}
}
// Alias this class to the old name.
// This file will be autoloaded by the legacyclasses autoload system.
// In future all uses of this class will be corrected and the legacy references will be removed.
class_alias(error_log_progress_trace::class, \error_log_progress_trace::class);

View File

@ -14,6 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\output\progress_trace;
use core\output\progress_trace;
/**
* HTML List Progress Tree
*
@ -59,3 +63,8 @@ class html_list_progress_trace extends progress_trace {
}
}
}
// Alias this class to the old name.
// This file will be autoloaded by the legacyclasses autoload system.
// In future all uses of this class will be corrected and the legacy references will be removed.
class_alias(html_list_progress_trace::class, \html_list_progress_trace::class);

View File

@ -14,6 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\output\progress_trace;
use core\output\progress_trace;
/**
* This subclass of progress_trace outputs as HTML.
*
@ -31,3 +35,8 @@ class html_progress_trace extends progress_trace {
flush();
}
}
// Alias this class to the old name.
// This file will be autoloaded by the legacyclasses autoload system.
// In future all uses of this class will be corrected and the legacy references will be removed.
class_alias(html_progress_trace::class, \html_progress_trace::class);

View File

@ -14,6 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\output\progress_trace;
use core\output\progress_trace;
/**
* This subclass of progress_trace does not ouput anything.
*
@ -29,3 +33,8 @@ class null_progress_trace extends progress_trace {
): void {
}
}
// Alias this class to the old name.
// This file will be autoloaded by the legacyclasses autoload system.
// In future all uses of this class will be corrected and the legacy references will be removed.
class_alias(null_progress_trace::class, \null_progress_trace::class);

View File

@ -14,6 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\output\progress_trace;
use core\output\progress_trace;
/**
* Special type of trace that can be used for catching of output of other traces.
*
@ -21,7 +25,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core
*/
class progress_trace_buffer extends progress_trace {
class progress_trace_buffer extends \progress_trace {
/** @var string output buffer */
protected string $buffer = '';
@ -83,3 +87,8 @@ class progress_trace_buffer extends progress_trace {
return $this->buffer;
}
}
// Alias this class to the old name.
// This file will be autoloaded by the legacyclasses autoload system.
// In future all uses of this class will be corrected and the legacy references will be removed.
class_alias(progress_trace_buffer::class, \progress_trace_buffer::class);

View File

@ -14,6 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\output\progress_trace;
use core\output\progress_trace;
/**
* This subclass of progress_trace outputs to plain text.
*
@ -30,3 +34,8 @@ class text_progress_trace extends progress_trace {
mtrace(str_repeat(' ', $depth) . $message);
}
}
// Alias this class to the old name.
// This file will be autoloaded by the legacyclasses autoload system.
// In future all uses of this class will be corrected and the legacy references will be removed.
class_alias(text_progress_trace::class, \text_progress_trace::class);