User:PeerInfinity/Scripts/SyncArticleLinks Instructions

From LessWrong
Jump to navigation Jump to search

To use the maintenance scripts:

I wanted to set up this process so that it could be entirely automated, but there are a few complications.

Here is the procedure for doing everything manually:

initial setup

This part only needs to be done once, to set up your PC to run the maintenance scripts.

  1. Install PHP, if it isn't already installed. Just install all of the optional packages,
  2. Make a folder on your PC to use for running the scripts.
  3. Copy the file SyncArticleLinks.php into this folder
  4. If you're on a Windows PC, then make a .bat file containing the following one line:
    1. php SyncArticleLinks.php
  5. When you run the script, the output files will be saved to this folder.


regular maintenance procedure

This is the part that needs to be done every time.

  1. open each of the Special:AllPages pages, and copy the list into a text editor. Just the pages in the main namespace, not in any of the others (talk, templates, etc.)
  2. replace tabs with newlines. (why doesn't MediaWiki have an option to format it this way automatically? and why doesn't it have an option to export all pages to a single file?)
  3. optional: replace double-newlines with single-newlines
  4. copy this list of pages into the Special:Export page.
  5. click the Export button. don't close this tab in your browser yet, we'll be using it again.
  6. save the XML file to your script folder, and rename it to daily_XML_dump.xml
  7. now run the script file with the command "php SyncArticleLinks.php", or by running the batch file, if you created one
  8. This should take just a few seconds, and will generate the following files:
    1. SyncArticleLinksOutput.txt
    2. RecentPosts.txt
    3. AllArticles.txt
    4. Debug.txt
  9. copy the contents of the SyncArticleLinksOutput.txt file to the SyncArticleLinksOutput.txt page on the wiki.
  10. either save the page, or just press the preview button.
  11. the page will show you a list of things to clean up, but leave this alone for now.
  12. open the Less Wrong/2010 Articles page on the wiki, and click Edit
  13. scroll down to the bottom, and copy the line with the title of the last article
  14. open the RecentPosts.txt fine in a text editor
  15. search the file for the line you just copied
  16. copy everything after this line, and paste it to the Less Wrong/2010 Articles page on the wiki
  17. press the Show Preview button to make sure the formatting is correct, then press Save.
  18. go back to the Export page, which should still be open in a tab in your browser, and should still have the list filled in.
  19. re-download the updated XML file to your script folder, and rename it to daily_XML_dump.xml again, overwriting the previous copy
  20. run the script again
  21. copy the contents of the SyncArticleLinksOutput.txt file to the SyncArticleLinksOutput.txt page on the wiki again.
  22. either save the page, or just press the preview button again
  23. there will be less entries this time, because the All Articles page is up to date.
  24. now you can start fixing the issues listed on this page.
  25. if you want to refresh the list of what's left to fix, then export a new XML file, run the script again, and copy the new SyncArticleLinksOutput.txt to the wiki.
  26. if the links in the "all articles" pages are out of date, then you can replace them with the contents of AllArticles.txt