Skip to content

Commit

Permalink
Reports: fix asset directory scanning on Windows servers, fix templat…
Browse files Browse the repository at this point in the history
…e folder creation error
  • Loading branch information
SKuipers committed Sep 29, 2024
1 parent 89f4a61 commit ad53a24
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ v28.0.00
Form Groups: fixed Year Group Summary list when looking at non-current school years
Planner: fixed next lesson plan date not auto populating in Add Lesson Plan
Reports: fixed Send Report option to enable sending to students without needing parent details
Reports: fixed Scan Asset Directories not working on Windows servers
Reports: fixed Scan Asset Directories failing to create template folder if it does not exist
Timetable: fixed permission checking before displaying user status info in View Timetables list
System Admin: fixed the sanitization rules for application form fields to allow HTML

Expand Down
3 changes: 3 additions & 0 deletions modules/Reports/moduleFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ function parseComponent($directoryPath, $filePath, $templateType = 'Additional',
{
if (empty($yaml)) $yaml = new Yaml();

$directoryPath = str_replace('\\', '/', $directoryPath);
$filePath = str_replace('\\', '/', $filePath);

$filename = str_replace($directoryPath.'/', '', $filePath);
$fileContents = file_get_contents($filePath);

Expand Down
7 changes: 5 additions & 2 deletions modules/Reports/templates_assets_scanProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,16 @@
$prototypeGateway = $container->get(ReportPrototypeSectionGateway::class);
$yaml = new Yaml();

$absolutePath = str_replace('\\', '/', $absolutePath);
$customAssetPath = str_replace('\\', '/', $customAssetPath);

$parseAndUpdateComponents = function ($directoryPath, $templateType) use (&$prototypeGateway, &$yaml, &$partialFail, &$count) {
// Get all twig files in this folder and sub-folders
$directoryPath = trim($directoryPath, '/');
if (stripos($directoryPath, ':') === false) $directoryPath = '/'.$directoryPath;

if (!is_dir($directoryPath)) {
mkdir($directoryPath, 0755);
mkdir($directoryPath, 0755, true);
}

$directoryFiles = [];
Expand Down Expand Up @@ -101,7 +104,7 @@
if (stripos($directoryPath, ':') === false) $directoryPath = '/'.$directoryPath;

if (!is_dir($directoryPath)) {
mkdir($directoryPath, 0755);
mkdir($directoryPath, 0755, true);
}

$directoryFiles = [];
Expand Down

0 comments on commit ad53a24

Please sign in to comment.