Manual:Sql.php/pt-br

Versão MediaWiki:
1.10
Category:MediaWiki code/pt-br#Sql.php
Atenção Atenção: Since MediaWiki 1.28, sql.php may have some side effects. Please make sure you have run update.php and things do not break before running this script!

sql.php é um arquivo de manutenção que executa consultas SQL de um arquivo específico para o banco de dados. If you give an SQL file as the first argument, it will replace MediaWiki specific code comments like /*_*/ for the configured database prefix (among others). If you don't give it a file, then you can query the database in an interactive fashion, similar to the MySQL command line tool.

This script is often used if you want to upgrade MediaWiki, but have a large, master/replica-database setup and don't want any downtime. Instead of using update.php, you might use sql.php to apply database individual patches from sql/mysql directory on each sql server separately, taking the individual server out of rotation while the schema change runs. Generally you should only do this if you have to - most users should use the update.php script instead.

Options/Arguments

As opções disponíveis para este script a partir da linha de comando são:

OptionDescriptionRequired?
--queryRun a single query instead of running interactivelyOptional
--jsonOutput the results as JSON instead of PHP objectsOptional
--statusReturn successful exit status only if the query succeeded (selected or altered rows), otherwise 1 for errors, 2 for no rowsOptional
--clusterPermite que um nome de cluster seja fornecido para o comando.Optional
--wikidbPermite a um banco de dados diferente ser usado no comando pela ID, se não for o banco de dados atual.Optional
--replicadbReplica DB server to use instead of the primary DB (can be "any")Optional

Usage

php maintenance/run.php sql [ --query| --json| --status| --cluster| --wikidb| --replicadb ]
No MediaWiki versão 1.39.12 e anteriores, você deve invocar os scripts de manutenção usando php maintenance/scriptName.php em vez de php maintenance/run.php scriptName.

Interactive mode

Terminal

Inline query

Terminal

Applying patches

Terminal

Ver também

Category:Maintenance scripts/pt-br Category:Database maintenance scripts/pt-br
Category:Database maintenance scripts/pt-br Category:Maintenance scripts/pt-br Category:MediaWiki code/pt-br