mirror of
https://github.com/Yetangitu/owncloud-apps.git
synced 2025-10-02 14:49:17 +02:00
files_reader: #37, fix autoloader-borne log spam by using getAppManager()->isInstalled('files_opds') instead of class_exists
This commit is contained in:
parent
e7f4760993
commit
c62859820d
1 changed files with 12 additions and 1 deletions
|
@ -10,8 +10,19 @@
|
|||
|
||||
namespace OCA\Files_Reader\Service;
|
||||
|
||||
use OCP\App\IAppManager;
|
||||
|
||||
class MetadataService {
|
||||
|
||||
private $appManager;
|
||||
|
||||
/**
|
||||
* @param IAppManager $appManager
|
||||
*/
|
||||
public function __construct(IAppManager $appManager) {
|
||||
$this->appManager = $appManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get metadata item(s)
|
||||
*
|
||||
|
@ -21,7 +32,7 @@ class MetadataService {
|
|||
* @return array
|
||||
*/
|
||||
public function get($fileId, $name=null) {
|
||||
if (class_exists('\OCA\Files_Opds\Meta')) {
|
||||
if ($this->appManager->isInstalled('files_opds')) {
|
||||
if ($meta = \OCA\Files_Opds\Meta::get($fileId)) {
|
||||
if (!empty($name) && array_key_exists($name, $meta)) {
|
||||
return [$item => $meta[$name]];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue