Manual:DoMaintenance.php

From mediawiki.org
This page is a translated version of the page Manual:DoMaintenance.php and the translation is 50% complete.
Versão MediaWiki:
1.16

Detalhes

O arquivo doMaintenance.php é um script de manutenção para verificar os arquivos mais importantes e executar algumas tarefas automaticamente.

Usage

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.

See also