Introduction

This book is a book about how to install, use, manage, and extend a wiki using MediaWiki, the wiki engine used to power one of the world's most famous wikis, Wikipedia.

Wikis are the sleeper hit of the Internet, with roots that extend far back into the old days—the very first wiki deployed by wiki inventor Ward Cunningham was released to the world on March 25, 1995. (It can still be found at http://c2.com/cgi/wiki, with an informative history of those early days at http://c2.com/cgi/wiki?WikiHistory.) After that release, wikis crept along with an enthusiastic but narrowly defined group of devotees, programmers working on project teams who used wikis for software documentation. Credit for the sudden turn-around in fame (if not fortune) for wikis is certainly due to Wikipedia, the online encyclopedia that nearly anyone can contribute to and edit.

According to Wikipedia, this wiki started on January 15, 2001. At the time of this writing, there are well over 1.5 million English language articles and over 3 million user accounts. You can find the latest statistics at http://en.wikipedia.org/wiki/Special:Statistics.

In late 2005, Wikipedia garnered a bit of negative publicity as the result of a few bad posts, but on December 14, 2005, the well-respected scientific journal Nature published a report that found that Wikipedia's accuracy was comparable to the accuracy of Encyclopedia Britannica. As one might expect, this generated some protestations from Encyclopedia Britannica. As far as I'm concerned, the jury is still out and I'm not inclined to get into the fray. What I do know for certain, however, is that Wikipedia is extremely useful—it's free, and, for the vast majority of topics, it is accurate.

You can read about the controversy at www.nature.com/news/2005/051212/full/438900a.html.

The success of Wikipedia has served as an eye-opening example of just how effective wikis can be for collaborative editing on a large scale—much larger than many people (including me) thought possible. It shows that wikis can be used effectively in environments beyond that of the IT workgroup. At the same time, wikis have not fully entered the mainstream. The looks my talented but non-technical friends and colleagues would give me when I told them I was working on a book about wikis provides at least some anecdotal evidence that wikis are not yet as famous as iPods or Britney Spears' C-section scar.

Nevertheless, because of the fame (or notoriety) of Wikipedia, the open-source software package called MediaWiki that runs Wikipedia is becoming an increasingly popular package for developing wikis. It is by no means the only wiki application on the open-source market, but it is a good one, and one would be hard-pressed to find another wiki engine as widely used.

Who Should Read This Book

Wikis can be a valuable addition for any organization that wants to increase productivity using Web-based collaboration tools. The ideal reader of this book is a programmer or technical professional planning to implement a MediaWiki-powered wiki. The difference between a programmer and an author or a designer isn't as clearly defined as it used to be. The audience is not a particular profession. Web developers, information architects, designers, and content authors can all benefit from reading this book.

The brilliance of wikis is their simplicity. You can install and operate a very useful wiki without any detailed technical knowledge of the underlying system. That being said, the reader of this book does need to have certain technical skills to make the most of it. Familiarity with the World Wide Web, and solid knowledge of HTML, XML and CSS are essential. MediaWiki is written in PHP, and uses MySQL or PostgreSQL databases on the back-end. While much benefit can still be derived without PHP or SQL skills, basic programming knowledge is a necessity.

This is a book about MediaWiki—it's not a book about HTML, XML, CSS, PHP, MySQL, PostgreSQL, or anything else. Therefore, I will assume knowledge in all of these areas. If you are not familiar with these technologies, I can recommend the following books:

  • Web Standards Programmer's Reference: HTML, CSS, JavaScript, Perl, Python, and PHP, by Steven M. Schafer (Wrox, 2005)

  • Beginning PHP5, Apache, and MySQL Web Development, by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, and Michael K. Glass (Wrox, 2005)

MediaWiki runs on Macintosh, Windows, or Linux platforms. The examples used in this book were written using MediaWiki 1.9.3, Apache 1.3.33, MySQL 4.1.10, and PHP 5.2, as well as the environment provided by the PHP Development Tool (PDT) plug-in for Eclipse 3.2 from Zend. Minimum requirements to run MediaWiki 1.9 are MySQL 4.0 or later and PHP 5.0 or later, although the developers recommend PHP 5.1.

How This Book Is Organized

This book has been organized in a natural way so that each chapter builds on previous chapters. The book is designed so that it moves from simpler tasks to those of increasing complexity.

Chapter 1: Wikis at Work

The most common question I get about wikis in my consulting practice is the question of when to use wikis, rather than a more formal content management system. The answer to this question depends on what you need to accomplish. This chapter introduces and defines wikis, and discusses how wikis are different from other content management systems. You will learn about how wikis are being used by different organizations and when the use of a wiki is your best strategy, or when you should look at other alternatives.

If you've already determined that you need (or want) a wiki, the next step is to decide how to implement your wiki. As a consequence of their simplicity and utility, many varieties of open-source wiki engines have sprouted all over the Web. There is also a growing number of commercial wiki applications billing themselves as enterprise wikis. You will learn about common wiki features and which questions to ask yourself when evaluating wiki engines, including what to look for in order to avoid any unexpected pitfalls.

Chapter 2: Installing MediaWiki

In this chapter, installation of MediaWiki is covered in detail. I cover the most common installation methods, using Apache, PHP, and MySQL. I also explain the basic configuration requirements when first installing your wiki.

Chapter 3: Getting Started with MediaWiki

Chapter 3 introduces a guided tour of MediaWiki, including wiki terminology, and reveals the basic steps required to get up and running as a new user. You will learn about creating user accounts, creating new pages, understanding wiki links, and how to find your way around the wiki.

Chapter 4: Writing and Editing Content

The beating heart of a wiki is user-generated content. Chapter 4 documents the details of wikitext, the shorthand markup used by MediaWiki that enables authors to edit content from any Web browser, apply formatting, and easily create links to other wiki pages.

Chapter 5: Images and Files

In addition to writing wikitext, users can upload images and files. In this chapter, you will learn how to configure MediaWiki to support image and file uploads, as well as how to refer to them using wikitext.

Chapter 6: Page Actions and Version Control

A user can do more than just edit a page. He or she can comment on pages, move them, track changes, use trackbacks to comment on them in their blog, and syndicate their wiki page with RSS. Some pages can also be protected from other users. There is also a class of pages called Special Pages that provide users with interesting information about the wiki itself, and that can be used to manage the site.

Chapter 7: Information Architecture: Organizing Your Wiki

The architecture of a site defines how a user finds the information he or she is looking for by following links or performing searches. Wikis take a different approach to information architecture than most websites—they have a flat hierarchy, and rely on a folksonomic form of categorization. This chapter focuses on navigation and search, and includes expanded coverage on categories, subpages, customizing namespaces, disambiguation, and using external search facilities.

Chapter 8: Magic Words, Templates, and Skins

The look and feel of a wiki is defined by what Wikipedia calls a skin, which is a combination of HTML, CSS, and PHP classes. In this chapter you will learn how to modify the default MediaWiki skin, as well as how to create a new one. In addition to learning how to modify the design of a site, you will also learn how to insert additional content on pages using magic words, a general term used by MediaWiki to cover a few different kinds of template elements.

Chapter 9: Extensions

Chapter 9 covers more advanced topics, including extending MediaWiki by creating new tags, parser functions, as well as extending or modifying the basic functionality of MediaWiki using hooks.

Chapter 10: The MediaWiki API

Bots are applications that can interact with MediaWiki wikis. In Chapter 10, the use of one such bot, called pywikipediabot, is introduced. External applications and systems can also interact with MediaWiki using a ReST style API. This chapter covers the functionality that can be accessed through the API and provides examples of how that functionality can be leveraged for your benefit.

Chapter 11: Wiki Performance

MediaWiki uses a many-layered approach to cacheing, an understanding of which is essential for running a wiki with acceptable performance characteristics. Chapter 11 explains MediaWiki's cacheing strategy.

Where to Find More Information

Programmers use wikis to document programming projects. Because MediaWiki is a programming project, it should come as no surprise that MediaWiki uses a wiki to document itself. The information available on the site varies with respect to timeliness—some of the information is out of date, but enough of it is current to make it useful. MediaWiki is also a dynamic project, always evolving, so there will likely be many new additions to the application in the future, and this is a good place to start.

Most documentation can be found on the MediaWiki website at www.mediawiki.org. You can also learn more about the Wikipedia family of sites and find information relevant to all users of MediaWiki software on http://meta.wikipedia.org. I also regularly write about wikis and blogs on my own blog at http://choate.info/.

You can also find plenty of friendly folks willing to answer your questions. Look on the #mediawiki IRC channel hosted on Freenode.net, or you can subscribe to the MediaWiki mailing list at http://lists.wikimedia.org/mailman/listinfo/mediawiki-l.

Conventions

To help you get the most from the text and keep track of what's happening, we've used a number of conventions throughout the book.

Tips, hints, tricks, and asides to the current discussion are offset and placed in italics like this.

As for styles in the text:

  • We highlight new terms and important words when we introduce them.

  • We show keyboard strokes like this: Ctrl + A.

  • We show filenames, URLs, and code within the text like so: persistence.properties.

  • We present code in two different ways:

    In code examples we highlight new and important code with a gray background.
    The gray highlighting is not used for code that's less important in the present context, or has been shown before.

Source Code

As you work through the examples in this book, you may choose either to type in all the code manually or to use the source code files that accompany the book. All of the source code used in this book is available for download at www.wrox.com. Once at the site, simply locate the book's title (either by using the Search box or by using one of the title lists) and click the Download Code link on the book's detail page to obtain all the source code for the book.

Because many books have similar titles, you may find it easiest to search by ISBN; this book's ISBN is 978-0-470-12690-5.

Once you download the code, just decompress it with your favorite compression tool. Alternately, you can go to the main Wrox code download page at www.wrox.com/dynamic/books/download.aspx to see the code available for this book and all other Wrox books.

Errata

We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you find an error in one of our books, such as a spelling mistake or faulty piece of code, we would be very grateful for your feedback. By sending in errata you may save another reader hours of frustration, and at the same time you will be helping us provide even higher quality information.

To find the errata page for this book, go to www.wrox.com and locate the title using the Search box or one of the title lists. Then, on the book's details page, click the Book Errata link. On this page you can view all errata that has been submitted for this book and posted by Wrox editors. A complete book list, including links to each book's errata, is also available at www.wrox.com/misc-pages/booklist.shtml.

If you don't spot "your" error on the Book Errata page, go to www.wrox.com/contact/techsupport.shtml and complete the form there to send us the error you have found. We'll check the information and, if appropriate, post a message to the book's errata page and fix the problem in subsequent editions of the book.

p2p.wrox.com

For author and peer discussion, join the P2P forums at p2p.wrox.com. The forums are a Web-based system for you to post messages relating to Wrox books and related technologies and to interact with other readers and technology users. The forums offer a subscription feature to e-mail you topics of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums.

At http://p2p.wrox.com you will find a number of different forums that will help you not only as you read this book, but also as you develop your own applications. To join the forums, just follow these steps:

  1. Go to p2p.wrox.com and click the Register link.

  2. Read the terms of use and click Agree.

  3. Complete the required information to join as well as any optional information you wish to provide and click Submit.

  4. You will receive an e-mail with information describing how to verify your account and complete the joining process.

You can read messages in the forums without joining P2P but to post your own messages, you must join.

Once you join, you can post new messages and respond to messages other users post. You can read messages at any time on the Web. If you would like to have new messages from a particular forum e-mailed to you, click the Subscribe to this Forum icon by the forum name in the forum listing.

For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to questions about how the forum software works as well as many common questions specific to P2P and Wrox books. To read the FAQs, click the FAQ link on any P2P page.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.67.203