r36191 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36190‎ | r36191 | r36192 >
Date:14:52, 11 June 2008
Author:nikerabbit
Status:old
Tags:
Comment:
* Use wfLoadExtensionMessages so that descriptionmsg actually works
Modified paths:
  • /trunk/extensions/AbsenteeLandlord/AbsenteeLandlord.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbsenteeLandlord/AbsenteeLandlord.php
@@ -10,10 +10,11 @@
1111
1212 $wgAbsenteeLandlordMaxDays = 90; //how many days do the sysops have to be inactive for?
1313
 14+
1415 $wgExtensionCredits['other'][] = array(
1516 'name' => 'Absentee Landlord',
1617 'author' => array( 'Ryan Schmidt', 'Tim Laqua' ),
17 - 'version' => '1.0',
 18+ 'version' => '1.1',
1819 'description' => 'Auto-locks the wiki database if the sysops are all inactive for some time',
1920 'descriptionmsg' => 'absenteelandlord-desc',
2021 'url' => 'http://www.mediawiki.org/wiki/Extension:AbsenteeLandlord',
@@ -22,11 +23,16 @@
2324 $wgExtensionFunctions[] = 'efAbsenteeLandlord_Setup';
2425 $wgHooks['BeforePageDisplay'][] = 'efAbsenteeLandlord_MaybeDoTouch';
2526
 27+$dir = dirname(__FILE__) . '/';
 28+$wgExtensionMessagesFiles['AbsenteeLandlord'] = $dir . 'AbsenteeLandlord.i18n.php';
 29+
 30+$wgAbsenteeLandlordTouchFile = $dir . 'lasttouched.txt';
 31+
2632 function efAbsenteeLandlord_Setup() {
27 - global $wgAbsenteeLandlordMaxDays;
 33+ global $wgAbsenteeLandlordMaxDays, $wgAbsenteeLandlordTouchFile;
2834
2935 $timeout = $wgAbsenteeLandlordMaxDays * 24 * 60 * 60; // # days * 24 hours * 60 minutes * 60 seconds
30 - $lasttouched = filemtime( dirname(__FILE__) . '/lasttouched.txt' );
 36+ $lasttouched = filemtime($wgAbsenteeLandlordTouchFile);
3137 $check = time() - $lasttouched;
3238
3339 if( $check >= $timeout ) {
@@ -37,12 +43,8 @@
3844 global $wgReadOnly, $wgMessageCache;
3945
4046 #Add Messages (don't need them unless we get here)
41 - require( dirname( __FILE__ ) . '/AbsenteeLandlord.i18n.php' );
42 - foreach( $messages as $key => $value ) {
43 - $wgMessageCache->addMessages( $messages[$key], $key );
44 - }
45 -
46 - $wgReadOnly = ( wfMsg( 'absenteelandlord-reason' ) );
 47+ wfLoadExtensionMessages( 'AbsenteeLandlord' );
 48+ $wgReadOnly = wfMsg( 'absenteelandlord-reason' );
4749 }
4850 }
4951
@@ -50,10 +52,10 @@
5153 }
5254
5355 function efAbsenteeLandlord_MaybeDoTouch(&$out, &$sk = null) {
54 - global $wgUser;
 56+ global $wgUser, $wgAbsenteeLandlordTouchFile;
5557 $groups = $wgUser->getGroups();
5658 if( in_array( 'sysop', $groups ) ) {
57 - touch( dirname(__FILE__) . '/lasttouched.txt' );
 59+ touch($wgAbsenteeLandlordTouchFile);
5860 }
5961 return true;
6062 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r42634* partial revert of r36191: don't change something you don't mention in your ...skizzerz01:05, 27 October 2008

Status & tagging log