|Warning:||This script has been removed in MediaWiki 1.30 with commit phabricator:rMW918e4c394c424a287f32853b2967b0c8d4dfc97c.|
|Αρχείο MediaWiki: deleteRevision.php|
|Πηγαίος κώδικας:||master • 1.34.1 • 1.33.3 • 1.31.7|
deleteRevision.php file is a maintenance script to delete one or more revisions by moving them to the archive table. This makes the revision disappear from the public version of the wiki. If this achieves the expected result, the deleteArchivedRevisions.php script can be used to completely remove the revision from the database.
To find the ID of the revision to delete, look at the URL for each date on the history page. It will look something like
http://yourwiki/index.php?title=Page_Title&oldid=1234. The revision ID is the
oldid, 1234 in this example. This revision can be deleted like so:
php maintenance/deleteRevision.php 1234
If you want to remove multiple revisions, separate them with a space:
php maintenance/deleteRevision.php 1234 5678
Διαγραφή της τρέχουσας αναθεώρησης της σελίδας
This script can also be used to delete the current revision of a page. In this case the script takes care to update the page record to point to the correct revision again: It updates the page_latest field of the according page in the page table. It will sort the available revisions by rev_timestamp and will set page_latest to the revision with the newest timestamp. This makes sure that database integrity is preserved.
Καθορισμός της rev_parent_id πεδίο
The script does not update the rev_parent_id field of that revision, which is following the deleted one. That way e.g. size differences in page histories will be calculated incorrectly as MediaWiki still tries to calculate them based on the revision, which got deleted. So it gets a size of 0 bytes for that revision and accordingly a wrong value for the size difference.
Currently this can only be fixed manually by manually updating the rev_parent_id field of the revision, which is following the deleted one. An issue should be created in the bugtracker and this problem be fixed properly.
Until this problem is fixed, the following queries can be used to spot pages with broken rev_parent_id:
SELECT * FROM revision where rev_parent_id != "0" and rev_parent_id NOT IN ( SELECT DISTINCT (rev_id) FROM revision ) order by rev_page, rev_id;
This displays a list with the affected pages (rev_page) and the problematic revisions (rev_id). Use the value from rev_page in the following query:
SET @seite = 4711; # Displaying basic information about that page: SELECT * FROM page where page_id = @seite; # Selecting the revisions: SELECT rev_page, rev_id, rev_parent_id, rev_user_text, rev_user_text FROM revision where rev_page=@seite order by rev_id;
This displays a list of revisions for the according page (here for page 4711), sorted by rev_id. Scroll down to the problematic revision and fix its rev_parent_id value so that it points to the previous revision (rev_id value of the next-older row in the result set).
The parent revision of the very first revision of a page always is revision 0.