Wikipedia talk:WikiProject Mountains/List of mountains

From Wikipedia, the free encyclopedia

[edit] Re-generating the list

Originally, "What links here" was used to list them and the names extracted to build this list. However, as the list approached 500 entries, the extraction method needed to be changed to search a database dump imported into a local copy of an MySQL database. At the time, "What links here" only showed up to 500 links. However, recent Wikimedia software changes have increased the limit to 5,000 links.

[edit] Using What links here

First, you will need to install the Pywikipedia robot framework in order to quickly extract the links into a format that can be posted into the article.

  1. Get the list of links to {{Infobox Mountain}} by clicking the following link (if you are using tabs in Firefox, you might want to use the key combination to open the link in a new tab).
    http://en.wikipedia.org/w/index.php?title=Special:Whatlinkshere/Template:Infobox_Mountain&limit=5000
  2. Save the page as a local file (In Firefox, select "Save Page As..." from the File menu).
  3. Run the extract_wikilinks.py script in the Pywikipedia framework, giving it the name of the file you saved the page under in the previous step. Make sure you redirect the output to a file.
  4. Edit the file to remove the common site links in each page.
  5. Sort the file and redirect the output to another file (if you have a Unix based system such as Mac OS X or Linux, us the "sort" command).
  6. Edit the file and remove any pages in the Wikipedia, talk and user name spaces.
  7. Add a "# " to the start of each line. Again, if you have a Unix based system, you can use "vi" to do this: %s/^/# /
  8. Copy and paste the updated list into the List of mountains.

[edit] Using a database dump

To re-generate the list using a database dump:

  1. Install MySQL version 4.x.
  2. Download the latest version of the English database dump from http://download.wikipedia.org. You need a broadband connection or you might as well forget about it.
  3. Decompress the database dump using bzip2 (already installed on Mac OS X).
  4. Create a Wikipedia database:
    mysql -u [user name]
    create database wikipedia;
  5. Import the database dump (takes about two hours):
    mysql -u [user name]
    source 20050309_cur_table.sql;
  6. Run the following query (15-20 minutes) to extract articles that have {{mountain}} on their talk page:
    tee mountains.txt;
    select concat('#[[', cur_title, ']]') from cur where cur_namespace=1 and locate('{{Mountain}}',cur_text) > 0;
  7. Edit mountains.txt and format the file for Wikipedia use. If you are using vi, try:
    *%s/^| //
    *%s/\]\] *|$/\]\]/
  8. Copy and paste the updated list into this article.

You should have at least 10 GB of free disk space for accomodating the decompressed database dump and the database instance.