手册:Maintenance.php
MediaWiki版本: | ≥ 1.16 |
MediaWiki文件: doMaintenance.php | |
---|---|
位置: | maintenance/ |
源代码: | master • 1.42.3 • 1.41.4 • 1.39.10 |
类: | 查找代码 • 查找帮助文档 |
细节
doMaintenance.php file is a maintenance script to verify the most important files and run some jobs automatically.
用法
When writing a maintenance script, add RUN_MAINTENANCE_IF_MAIN
to the end of file.
<?php
require_once __DIR__ . '/Maintenance.php';
class HelloWorld extends Maintenance {
public function execute() {
$this->output( "Hello, MediaWiki Devs!" );
}
}
$maintClass = HelloWorld::class;
require_once RUN_MAINTENANCE_IF_MAIN;
Here RUN_MAINTENANCE_IF_MAIN
loads doMaintenance.php
file which autoloads MediaWiki classes and configuration to run the script smoothly.