From 30d05bf198492c90880d40329ab35ab6583a5862 Mon Sep 17 00:00:00 2001 From: Christian Date: Sun, 6 Nov 2022 22:54:29 -0500 Subject: [PATCH 1/2] Document - Fix script to rename or copy files checking db and disk - refs BT#20137 --- tests/scripts/check_document_files_on_disk.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/scripts/check_document_files_on_disk.php b/tests/scripts/check_document_files_on_disk.php index 82663d864e..f2c2884bdc 100644 --- a/tests/scripts/check_document_files_on_disk.php +++ b/tests/scripts/check_document_files_on_disk.php @@ -59,14 +59,21 @@ function checkDocumentFilesOnDisk($courseCode, $removeFileNotFound) // The file exists in other paths foreach ($currentDocPaths as $currentPath) { $log .= "Found on : {$currentPath}".PHP_EOL; + $sourceDir = dirname($sourcePath.$doc['path']); // it checks if the current path is stored in document table if (isPathInDocumentTable($currentPath, $course['id'], $sourcePath)) { // to copy the file to the new doc path + if (!file_exists($sourceDir)) { + mkdir($sourceDir, api_get_permissions_for_new_directories(), true); + } if (copy($currentPath, $sourcePath.$doc['path'])) { $log .= "CASE 1 - Checking document table, it exists as document path, so it is copied to the new document path {$doc['path']}".PHP_EOL; } } else { // to move the file to the new doc path + if (!file_exists($sourceDir)) { + mkdir($sourceDir, api_get_permissions_for_new_directories(), true); + } if (rename($currentPath, $sourcePath.$doc['path'])) { $log .= "CASE 2 - Checking document table, it doesn't exist in other path, so it is moved to the new doc path {$doc['path']}".PHP_EOL; } From c4b22bd84324f373669bf108e0fcabc573a28b0b Mon Sep 17 00:00:00 2001 From: NicoDucou Date: Mon, 7 Nov 2022 10:09:44 +0100 Subject: [PATCH 2/2] Announcement : fix table pagination with wrong total number of items -refs BT#20325 --- main/inc/lib/SortableTableFromArray.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/inc/lib/SortableTableFromArray.php b/main/inc/lib/SortableTableFromArray.php index 6437e0c92a..850f92a9b1 100644 --- a/main/inc/lib/SortableTableFromArray.php +++ b/main/inc/lib/SortableTableFromArray.php @@ -76,7 +76,7 @@ class SortableTableFromArray extends SortableTable */ public function get_total_number_of_items() { - if (isset($this->total_number_of_items) && !empty($this->total_number_of_items)) { + if (isset($this->total_number_of_items) && !empty($this->total_number_of_items) && $this->total_number_of_items != -1) { return $this->total_number_of_items; } else { if (!empty($this->table_data)) {