From: Brion Vibber Date: Tue, 13 Apr 2004 02:28:55 +0000 (+0000) Subject: Skip the user id lookup when we've already got the name from the old table check... X-Git-Tag: 1.3.0beta1~442 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=bd187a62a3110b7260cfabd602271d3ec787148a;p=lhc%2Fweb%2Fwiklou.git Skip the user id lookup when we've already got the name from the old table check; this also allows using the names on an imported database without users set up, but won't distinguish pre-conversion usernames for instance --- diff --git a/includes/Metadata.php b/includes/Metadata.php index ebc7164dc2..c54923861b 100644 --- a/includes/Metadata.php +++ b/includes/Metadata.php @@ -111,8 +111,8 @@ function wfCreativeCommonsRdf($article) { $contributors = dcContributors($article->mTitle); - foreach ($contributors as $cid) { - dcPerson('contributor', $cid); + foreach ($contributors as $user_name => $cid) { + dcPerson('contributor', $cid, $user_name); } dcRights($article); @@ -204,13 +204,15 @@ function wfCreativeCommonsRdf($article) { print " \n"; } -/* private */ function dcPerson($name, $id) { +/* private */ function dcPerson($name, $id, $user_name="") { global $wgLang; if ($id == 0) { dcElement($name, wfMsg("anonymous")); } else { - $user_name = User::whoIs($id); + if( empty( $user_name ) ) { + $user_name = User::whoIs($id); + } dcPageOrString($name, $wgLang->getNsText(NS_USER) . ":" . $user_name, $user_name); } } @@ -219,13 +221,13 @@ function wfCreativeCommonsRdf($article) { $contribs = array(); - $res = wfQuery("SELECT DISTINCT old_user" . + $res = wfQuery("SELECT DISTINCT old_user,old_user_text" . " FROM old " . " WHERE old_namespace = " . $title->getNamespace() . " AND old_title = '" . $title->getDBkey() . "'", DB_READ); while ( $line = wfFetchObject( $res ) ) { - $contribs[] = $line->old_user; + $contribs[$line->old_user_text] = $line->old_user; } return $contribs;