SkipperGuide:Interne Dokumentation/Seitenfooter
Zur Navigation springen
Zur Suche springen
der Seitenfooter ist eine eigene Anpassung. Die Alternative wäre, in der LocalSettings.php einen Wert für $wgMaxCredits zu setzen. Allerdings ist die Ausgabe irreführend (Letzte Bearbeitung durch X, basierend auf der Arbeit von Y)
Umsetzung
Prinzip: die Variable "lastmodified" wird erweitert, so dass sie auch die Benutzerliste und den ersten Bearbeiter beinhaltet. ($2- Letzter Bearbeiter, $3- Liste der Autoren als Array)
Anpassungen Article.php
neue Attribute: Bearbeiterliste, und erster Author
Deklarationsteil:
// CUSTOM var $mFirstAuthor; var $mAuthors; // /CUSTOM
Am Ende anfügen:
// CUSTOM
/**
* Get the authors of an article
*/
function loadAuthors( ) {
$fname = 'Article::loadAuthors';
wfProfileIn( $fname );
$num = 9999;
// already loaded
if ( isset($mFirstAuthor) ) return;
// First try the slave
// If that doesn't have the latest revision, try the master
$continue = 2;
$db =& wfGetDB( DB_SLAVE );
do {
$res = $db->select( array( 'page', 'revision' ),
array( 'DISTINCT CASE WHEN rev_user_text LIKE \'%.%.%.%\' then \'Anonymous\' else rev_user_text END as rev_user_text' ),
array(
'page_namespace' => $this->mTitle->getNamespace(),
'page_title' => $this->mTitle->getDBkey(),
'rev_page = page_id',
'rev_minor_edit = 0'
), $fname, $this->getSelectOptions( array(
'ORDER BY' => 'rev_timestamp ASC',
'LIMIT' => $num
) )
);
if ( !$res ) {
wfProfileOut( $fname );
return array();
}
$row = $db->fetchObject( $res );
if ( $continue == 2 && $revLatest && $row->rev_id != $revLatest ) {
$db =& wfGetDB( DB_MASTER );
$continue--;
} else {
$continue = 0;
}
} while ( $continue );
$authors = array( $row->rev_user_text );
while ( $row = $db->fetchObject( $res ) ) {
$authors[] = $row->rev_user_text;
}
wfProfileOut( $fname );
$this->mFirstAuthor = 'hihi' . $authors[0];
$this->mAuthors = $authors;
}
function getFirstAuthor() {
$this->loadAuthors();
return $this->mFirstAuthor;
}
function getAuthors() {
$this->loadAuthors();
return $this->mAuthors;
}
// /CUSTOM
Anpassung Skin.php
Anpassung der Funktion "lastModified", so dass die Benutzer ergänzt werden.
function lastModified() {
global $wgLang, $wgArticle, $wgLoadBalancer;
$timestamp = $wgArticle->getTimestamp();
> $firstAuthor = $wgArticle->getFirstAuthor();
> $authors = $wgArticle->getAuthors();
>
> $i = 0;
> while ( $i < count($authors) ) {
> if ( $authors[$i] != 'Anonymous') {
> $authors[$i] = $this->makeKnownLink( 'User:' . $authors[$i], $authors[$i] );
> }
> $i++;
> }
> $authorsStr = implode(', ', $authors);
if ( $timestamp ) {
$d = $wgLang->timeanddate( $timestamp, true );
> $s = ' ' . wfMsg( 'lastmodified', $d, $t, $firstAuthor, $authorsStr );
} else {
$s = ;
}
:
:
Anpassung Message 'lastmodifiedat'
Die Meldung 'Lastmodifiedat' muss um zumindest den Parameter $4 (Liste der Authoren) erweitert werden:
Diese Seite wurde zuletzt geändert am $1 um $2. Autoren und Bearbeiter: $4.