User:PeerInfinity/Scripts/SyncArticleLinks Instructions
< User:PeerInfinity | Scripts
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.
- Install PHP, if it isn't already installed. Just install all of the optional packages,
- Make a folder on your PC to use for running the scripts.
- Copy the file SyncArticleLinks.php into this folder
- If you're on a Windows PC, then make a .bat file containing the following one line:
- php SyncArticleLinks.php
- 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.
- 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.)
- 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?)
- optional: replace double-newlines with single-newlines
- copy this list of pages into the Special:Export page.
- click the Export button. don't close this tab in your browser yet, we'll be using it again.
- save the XML file to your script folder, and rename it to daily_XML_dump.xml
- now run the script file with the command "php SyncArticleLinks.php", or by running the batch file, if you created one
- This should take just a few seconds, and will generate the following files:
- SyncArticleLinksOutput.txt
- RecentPosts.txt
- AllArticles.txt
- Debug.txt
- copy the contents of the SyncArticleLinksOutput.txt file to the SyncArticleLinksOutput.txt page on the wiki.
- either save the page, or just press the preview button.
- the page will show you a list of things to clean up, but leave this alone for now.
- open the Less Wrong/2010 Articles page on the wiki, and click Edit
- scroll down to the bottom, and copy the line with the title of the last article
- open the RecentPosts.txt fine in a text editor
- search the file for the line you just copied
- copy everything after this line, and paste it to the Less Wrong/2010 Articles page on the wiki
- press the Show Preview button to make sure the formatting is correct, then press Save.
- 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.
- re-download the updated XML file to your script folder, and rename it to daily_XML_dump.xml again, overwriting the previous copy
- run the script again
- copy the contents of the SyncArticleLinksOutput.txt file to the SyncArticleLinksOutput.txt page on the wiki again.
- either save the page, or just press the preview button again
- there will be less entries this time, because the All Articles page is up to date.
- now you can start fixing the issues listed on this page.
- 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.
- if the links in the "all articles" pages are out of date, then you can replace them with the contents of AllArticles.txt