Podręcznik:DeleteBatch.php

From mediawiki.org
This page is a translated version of the page Manual:DeleteBatch.php and the translation is 46% complete.
Outdated translations are marked like this.
Wersja MediaWiki:
1.7

Szczegóły

deleteBatch.php jest skryptem konserwacyjnym zlokalizowanym w katalogu maintenance, który pozwala na masowe kasowanie stron.

Uwaga Uwaga: When deleting pages with this script, users that are following pages being deleted will be notified by email about the deletion.

Options/Arguments

Opcja/Parametr Opis Required? Default
listfile Plik (zlokalizowany w katalogu maintenance), gdzie każda kolejna linia zawiera tytuł strony do usunięcia. Wymagane
--u Nazwa użytkownika, która będzie wyświetlania we wpisach logu. Jeżeli nie podano to będzie pokazana nazwa Delete page script. Optional Delete page script
--r Powód usunięć. Jeżeli puste, nie będą pokazywane powody w rejestrach. Optional
--i Liczba sekund pomiędzy usunięciem następnej strony. Optional 0

Użycie

php maintenance/deleteBatch.php somepages.txt [ --u| --r| --i ]

(Usunie to strony, których lista zawarta jest w pliku "somepages.txt")

Terminal

Na farmie wiki z połączonymi folderami, przejdź do folderu zawierającego LocalSettings.php i użyj:

php ./maintenance/deleteBatch.php  --conf ./LocalSettings.php --r "reason for deletion" ./deleteBatch.txt

Porady i wskazówki

In case the page titles contain special characters (like ä, ö, ü and so on), make sure to save the file in UTF-8 encoding. Otherwise the script may not be able to find the according page names inside the database!

You can create a pagelist with SQL as follows:

mysql -e "select page_title from page where page_touched between 20150431000000 and  20150519000000 and page_namespace = 0 into outfile '/tmp/pagelist.csv'"

This would create a list with all page titles touched between 2015-04-31 and 2015-05-19. This might be helpful if your wiki got attacked by spambots, and other edits happened during that time.

Other Namespaces

The above command only covers the Main namespace. The mysql database may not know the prefix name of other namespaces, so we have to do them one by one. For example, to delete all pages in the User namespace, with the deleteme category and no other text:

mysql -e "select concat('User:',p.page_title) from page p INNER JOIN revision r ON p.page_latest = r.rev_id INNER JOIN text t ON r.rev_text_id = t.old_id where t.old_text = '{{deleteme}}' and p.page_namespace = 2 into outfile '/tmp/deleteme-user.csv'"

Zobacz też