Try to reduce the number of replicated entries in the DC metadata. Leave out
authorEvan Prodromou <evanprodromou@users.mediawiki.org>
Thu, 15 Apr 2004 22:28:38 +0000 (22:28 +0000)
committerEvan Prodromou <evanprodromou@users.mediawiki.org>
Thu, 15 Apr 2004 22:28:38 +0000 (22:28 +0000)
anonymous items, and then count them in a separate query. Also, leave out
the article's last editor.

includes/Metadata.php

index c549238..c8253c4 100644 (file)
@@ -109,7 +109,7 @@ function wfCreativeCommonsRdf($article) {
        dcElement('date', dcDate($article->getTimestamp()));
        dcPerson('creator', $article->getUser());
        
-       $contributors = dcContributors($article->mTitle);
+       $contributors = dcContributors($article);
        
        foreach ($contributors as $user_name => $cid) {
                dcPerson('contributor', $cid, $user_name);
@@ -217,19 +217,35 @@ function wfCreativeCommonsRdf($article) {
        }
 }
 
-/* private */ function dcContributors($title) {
-       
+/* private */ function dcContributors($article) {
+
+        $title = $article->mTitle;
+
        $contribs = array();
        
        $res = wfQuery("SELECT DISTINCT old_user,old_user_text" .
                       " FROM old " .
                       " WHERE old_namespace = " . $title->getNamespace() .
-                      " AND old_title = '" . $title->getDBkey() . "'", DB_READ);
+                      " AND old_title = '" . $title->getDBkey() . "'" .
+                       " AND old_user != 0 " .
+                       " AND old_user != " . $article->getUser(), DB_READ);
        
        while ( $line = wfFetchObject( $res ) ) {
                $contribs[$line->old_user_text] = $line->old_user;
        }    
-       
+
+        # Count anonymous users
+
+       $res = wfQuery("SELECT COUNT(*) AS cnt " .
+                      " FROM old " .
+                      " WHERE old_namespace = " . $title->getNamespace() .
+                      " AND old_title = '" . $title->getDBkey() . "'" .
+                       " AND old_user = 0 ", DB_READ);
+
+       while ( $line = wfFetchObject( $res ) ) {
+                $contribs[$line->cnt] = 0;
+       }    
+
        return $contribs;
 }