| @@ 36-48 (lines=13) @@ | ||
| 33 | * |
|
| 34 | * @return array|false |
|
| 35 | */ |
|
| 36 | public function newArticleStats(Event $event) |
|
| 37 | { |
|
| 38 | $this->BlogArticles = TableRegistry::get('BlogArticles'); |
|
| 39 | ||
| 40 | $articles = $this->BlogArticles->find()->count(); |
|
| 41 | $articles = Number::format($articles); |
|
| 42 | ||
| 43 | if ($this->_writeCache($articles, 'Articles')) { |
|
| 44 | return $articles; |
|
| 45 | } |
|
| 46 | ||
| 47 | return false; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * Count the article's comments and write it in the Cache. |
|
| @@ 57-69 (lines=13) @@ | ||
| 54 | * |
|
| 55 | * @return array|false |
|
| 56 | */ |
|
| 57 | public function newArticleCommentStats(Event $event) |
|
| 58 | { |
|
| 59 | $this->BlogArticlesComments = TableRegistry::get('BlogArticlesComments'); |
|
| 60 | ||
| 61 | $comments = $this->BlogArticlesComments->find()->count(); |
|
| 62 | $comments = Number::format($comments); |
|
| 63 | ||
| 64 | if ($this->_writeCache($comments, 'ArticlesComments')) { |
|
| 65 | return $comments; |
|
| 66 | } |
|
| 67 | ||
| 68 | return false; |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * Count the article's likes and write it in the Cache. |
|
| @@ 78-90 (lines=13) @@ | ||
| 75 | * |
|
| 76 | * @return array|false |
|
| 77 | */ |
|
| 78 | public function newArticleLikeStats(Event $event) |
|
| 79 | { |
|
| 80 | $this->BlogArticlesLikes = TableRegistry::get('BlogArticlesLikes'); |
|
| 81 | ||
| 82 | $likes = $this->BlogArticlesLikes->find()->count(); |
|
| 83 | $likes = Number::format($likes); |
|
| 84 | ||
| 85 | if ($this->_writeCache($likes, 'ArticlesLikes')) { |
|
| 86 | return $likes; |
|
| 87 | } |
|
| 88 | ||
| 89 | return false; |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * Re-count the number of user and find the latest user and write it in the Cache. |
|