Backing up the wiki: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(Created page with "== Backing up the wiki == Any confirmed user on this wiki is able to create an XML, JSON or image backup with Special:DataDump.<!-- Depending on settings in Special:Manage...")
 
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Backing up the wiki ==
=== WikiTeam3 ===
You can easily generate a database dump and file dump using Save the Web Project's [https://github.com/saveweb/wikiteam3/ WikiTeam3] Python script, (full instructions are at that link).
Any confirmed user on this wiki is able to create an XML, JSON or image backup with [[Special:DataDump]].<!-- Depending on settings in Special:ManageWiki. -->


{{note|<nowiki>Windows: When using --images, because NTFS does not allow characters such as :*?"<>| in filenames, some files may not be downloaded, please check the errors.log file.</nowiki>}}
Basic site info, such as a list of the extensions in use, is downloaded to the JSON file. The XML dump does not contain user accounts, etc.


e.g. <code><nowiki>wikiteam3dumpgenerator https://WIKINAME.miraheze.org --xml --xmlrevisions --images --bypass-cdn-image-compression --force</nowiki></code>
=== WikiTeam's dumpgenerator.py ===
Another method is to use the [https://github.com/WikiTeam/wikiteam WikiTeam] Python (only with version 2) [https://raw.githubusercontent.com/WikiTeam/wikiteam/master/dumpgenerator.py dumpgenerator.py] script from the command-line.


To dump a private wiki you will have to use a login that has at least read permission on the wiki.
Example usage, this will produce a JSON file, an XML dump with page histories and a folder of files:<br /><code><nowiki>python2 dumpgenerator.py --xmlrevisions --xml --images --api=https://sdiy.info/w/api.php</nowiki></code>


e.g. <code><nowiki>wikiteam3dumpgenerator https://WIKINAME.miraheze.org --xml --xmlrevisions --images --bypass-cdn-image-compression --force --user USER --pass PASSWORD</nowiki></code>
However large wikis may fail to export leaving an incomplete XML dump. The presence of a siteinfo.json file probably indicates a succesful XML dump.


* --xml exports an XML dump, uses Special:Export by default when no other xmldump method is specified.
Full instructions are at the WikiTeam [https://github.com/WikiTeam/wikiteam/wiki/Tutorial tutorial].
* --xmlrevisions uses API:Allrevisions xmldump method. Recommended as it's quicker and puts almost no pressure on the MediaWiki backend compared to Special:Export.
* --images generates an image dump
* --bypass-cdn-image-compression appends random parameters to URL when downloading image
* --force generates a dump even if there is one already at Internet Archive


If you encounter any problem with running the script, please [https://github.com/saveweb/wikiteam3/issues raise a new issue] at the Save the Web Project's [https://github.com/saveweb/wikiteam3/ saveweb/WikiTeam3] GitHub repository.
== Restoring from backup ==<!-- untested -->
''See [https://www.mediawiki.org/wiki/MediaWiki MediaWiki.org] for more detailed instructions, (specifically [https://www.mediawiki.org/wiki/Manual:Importing_XML_dumps Manual:Importing XML dumps]'' and ''[https://www.mediawiki.org/wiki/Manual:ImportImages.php Manual:importImages.php]).''


== Restoring from backup ==
After installing MediaWiki and extensions, in the shell use importDump.php to import the XML, this can take a long time. e.g. from the mediawiki folder<br /><code>php maintenance/importDump.php --conf LocalSettings.php --dry-run < ''your_dumpfile.xml''</code>
See [https://www.mediawiki.org/wiki/MediaWiki MediaWiki.org], specifically [https://www.mediawiki.org/wiki/Manual:Importing_XML_dumps Manual:Importing XML dumps] and [https://www.mediawiki.org/wiki/Manual:ImportImages.php Manual:importImages.php].''


== External links ==
If that works repeat without --dry-run. It won't matter if the XML dump file has the file extension .gz or .bz2 (is compressed).
* [https://meta.miraheze.org/wiki/Backups Backups], Miraheze Meta

* [https://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki Manual:Backing up a wiki], MediaWiki
Due to the bug [https://phabricator.wikimedia.org/T206683 T206683] it may be necessary to also include <code>--user-prefix=""</code> in the command.

Afterwards use ImportImages.php to import the images<br /><code>php maintenance/importImages.php ''your_files''/</code>

Afterwards run <code>php maintenance/rebuildrecentchanges.php</code> in order to update the content of Special:Recentchanges.


[[Category:Meta]]
[[Category:Meta]]

Latest revision as of 10:18, 1 July 2024

WikiTeam3

You can easily generate a database dump and file dump using Save the Web Project's WikiTeam3 Python script, (full instructions are at that link).

 Windows: When using --images, because NTFS does not allow characters such as :*?"<>| in filenames, some files may not be downloaded, please check the errors.log file.

e.g. wikiteam3dumpgenerator https://WIKINAME.miraheze.org --xml --xmlrevisions --images --bypass-cdn-image-compression --force

To dump a private wiki you will have to use a login that has at least read permission on the wiki.

e.g. wikiteam3dumpgenerator https://WIKINAME.miraheze.org --xml --xmlrevisions --images --bypass-cdn-image-compression --force --user USER --pass PASSWORD

  • --xml exports an XML dump, uses Special:Export by default when no other xmldump method is specified.
  • --xmlrevisions uses API:Allrevisions xmldump method. Recommended as it's quicker and puts almost no pressure on the MediaWiki backend compared to Special:Export.
  • --images generates an image dump
  • --bypass-cdn-image-compression appends random parameters to URL when downloading image
  • --force generates a dump even if there is one already at Internet Archive

If you encounter any problem with running the script, please raise a new issue at the Save the Web Project's saveweb/WikiTeam3 GitHub repository.

Restoring from backup

See MediaWiki.org, specifically Manual:Importing XML dumps and Manual:importImages.php.

External links