Index: trunk/extensions/AbsenteeLandlord/AbsenteeLandlord.php |
— | — | @@ -10,10 +10,11 @@ |
11 | 11 | |
12 | 12 | $wgAbsenteeLandlordMaxDays = 90; //how many days do the sysops have to be inactive for? |
13 | 13 | |
| 14 | + |
14 | 15 | $wgExtensionCredits['other'][] = array( |
15 | 16 | 'name' => 'Absentee Landlord', |
16 | 17 | 'author' => array( 'Ryan Schmidt', 'Tim Laqua' ), |
17 | | - 'version' => '1.0', |
| 18 | + 'version' => '1.1', |
18 | 19 | 'description' => 'Auto-locks the wiki database if the sysops are all inactive for some time', |
19 | 20 | 'descriptionmsg' => 'absenteelandlord-desc', |
20 | 21 | 'url' => 'http://www.mediawiki.org/wiki/Extension:AbsenteeLandlord', |
— | — | @@ -22,11 +23,16 @@ |
23 | 24 | $wgExtensionFunctions[] = 'efAbsenteeLandlord_Setup'; |
24 | 25 | $wgHooks['BeforePageDisplay'][] = 'efAbsenteeLandlord_MaybeDoTouch'; |
25 | 26 | |
| 27 | +$dir = dirname(__FILE__) . '/'; |
| 28 | +$wgExtensionMessagesFiles['AbsenteeLandlord'] = $dir . 'AbsenteeLandlord.i18n.php'; |
| 29 | + |
| 30 | +$wgAbsenteeLandlordTouchFile = $dir . 'lasttouched.txt'; |
| 31 | + |
26 | 32 | function efAbsenteeLandlord_Setup() { |
27 | | - global $wgAbsenteeLandlordMaxDays; |
| 33 | + global $wgAbsenteeLandlordMaxDays, $wgAbsenteeLandlordTouchFile; |
28 | 34 | |
29 | 35 | $timeout = $wgAbsenteeLandlordMaxDays * 24 * 60 * 60; // # days * 24 hours * 60 minutes * 60 seconds |
30 | | - $lasttouched = filemtime( dirname(__FILE__) . '/lasttouched.txt' ); |
| 36 | + $lasttouched = filemtime($wgAbsenteeLandlordTouchFile); |
31 | 37 | $check = time() - $lasttouched; |
32 | 38 | |
33 | 39 | if( $check >= $timeout ) { |
— | — | @@ -37,12 +43,8 @@ |
38 | 44 | global $wgReadOnly, $wgMessageCache; |
39 | 45 | |
40 | 46 | #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' ); |
47 | 49 | } |
48 | 50 | } |
49 | 51 | |
— | — | @@ -50,10 +52,10 @@ |
51 | 53 | } |
52 | 54 | |
53 | 55 | function efAbsenteeLandlord_MaybeDoTouch(&$out, &$sk = null) { |
54 | | - global $wgUser; |
| 56 | + global $wgUser, $wgAbsenteeLandlordTouchFile; |
55 | 57 | $groups = $wgUser->getGroups(); |
56 | 58 | if( in_array( 'sysop', $groups ) ) { |
57 | | - touch( dirname(__FILE__) . '/lasttouched.txt' ); |
| 59 | + touch($wgAbsenteeLandlordTouchFile); |
58 | 60 | } |
59 | 61 | return true; |
60 | 62 | } |