/** * @see Page::readParameters() */ public function readParameters() { parent::readParameters(); if (!empty($_GET['name'])) { $this->name = StringUtil::trim($_GET['name']); } $this->sketch = new Sketch(null, null, $this->name); if (Sketch::$cache === null) { Sketch::loadCache(); } $this->titles = Sketch::$cache['titles']; }
/** * 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 ($sketches = Sketch::get($search, [], 9999, 0)) { foreach ($sketches as $sketch) { /* @var Sketch $sketch */ if ($attachments = $sketch->getAttachments()) { foreach ($attachments as $attachment) { $total += $attachment['length']; } } } } return $total; }