|
| 1 | +/** |
| 2 | + * Copyright (c) Moodle Pty Ltd. |
| 3 | + * |
| 4 | + * Moodle is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * Moodle is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | +import React from 'react'; |
| 18 | +import { ComponentFileSummary } from '../../_utils'; |
| 19 | +import type { Props } from '../../_utils'; |
| 20 | +import DefaultDescription from './db-legacyclasses-php.mdx'; |
| 21 | + |
| 22 | +const defaultExample = ` |
| 23 | +defined('MOODLE_INTERNAL') || die; |
| 24 | +
|
| 25 | +$legacyclasses = [ |
| 26 | + 'old_class_name' => 'path/within/classes/directory.php', |
| 27 | +
|
| 28 | + // Examples: |
| 29 | + \\coding_exception::class => 'exception/coding_exception.php', |
| 30 | + \\moodle_exception::class => 'exception/moodle_exception.php', |
| 31 | +
|
| 32 | + // Example loading a class from a different subsystem. |
| 33 | + // This should typically only be used in core. |
| 34 | + \\cache::class => [ |
| 35 | + 'core_cache', // The name of the subsystem to load from. |
| 36 | + 'cache.php', // The file name within that filesystem's classes directory. |
| 37 | + ], |
| 38 | +]; |
| 39 | +`; |
| 40 | + |
| 41 | +export default (initialProps: Props): ComponentFileSummary => ( |
| 42 | + <ComponentFileSummary |
| 43 | + refreshedDuringPurge |
| 44 | + defaultExample={defaultExample} |
| 45 | + defaultDescription={DefaultDescription} |
| 46 | + filepath="/db/legacyclasses.php" |
| 47 | + summary="Legacy classes" |
| 48 | + examplePurpose="Legacy classes" |
| 49 | + {...initialProps} |
| 50 | + /> |
| 51 | +); |
0 commit comments