| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- class Media {
-
- private $config;
-
- function __construct() {
- global $config;
-
- $this->config = $config;
- }
-
- public function getPendingUploads($groupId=0) {
- $files = glob(MEDIA_TMP_DIR.'*.info');
- $infos = [];
-
- if (is_array($files) && !empty($files)) {
-
- foreach($files as $file) {
- $json = json_decode(file_get_contents($file), true);
-
- if (isset($json['MetaData']['groupId'])) {
- if ($json['MetaData']['groupId'] == $groupId) {
- $fileName = MEDIA_TMP_DIR.$json['ID'].'.bin';
- $currentSize = filesize($fileName);
- $percentage = $currentSize*100/$json['Size'];
- $json['percentage'] = $percentage;
- $json['lastUpdate'] = date('Y-m-d H:i:s', filemtime($fileName));
-
- $infos[] = $json;
- }
- }
- }
- }
-
- return $infos;
- }
- }
|