From f8c2a4758003d0989dcee116e2c68ed688257906 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Wed, 20 Jan 2016 13:21:51 +0100 Subject: [PATCH] Get the lastest version of a given library. h5p/h5p-wordpress-plugin#28 --- h5p.classes.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/h5p.classes.php b/h5p.classes.php index d91b794..3ccfd5f 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -130,18 +130,19 @@ interface H5PFrameworkInterface { public function getAdminUrl(); /** - * Get id to an existing library + * Get id to an existing library. + * If version number is not specified, the newest version will be returned. * * @param string $machineName * The librarys machine name * @param int $majorVersion - * The librarys major version + * Optional major version number for library * @param int $minorVersion - * The librarys minor version + * Optional minor version number for library * @return int * The id of the specified library or FALSE */ - public function getLibraryId($machineName, $majorVersion, $minorVersion); + public function getLibraryId($machineName, $majorVersion = NULL, $minorVersion = NULL); /** * Get file extension whitelist @@ -798,12 +799,12 @@ class H5PValidator { } if ($valid) { if ($upgradeOnly) { - // When upgrading, we opnly add allready installed libraries, - // and new dependent libraries + // When upgrading, we only add the already installed libraries, and + // the new dependent libraries $upgrades = array(); foreach ($libraries as $libString => &$library) { // Is this library already installed? - if ($this->h5pC->getLibraryId($library, $libString) !== FALSE) { + if ($this->h5pF->getLibraryId($library['machineName']) !== FALSE) { $upgrades[$libString] = $library; } }