Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated dependency #209

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"require": {
"php": ">=7.4",
"laravel/framework": ">=9.0",
"h5p/h5p-core": "1.24.*|dev-master",
"h5p/h5p-editor": "1.24.*|dev-master",
"h5p/h5p-core": "1.26.*|dev-master",
"h5p/h5p-editor": "1.25.*|dev-master",
"escolalms/core": "^1",
"escolalms/auth": "^0",
"escolalms/settings": "^0"
Expand Down
6 changes: 6 additions & 0 deletions src/Repositories/H5PRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ public function getLibraryId($machineName, $majorVersion = null, $minorVersion =
return $return === null ? false : $return->id;
}

public function checkLibraryById(int $libraryId): H5PLibrary|null
{
return H5PLibrary::query()->where('id', $libraryId)->first();
}

/**
* Get file extension whitelist.
*
Expand Down Expand Up @@ -1366,6 +1371,7 @@ public function replaceContentHubMetadataCache($metadata, $lang)
* @param string $lang Language code in ISO 639-1
*
*/
// @phpstan-ignore-next-line
public function getContentHubMetadataCache($lang = 'en')
{
}
Expand Down
16 changes: 15 additions & 1 deletion src/Services/H5PCoreService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
class H5PCoreService extends H5PCore
{
protected bool $exportEnabled;
public $aggregateAssets;

public function __construct(H5PFrameworkInterface $H5PFramework, $path, $url, $language = 'en', $export = FALSE)
{
Expand Down Expand Up @@ -136,4 +135,19 @@ private function generateContentSlug($content) {

return $slug;
}

public function getLibraryId($library, $libString = NULL)
{
static $libraryIdMap = [];

if (!$libString) {
$libString = self::libraryToString($library);
}

if (!isset($libraryIdMap[$libString]) || !$this->h5pF->checkLibraryById($libraryIdMap[$libString])) {
$libraryIdMap[$libString] = $this->h5pF->getLibraryId($library['machineName'], $library['majorVersion'], $library['minorVersion']);
}

return $libraryIdMap[$libString];
}
}
1 change: 0 additions & 1 deletion src/Services/HeadlessH5PService.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@ public function getContentTypeCache(): array
public function getUpdatedContentHubMetadataCache()
{
$lang = config('hh5p.language');
// @phpstan-ignore-next-line
return $this->getCore()->getUpdatedContentHubMetadataCache($lang);
}

Expand Down
Loading