Oops. I'm sorry about this huge patch that is mostly whitespace changes.
Here is the patch with whitespace changes ignored.
Index: index.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/index.php,v
retrieving revision 1.35
diff -u -b -r1.35 index.php
--- index.php 28 Jun 2004 17:46:49 -0000 1.35
+++ index.php 8 Jul 2004 14:41:04 -0000
@@ -108,6 +108,7 @@
case "rollback":
case "protect":
case "unprotect":
+ case "info":
$wgArticle->$action();
break;
case "print":
Index: includes/Article.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/Article.php,v
retrieving revision 1.175
diff -u -b -r1.175 Article.php
--- includes/Article.php 28 Jun 2004 20:24:23 -0000 1.175
+++ includes/Article.php 8 Jul 2004 14:41:04 -0000
@@ -1124,12 +1124,14 @@
$protcom = '';
if ( $limit === '' ) {
+ $wgOut->setPageTitle( wfMsg( 'confirmunprotect' ) );
$wgOut->setSubtitle( wfMsg( 'unprotectsub', $sub ) );
$wgOut->addWikiText( wfMsg( 'confirmunprotecttext' ) );
$check = htmlspecialchars( wfMsg( 'confirmunprotect' ) );
$protcom = htmlspecialchars( wfMsg( 'unprotectcomment' ) );
$formaction = $this->mTitle->escapeLocalURL( 'action=unprotect' . $par
);
} else {
+ $wgOut->setPageTitle( wfMsg( 'confirmprotect' ) );
$wgOut->setSubtitle( wfMsg( 'protectsub', $sub ) );
$wgOut->addWikiText( wfMsg( 'confirmprotecttext' ) );
$check = htmlspecialchars( wfMsg( 'confirmprotect' ) );
@@ -1820,6 +1822,76 @@
/* static */ function onArticleEdit($title_obj){
LinkCache::linksccClearPage( $title_obj->getArticleID() );
}
+
+ # Info about this page
+
+ function info()
+ {
+ global $wgUser, $wgTitle, $wgOut, $wgLang;
+
+ $basenamespace = $wgTitle->getNamespace() & (~1);
+ $cur_clause = "cur_title='".$wgTitle->getDBkey()."' AND
cur_namespace=".$basenamespace;
+ $old_clause = "old_title='".$wgTitle->getDBkey()."' AND
old_namespace=".$basenamespace;
+ $wl_clause = "wl_title='".$wgTitle->getDBkey()."' AND
wl_namespace=".$basenamespace;
+ $fullTitle = $wgTitle->makeName($basenamespace, $wgTitle->getDBKey());
+ $wgOut->setPagetitle( $fullTitle );
+ $wgOut->setSubtitle( wfMsg( "infosubtitle" ));
+
+ # first, see if the page exists at all.
+ $sql = "SELECT COUNT(*) FROM cur WHERE ".$cur_clause;
+ $exists = wfSingleQuery( $sql , DB_READ );
+ if ($exists < 1) {
+ $wgOut->addHTML( wfMsg("noarticletext") );
+ } else {
+ $sql = "SELECT COUNT(*) FROM watchlist WHERE ".$wl_clause;
+ $wgOut->addHTML( "<ul><li>" . wfMsg("numwatchers")
. wfSingleQuery( $sql, DB_READ ) . "</li>" );
+ $sql = "SELECT COUNT(*) FROM old WHERE ".$old_clause;
+ $old = wfSingleQuery( $sql, DB_READ );
+ $wgOut->addHTML( "<li>" . wfMsg("numedits") . ($old + 1)
. "</li>");
+
+ # to find number of distinct authors, we need to do some
+ # funny stuff because of the cur/old table split:
+ # - first, find the name of the 'cur' author
+ # - then, find the number of *other* authors in 'old'
+
+ # find 'cur' author
+ $sql = "SELECT cur_user_text FROM cur WHERE ".$cur_clause;
+ $cur_author = wfSingleQuery( $sql, DB_READ );
+
+ # find number of 'old' authors excluding 'cur' author
+ $sql = "SELECT COUNT(DISTINCT old_user_text) FROM old WHERE ".$old_clause
+ ." AND old_user_text<>'" . $cur_author . "'";
+ $authors = wfSingleQuery( $sql, DB_READ ) + 1;
+
+ # now for the Talk page ...
+ $cur_clause = "cur_title='".$wgTitle->getDBkey()."' AND
cur_namespace=".($basenamespace+1);
+ $old_clause = "old_title='".$wgTitle->getDBkey()."' AND
old_namespace=".($basenamespace+1);
+
+ # does it exist?
+ $sql = "SELECT COUNT(*) FROM cur WHERE ".$cur_clause;
+ $exists = wfSingleQuery( $sql , DB_READ );
+
+ # number of edits
+ if ($exists > 0) {
+ $sql = "SELECT COUNT(*) FROM old WHERE ".$old_clause;
+ $old = wfSingleQuery( $sql, DB_READ );
+ $wgOut->addHTML( "<li>" . wfMsg("numtalkedits") . ($old
+ 1) . "</li>");
+ }
+ $wgOut->addHTML( "<li>" . wfMsg("numauthors") . $authors
. "</li>" );
+
+ # number of authors
+ if ($exists > 0) {
+ $sql = "SELECT cur_user_text FROM cur WHERE ".$cur_clause;
+ $cur_author = wfSingleQuery( $sql, DB_READ );
+
+ $sql = "SELECT COUNT(DISTINCT old_user_text) FROM old WHERE "
+ .$old_clause." AND old_user_text<>'" . $cur_author .
"'";
+ $authors = wfSingleQuery( $sql, DB_READ ) + 1;
+
+ $wgOut->addHTML( "<li>" . wfMsg("numtalkauthors") .
$authors . "</li></ul>" );
+ }
+ }
+ }
}
?>
Index: includes/DatabaseFunctions.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/DatabaseFunctions.php,v
retrieving revision 1.36
diff -u -b -r1.36 DatabaseFunctions.php
--- includes/DatabaseFunctions.php 22 Jun 2004 08:54:26 -0000 1.36
+++ includes/DatabaseFunctions.php 8 Jul 2004 14:41:04 -0000
@@ -39,6 +39,15 @@
}
}
+function wfSingleQuery( $sql, $db, $fname = "" )
+{
+ $res = wfQuery($sql, $db, $fname );
+ $row = wfFetchRow( $res );
+ $ret = $row[0];
+ wfFreeResult( $res );
+ return $ret;
+}
+
function &wfGetDB( $db = DB_LAST )
{
global $wgLoadBalancer;
Index: includes/OutputPage.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/includes/OutputPage.php,v
retrieving revision 1.152
diff -u -b -r1.152 OutputPage.php
--- includes/OutputPage.php 19 Jun 2004 06:46:54 -0000 1.152
+++ includes/OutputPage.php 8 Jul 2004 14:41:04 -0000
@@ -120,7 +120,7 @@
case 'history':
return wfMsg('history_short');
case 'protect':
- return wfMsg('unprotect');
+ return wfMsg('protect');
case 'unprotect':
return wfMsg('unprotect');
case 'delete':
@@ -131,6 +131,8 @@
return wfMsg('unwatch');
case 'submit':
return wfMsg('preview');
+ case 'info':
+ return wfMsg('info_short');
default:
return '';
}
Index: languages/Language.php
===================================================================
RCS file: /cvsroot/wikipedia/phase3/languages/Language.php,v
retrieving revision 1.257
diff -u -b -r1.257 Language.php
--- languages/Language.php 5 Jul 2004 21:26:35 -0000 1.257
+++ languages/Language.php 8 Jul 2004 14:41:04 -0000
@@ -260,6 +260,7 @@
'go' => 'Go',
"history" => 'Page history',
'history_short' => 'History',
+'info_short' => 'Information',
'printableversion' => 'Printable version',
'edit' => 'Edit',
'editthispage' => 'Edit this page',
@@ -1307,6 +1308,14 @@
'categoryarticlecount' => "There are $1 articles in this
category.",
'usenewcategorypage' => "1\n\nSet first character to \"0\" to
disable the new category page layout.",
+# Info page
+"infosubtitle" => "Information for page",
+"numedits" => "Number of edits (article): ",
+"numtalkedits" => "Number of edits (discussion page): ",
+"numwatchers" => "Number of watchers: ",
+"numauthors" => "Number of distinct authors (article): ",
+"numtalkauthors" => "Number of distinct authors (discussion page):
",
+
# Monobook.js: tooltips and access keys for monobook
'Monobook.js' => '/* tooltips and access keys */
ta = new Object();