Index: trunk/extensions/AbsenteeLandlord/AbsenteeLandlord.i18n.php |
— | — | @@ -10,5 +10,5 @@ |
11 | 11 | |
12 | 12 | $messages['en'] = array( |
13 | 13 | 'absenteelandlord-reason' => 'The database has been automatically locked due to inactivity from the sysops.', |
14 | | - 'absenteelandlord-desc' => 'Auto-locks the wiki database if the sysops are all inactive for some time', |
15 | | -); |
\ No newline at end of file |
| 14 | + 'absenteelandlord-desc' => 'Auto-locks the wiki database if the sysops are all inactive for some time', |
| 15 | +); |
Index: trunk/extensions/AbsenteeLandlord/AbsenteeLandlord.php |
— | — | @@ -3,57 +3,57 @@ |
4 | 4 | * \brief Contains code for the AbsenteeLandlord extension by Ryan Schmidt and Tim Laqua. |
5 | 5 | */ |
6 | 6 | |
7 | | -if(!defined('MEDIAWIKI')) { |
8 | | - echo("This file is an extension to the mediawiki software and cannot be used standalone\n"); |
9 | | - die( 1 ); |
10 | | -} |
11 | | - |
12 | | -$wgAbsenteeLandlordMaxDays = 90; //how many days do the sysops have to be inactive for? |
| 7 | +if(!defined('MEDIAWIKI')) { |
| 8 | + echo("This file is an extension to the mediawiki software and cannot be used standalone\n"); |
| 9 | + die( 1 ); |
| 10 | +} |
13 | 11 | |
14 | | -$wgExtensionCredits['other'][] = array( |
15 | | - 'name' => 'Absentee Landlord', |
16 | | - 'author' => array( 'Ryan Schmidt', 'Tim Laqua' ), |
| 12 | +$wgAbsenteeLandlordMaxDays = 90; //how many days do the sysops have to be inactive for? |
| 13 | + |
| 14 | +$wgExtensionCredits['other'][] = array( |
| 15 | + 'name' => 'Absentee Landlord', |
| 16 | + 'author' => array( 'Ryan Schmidt', 'Tim Laqua' ), |
17 | 17 | 'version' => '1.0', |
18 | | - 'description' => 'Auto-locks the wiki database if the sysops are all inactive for some time', |
| 18 | + 'description' => 'Auto-locks the wiki database if the sysops are all inactive for some time', |
19 | 19 | 'descriptionmsg' => 'absenteelandlord-desc', |
20 | 20 | 'url' => 'http://www.mediawiki.org/wiki/Extension:AbsenteeLandlord', |
21 | | -); |
22 | | - |
| 21 | +); |
| 22 | + |
23 | 23 | $wgExtensionFunctions[] = 'efAbsenteeLandlord_Setup'; |
24 | | -$wgHooks['BeforePageDisplay'][] = 'efAbsenteeLandlord_MaybeDoTouch'; |
| 24 | +$wgHooks['BeforePageDisplay'][] = 'efAbsenteeLandlord_MaybeDoTouch'; |
25 | 25 | |
26 | 26 | function efAbsenteeLandlord_Setup() { |
27 | 27 | global $wgAbsenteeLandlordMaxDays; |
28 | 28 | |
29 | | - $timeout = $wgAbsenteeLandlordMaxDays * 24 * 60 * 60; // # days * 24 hours * 60 minutes * 60 seconds |
30 | | - $lasttouched = filemtime( dirname(__FILE__) . '/lasttouched.txt' ); |
31 | | - $check = time() - $lasttouched; |
32 | | - |
| 29 | + $timeout = $wgAbsenteeLandlordMaxDays * 24 * 60 * 60; // # days * 24 hours * 60 minutes * 60 seconds |
| 30 | + $lasttouched = filemtime( dirname(__FILE__) . '/lasttouched.txt' ); |
| 31 | + $check = time() - $lasttouched; |
| 32 | + |
33 | 33 | if( $check >= $timeout ) { |
34 | 34 | global $wgUser; |
35 | 35 | $groups = $wgUser->getGroups(); |
36 | | - |
37 | | - if( !in_array( 'sysop', $groups ) ) { |
| 36 | + |
| 37 | + if( !in_array( 'sysop', $groups ) ) { |
38 | 38 | global $wgReadOnly, $wgMessageCache; |
39 | | - |
| 39 | + |
40 | 40 | #Add Messages (don't need them unless we get here) |
41 | 41 | require( dirname( __FILE__ ) . '/AbsenteeLandlord.i18n.php' ); |
42 | 42 | foreach( $messages as $key => $value ) { |
43 | 43 | $wgMessageCache->addMessages( $messages[$key], $key ); |
44 | 44 | } |
45 | | - |
46 | | - $wgReadOnly = ( wfMsg( 'absenteelandlord-reason' ) ); |
| 45 | + |
| 46 | + $wgReadOnly = ( wfMsg( 'absenteelandlord-reason' ) ); |
47 | 47 | } |
48 | | - } |
| 48 | + } |
49 | 49 | |
50 | 50 | return true; |
51 | 51 | } |
52 | 52 | |
53 | | -function efAbsenteeLandlord_MaybeDoTouch(&$out, &$sk = null) { |
54 | | - global $wgUser; |
55 | | - $groups = $wgUser->getGroups(); |
56 | | - if( in_array( 'sysop', $groups ) ) { |
57 | | - touch( dirname(__FILE__) . '/lasttouched.txt' ); |
58 | | - } |
59 | | - return true; |
60 | | -} |
\ No newline at end of file |
| 53 | +function efAbsenteeLandlord_MaybeDoTouch(&$out, &$sk = null) { |
| 54 | + global $wgUser; |
| 55 | + $groups = $wgUser->getGroups(); |
| 56 | + if( in_array( 'sysop', $groups ) ) { |
| 57 | + touch( dirname(__FILE__) . '/lasttouched.txt' ); |
| 58 | + } |
| 59 | + return true; |
| 60 | +} |