getServiceManager()->get(UploadService::SERVICE_ID)->getUploadFSid(); $fs = $this->getServiceManager()->get(FileSystemService::SERVICE_ID)->getFileSystem($tmpSpaceFlySystemId); $report = new \common_report_Report(\common_report_Report::TYPE_INFO, __('Cleaning up tmp space started')); $files = 0; $dirs = 0; foreach ($fs->listContents() as $fileInfo) { if ('file' === $fileInfo['type']) { $file = new File($tmpSpaceFlySystemId, $fileInfo['path']); $file->setServiceLocator($this->getServiceManager()); $file->delete(); $files++; } if ('dir' === $fileInfo['type']) { $dir = new Directory($tmpSpaceFlySystemId, $fileInfo['path']); $dir->setServiceLocator($this->getServiceManager()); $dir->deleteSelf(); $dirs++; } $report->add(new \common_report_Report( \common_report_Report::TYPE_SUCCESS, __('Removing: %s', $fileInfo['path']) )); } $report->add(new \common_report_Report(\common_report_Report::TYPE_SUCCESS, __('Total:'))); $report->add(new \common_report_Report(\common_report_Report::TYPE_SUCCESS, __('Removed %s files', $files))); $report->add(new \common_report_Report( \common_report_Report::TYPE_SUCCESS, __('Removed %s directories', $dirs) )); $report->add(new \common_report_Report( \common_report_Report::TYPE_SUCCESS, __('Cleaning up tmp space complete') )); return $report; } }