Skip to content
Snippets Groups Projects
Commit 4be695c2 authored by Frode Petterson's avatar Frode Petterson
Browse files

JI-942 Fix coding standards

parent 3bf4773d
No related branches found
No related tags found
No related merge requests found
...@@ -849,18 +849,19 @@ class file_storage implements \H5PFileStorage { ...@@ -849,18 +849,19 @@ class file_storage implements \H5PFileStorage {
* @param int $minorVersion * @param int $minorVersion
* @return string Relative path * @return string Relative path
*/ */
public function getUpgradeScript($machineName, $majorVersion, $minorVersion) { // @codingStandardsIgnoreLine
public function getUpgradeScript($machinename, $majorversion, $minorversion) {
global $CFG; global $CFG;
$context = \context_system::instance(); $context = \context_system::instance();
$fs = get_file_storage(); $fs = get_file_storage();
$area = 'libraries'; $area = 'libraries';
$path = "/{$machineName}-{$majorVersion}.{$minorVersion}/"; $path = "/{$machinename}-{$majorversion}.{$minorversion}/";
$file = 'upgrades.js'; $file = 'upgrades.js';
if ($fs->get_file($context->id, 'mod_hvp', $area, 0, $path, $file)) { if ($fs->get_file($context->id, 'mod_hvp', $area, 0, $path, $file)) {
return "/{$area}{$path}{$file}"; return "/{$area}{$path}{$file}";
} else { } else {
return NULL; return null;
} }
} }
} }
...@@ -1353,10 +1353,10 @@ class framework implements \H5PFrameworkInterface { ...@@ -1353,10 +1353,10 @@ class framework implements \H5PFrameworkInterface {
// @codingStandardsIgnoreLine // @codingStandardsIgnoreLine
public function getNumContent($libraryid, $skip = NULL) { public function getNumContent($libraryid, $skip = NULL) {
global $DB; global $DB;
$skip_query = empty($skip) ? '' : " AND id NOT IN ($skip)"; $skipquery = empty($skip) ? '' : " AND id NOT IN ($skip)";
return (int) $DB->get_field_sql( return (int) $DB->get_field_sql(
"SELECT COUNT(id) FROM {hvp} WHERE main_library_id = ?{$skip_query}", "SELECT COUNT(id) FROM {hvp} WHERE main_library_id = ?{$skipquery}",
array($libraryid)); array($libraryid));
} }
...@@ -1583,6 +1583,7 @@ class framework implements \H5PFrameworkInterface { ...@@ -1583,6 +1583,7 @@ class framework implements \H5PFrameworkInterface {
/** /**
* Implements libraryHasUpgrade * Implements libraryHasUpgrade
*/ */
// @codingStandardsIgnoreLine
public function libraryHasUpgrade($library) { public function libraryHasUpgrade($library) {
global $DB; global $DB;
......
...@@ -337,11 +337,11 @@ function hvp_content_upgrade_progress($libraryid) { ...@@ -337,11 +337,11 @@ function hvp_content_upgrade_progress($libraryid) {
} }
} }
// Determine if any content has been skipped during the process // Determine if any content has been skipped during the process.
$skipped = filter_input(INPUT_POST, 'skipped'); $skipped = filter_input(INPUT_POST, 'skipped');
if ($skipped !== NULL) { if ($skipped !== null) {
$out->skipped = json_decode($skipped); $out->skipped = json_decode($skipped);
// Clean up input, only numbers // Clean up input, only numbers.
foreach ($skipped as $i => $id) { foreach ($skipped as $i => $id) {
$skipped[$i] = intval($id); $skipped[$i] = intval($id);
} }
...@@ -354,7 +354,7 @@ function hvp_content_upgrade_progress($libraryid) { ...@@ -354,7 +354,7 @@ function hvp_content_upgrade_progress($libraryid) {
$out->left = $interface->getNumContent($libraryid, $skipped); $out->left = $interface->getNumContent($libraryid, $skipped);
if ($out->left) { if ($out->left) {
$skip_query = empty($skipped) ? '' : " AND id NOT IN ($skipped)"; $skipquery = empty($skipped) ? '' : " AND id NOT IN ($skipped)";
// Find the 40 first contents using this library version and add to params. // Find the 40 first contents using this library version and add to params.
$results = $DB->get_records_sql( $results = $DB->get_records_sql(
...@@ -362,7 +362,7 @@ function hvp_content_upgrade_progress($libraryid) { ...@@ -362,7 +362,7 @@ function hvp_content_upgrade_progress($libraryid) {
license, license_version, changes, license_extras, author_comments license, license_version, changes, license_extras, author_comments
FROM {hvp} FROM {hvp}
WHERE main_library_id = ? WHERE main_library_id = ?
{$skip_query} {$skipquery}
ORDER BY name ASC", array($libraryid), 0 , 40 ORDER BY name ASC", array($libraryid), 0 , 40
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment