Skip to content

Commit 4ceb812

Browse files
authored
Merge pull request #74 from LaswitchTech/dev
General: Version bumped to v0.0.74
2 parents ed2d1ac + 7e3be7f commit 4ceb812

3 files changed

Lines changed: 25 additions & 21 deletions

File tree

Helper/CoreHelper.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,13 +622,13 @@ public function unpack(string $source, string $destination): bool
622622
public function delete(string $directory): bool
623623
{
624624
// If it doesn't exist, treat it as an error or success depending on your preference
625-
if (!file_exists($directory)) {
625+
if (!file_exists($directory) && !is_link($directory)) {
626626
// Option 1: Treat as an error
627627
return false;
628628
}
629629

630630
// If it's a file or symlink, just unlink it
631-
if (!is_dir($directory)) {
631+
if (!is_dir($directory) || is_link($directory)) {
632632
if (!@unlink($directory)) {
633633
return false;
634634
}
@@ -641,16 +641,20 @@ public function delete(string $directory): bool
641641
return false;
642642
}
643643

644+
// Loop through each item in the directory
644645
foreach ($items as $item) {
646+
645647
// Skip pointers
646-
if ($item === '.' || $item === '..') {
648+
if (in_array($item,['.','..'])) {
647649
continue;
648650
}
649651

652+
// Full path to the item
650653
$path = $directory . DIRECTORY_SEPARATOR . $item;
651654

652655
// Recursively call delete on each item
653656
if (!$this->delete($path)) {
657+
654658
// If any item fails to be deleted, return false
655659
return false;
656660
}

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.0.73
1+
v0.0.74

src/Builder.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,23 @@ public function js()
297297
$html .= ' const ADMIN_MODE = ' . ($this->Auth->isAuthorized('Administrator', 1) ? 'true' : 'false') . ';' . PHP_EOL;
298298
$html .= '</script>' . PHP_EOL;
299299

300+
// Load Core JS
301+
$path = $this->Config->root() . '/vendor/laswitchtech/core/assets/js';
302+
if(is_file($path.'.cfg')){
303+
if(is_dir($path)){
304+
$assets = json_decode(file_get_contents($path.'.cfg') ?? '[]',true);
305+
foreach($assets as $file){
306+
if(is_file($path.'/'.$file)){
307+
if(str_ends_with($file, '.mjs')){
308+
$html .= '<script type="module" src="/assets/core/js/'.trim($file,'/').'"></script>' . PHP_EOL;
309+
} else {
310+
$html .= '<script src="/assets/core/js/'.trim($file,'/').'"></script>' . PHP_EOL;
311+
}
312+
}
313+
}
314+
}
315+
}
316+
300317
// Load Themes JS
301318
$path = $this->Config->root() . '/lib/themes';
302319
if(is_dir($path)){
@@ -319,23 +336,6 @@ public function js()
319336
}
320337
}
321338

322-
// Load Core JS
323-
$path = $this->Config->root() . '/vendor/laswitchtech/core/assets/js';
324-
if(is_file($path.'.cfg')){
325-
if(is_dir($path)){
326-
$assets = json_decode(file_get_contents($path.'.cfg') ?? '[]',true);
327-
foreach($assets as $file){
328-
if(is_file($path.'/'.$file)){
329-
if(str_ends_with($file, '.mjs')){
330-
$html .= '<script type="module" src="/assets/core/js/'.trim($file,'/').'"></script>' . PHP_EOL;
331-
} else {
332-
$html .= '<script src="/assets/core/js/'.trim($file,'/').'"></script>' . PHP_EOL;
333-
}
334-
}
335-
}
336-
}
337-
}
338-
339339
// Load Themes Assets JS
340340
$path = $this->Config->root() . '/lib/themes';
341341
if(is_dir($path)){

0 commit comments

Comments
 (0)