-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Document use of legacyclasses.php
- Loading branch information
1 parent
08ac38b
commit 2f7195d
Showing
6 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!-- markdownlint-disable first-line-heading --> | ||
Details of legacy classes that have been moved to the classes directory to support autoloading but are not yet named properly. | ||
|
||
:::note | ||
|
||
Adding classes to `db/legacyclasses.php` is only necessary when the class is part of a _public_ API, or the class name cannot be changed. | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright (c) Moodle Pty Ltd. | ||
* | ||
* Moodle is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Moodle is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import React from 'react'; | ||
import { ComponentFileSummary } from '../../_utils'; | ||
import type { Props } from '../../_utils'; | ||
import DefaultDescription from './db-legacyclasses-php.mdx'; | ||
|
||
const defaultExample = ` | ||
defined('MOODLE_INTERNAL') || die; | ||
$legacyclasses = [ | ||
'old_class_name' => 'path/within/classes/directory.php', | ||
// Examples: | ||
\\coding_exception::class => 'exception/coding_exception.php', | ||
\\moodle_exception::class => 'exception/moodle_exception.php', | ||
]; | ||
`; | ||
|
||
export default (initialProps: Props): ComponentFileSummary => ( | ||
<ComponentFileSummary | ||
refreshedDuringPurge | ||
defaultExample={defaultExample} | ||
defaultDescription={DefaultDescription} | ||
filepath="/db/legacyclasses.php" | ||
summary="Legacy classes" | ||
examplePurpose="Legacy classes" | ||
{...initialProps} | ||
/> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters