/** * @return mixed|FileManagement|SimpleFileManagement * @throws \common_exception_Error */ public static function getFileManagementModel() { if (is_null(self::$fileManager)) { $data = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoMediaManager')->getConfig(self::CONFIG_KEY); if (is_string($data)) { // legacy if (class_exists($data)) { self::$fileManager = new $data(); } else { \common_Logger::w('No file manager implementation found'); self::$fileManager = new SimpleFileManagement(); } } elseif (is_object($data)) { self::$fileManager = $data; } else { throw new \common_exception_Error('Unsupported configuration for ' . __CLASS__); } } return self::$fileManager; }
/** * @return mixed|FileManagement|SimpleFileManagement * @throws \common_exception_Error */ public static function getFileManagementModel() { if (is_null(self::$fileManager)) { $data = ServiceManager::getServiceManager()->get(FileManagement::SERVICE_ID); if (is_string($data)) { // legacy if (class_exists($data)) { self::$fileManager = new $data(); } else { \common_Logger::w('No file manager implementation found'); self::$fileManager = new SimpleFileManagement(); } } elseif (is_object($data)) { self::$fileManager = $data; } else { throw new \common_exception_Error('Unsupported configuration for ' . __CLASS__); } } return self::$fileManager; }