Skip to content

Commit 75ef957

Browse files
committed
Fix: php warnings and deprecations
1 parent c3ade55 commit 75ef957

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

classes/editor_ajax.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ public function getLatestLibraryVersions() {
6565

6666
return $DB->get_records_sql("
6767
SELECT hl4.id, hl4.machine_name, hl4.title, hl4.major_version,
68-
hl4.minor_version, hl4.patch_version, hl4.has_icon, hl4.restricted
68+
hl4.minor_version, hl4.patch_version, hl4.has_icon, hl4.restricted,
69+
0 AS patch_version_in_folder_name
6970
FROM {hvp_libraries} hl4
7071
JOIN ({$maxminorversionsql}) hl3
7172
ON hl4.machine_name = hl3.machine_name

classes/file_storage.php

+1
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ private static function readFileTree($source, $options, $archive = null, $relati
544544
if (empty($archive) && $exportzip) {
545545
$archive = new \ZipArchive();
546546
$path = tempnam(get_request_storage_directory(),'libdir');
547+
unlink($path);
547548
$archive->open($path, \ZipArchive::CREATE || \ZipArchive::OVERWRITE);
548549
// Set recursion flag.
549550
$top = true;

classes/framework.php

+21-17
Original file line numberDiff line numberDiff line change
@@ -1521,23 +1521,27 @@ public function loadLibrary($machinename, $majorversion, $minorversion) {
15211521
'minor_version' => $minorversion
15221522
));
15231523

1524-
$librarydata = array(
1525-
'libraryId' => $library->id,
1526-
'machineName' => $library->machine_name,
1527-
'title' => $library->title,
1528-
'majorVersion' => $library->major_version,
1529-
'minorVersion' => $library->minor_version,
1530-
'patchVersion' => $library->patch_version,
1531-
'embedTypes' => $library->embed_types,
1532-
'preloadedJs' => $library->preloaded_js,
1533-
'preloadedCss' => $library->preloaded_css,
1534-
'dropLibraryCss' => $library->drop_library_css,
1535-
'fullscreen' => $library->fullscreen,
1536-
'runnable' => $library->runnable,
1537-
'semantics' => $library->semantics,
1538-
'restricted' => $library->restricted,
1539-
'hasIcon' => $library->has_icon
1540-
);
1524+
if ($library) {
1525+
$librarydata = array(
1526+
'libraryId' => $library->id,
1527+
'machineName' => $library->machine_name,
1528+
'title' => $library->title,
1529+
'majorVersion' => $library->major_version,
1530+
'minorVersion' => $library->minor_version,
1531+
'patchVersion' => $library->patch_version,
1532+
'embedTypes' => $library->embed_types,
1533+
'preloadedJs' => $library->preloaded_js,
1534+
'preloadedCss' => $library->preloaded_css,
1535+
'dropLibraryCss' => $library->drop_library_css,
1536+
'fullscreen' => $library->fullscreen,
1537+
'runnable' => $library->runnable,
1538+
'semantics' => $library->semantics,
1539+
'restricted' => $library->restricted,
1540+
'hasIcon' => $library->has_icon
1541+
);
1542+
} else {
1543+
return [];
1544+
}
15411545

15421546
$dependencies = $DB->get_records_sql(
15431547
'SELECT hl.id, hl.machine_name, hl.major_version, hl.minor_version, hll.dependency_type

0 commit comments

Comments
 (0)