From: Evan Prodromou Date: Thu, 15 Apr 2004 22:28:38 +0000 (+0000) Subject: Try to reduce the number of replicated entries in the DC metadata. Leave out X-Git-Tag: 1.3.0beta1~411 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=076aa2d594efe5f4692d7bca39b6855f2d94f3d7;p=lhc%2Fweb%2Fwiklou.git Try to reduce the number of replicated entries in the DC metadata. Leave out anonymous items, and then count them in a separate query. Also, leave out the article's last editor. --- diff --git a/includes/Metadata.php b/includes/Metadata.php index c54923861b..c8253c4727 100644 --- a/includes/Metadata.php +++ b/includes/Metadata.php @@ -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; }