コード例 #1
0
ファイル: Main.php プロジェクト: danito/Known-Reviews
 /**
  * Get the total file usage
  * @param bool $user
  * @return int
  */
 function getFileUsage($user = false)
 {
     $total = 0;
     if (!empty($user)) {
         $search = ['user' => $user];
     } else {
         $search = [];
     }
     if ($reviews = review::get($search, [], 9999, 0)) {
         foreach ($reviews as $review) {
             /* @var review $review */
             if ($review instanceof review) {
                 if ($attachments = $review->getAttachments()) {
                     foreach ($attachments as $attachment) {
                         $total += $attachment['length'];
                     }
                 }
             }
         }
     }
     return $total;
 }