Index: trunk/extensions/UserDailyContribs/api/ApiUserDailyContribs.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | 'id', $user->getId() ); |
20 | 20 | // returns date of registration in YYYYMMDDHHMMSS format |
21 | 21 | $result->addValue( $this->getModuleName() , |
22 | | - 'registration', ($user->getRegistration() == NULL)?'0':$user->getRegistration() ); |
| 22 | + 'registration', $user->getRegistration() ? '0' : $user->getRegistration() ); |
23 | 23 | // returns number of edits since daysago param |
24 | 24 | $result->addValue( $this->getModuleName() , |
25 | 25 | 'timeFrameEdits', getUserEditCountSince( $now - ($days * 60 *60 *24), $user ) ); |
Index: trunk/extensions/UserDailyContribs/UserDailyContribs.hooks.php |
— | — | @@ -42,21 +42,19 @@ |
43 | 43 | * |
44 | 44 | * @return true |
45 | 45 | */ |
46 | | - public static function articleSaveComplete(){ |
47 | | - global $wgUser; |
48 | | - |
| 46 | + public static function articleSaveComplete( $article, $user ){ |
49 | 47 | $today = gmdate( 'Ymd', time() ); |
50 | 48 | $dbw = wfGetDB( DB_MASTER ); |
51 | 49 | $dbw->update( |
52 | 50 | 'user_daily_contribs', |
53 | 51 | array( 'contribs=contribs+1' ), |
54 | | - array( 'day' => $today, 'user_id' => $wgUser->getId() ), |
| 52 | + array( 'day' => $today, 'user_id' => $user->getId() ), |
55 | 53 | __METHOD__ |
56 | 54 | ); |
57 | 55 | if ( $dbw->affectedRows() == 0 ){ |
58 | 56 | $dbw->insert( |
59 | 57 | 'user_daily_contribs', |
60 | | - array( 'user_id' => $wgUser->getId(), 'day' => $today, 'contribs' => 1 ), |
| 58 | + array( 'user_id' => $user->getId(), 'day' => $today, 'contribs' => 1 ), |
61 | 59 | __METHOD__ |
62 | 60 | ); |
63 | 61 | } |