File tree Expand file tree Collapse file tree 4 files changed +6
-4
lines changed Expand file tree Collapse file tree 4 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ public function run(Router &$router) {
3535
3636 protected function getCredits (CreditsModel &$ model ) {
3737 $ credits = new CreditsLib ();
38- $ model ->total_users = $ credits -> getTotalUsers ();
38+ $ model ->total_users = CreditsLib:: getTotalUsers ();
3939 $ model ->top_contributors_by_documents
4040 = &$ credits ->getTopContributorsByDocuments ();
4141 $ model ->top_contributors_by_news_posts
Original file line number Diff line number Diff line change 55use \BNETDocs \Libraries \CSRF ;
66use \BNETDocs \Libraries \Common ;
77use \BNETDocs \Libraries \Controller ;
8+ use \BNETDocs \Libraries \Exceptions \QueryException ;
89use \BNETDocs \Libraries \Exceptions \RecaptchaException ;
910use \BNETDocs \Libraries \Exceptions \UnspecifiedViewException ;
1011use \BNETDocs \Libraries \Exceptions \UserNotFoundException ;
11- use \BNETDocs \Libraries \Exceptions \QueryException ;
1212use \BNETDocs \Libraries \Logger ;
1313use \BNETDocs \Libraries \Router ;
1414use \BNETDocs \Libraries \User ;
Original file line number Diff line number Diff line change 1111
1212class Credits {
1313
14- public function &getTotalUsers () {
14+ public static function &getTotalUsers ($ no_cache = false ) {
1515 $ cache_key = "bnetdocs-credits-totalusers " ;
1616 $ cache_val = Common::$ cache ->get ($ cache_key );
17- if ($ cache_val !== false ) return (int ) $ cache_val ;
17+ if (! $ no_cache && $ cache_val !== false ) return (int ) $ cache_val ;
1818 if (!isset (Common::$ database )) {
1919 Common::$ database = DatabaseDriver::getDatabaseObject ();
2020 }
Original file line number Diff line number Diff line change 44
55use \BNETDocs \Libraries \Cache ;
66use \BNETDocs \Libraries \Common ;
7+ use \BNETDocs \Libraries \Credits ;
78use \BNETDocs \Libraries \Database ;
89use \BNETDocs \Libraries \DatabaseDriver ;
910use \BNETDocs \Libraries \Exceptions \QueryException ;
@@ -157,6 +158,7 @@ public static function create(
157158 } catch (PDOException $ e ) {
158159 throw new QueryException ("Cannot create user " , $ e );
159160 } finally {
161+ Credits::getTotalUsers (true ); // Refresh statistics
160162 return $ successful ;
161163 }
162164 }
You can’t perform that action at this time.
0 commit comments