Skip to content

Override umask value using a preload file loaded by Playground - #560

Merged
fluiddot merged 1 commit into
trunkfrom
fix/avoid-overriding-php-auto-prepend-file
Sep 26, 2024
Merged

Override umask value using a preload file loaded by Playground#560
fluiddot merged 1 commit into
trunkfrom
fix/avoid-overriding-php-auto-prepend-file

Conversation

@fluiddot

@fluiddot fluiddot commented Sep 25, 2024

Copy link
Copy Markdown
Contributor

Related to p1727269932269989-slack-C04GESRBWKW and #555.

Proposed Changes

Testing Instructions

Ensure umask value is overriden

  • Run the app with the command npm start.
  • Create a new site or select one already created.
  • Create the file test.php, at the root level on the site, with the following content:
<?php
// Create file with default umask
$filename = "example-default-umask.txt";
$current_umask = umask();
    echo sprintf("Current umask: %04o<br>", $current_umask);
    $content = 'This is the content of the file.';
if (file_exists($filename)) {
    unlink($filename);
}
if (file_put_contents($filename, $content) !== false) {
    echo "File '$filename' created successfully.<br>";
} else {
    echo "Error creating file '$filename'.<br>";
}
chmod($filename, 0777 - umask());
  • Start the site.
  • Navigate to the PHP file: http://localhost:<PORT>/test.php.
  • Observe the umask value shown on the page is 0022.
  • Navigate to the site folder.
  • Observe that the permissions of the file are rwxr-xr-x (Full access to owner, and only READ and EXECUTE permissions to group and others).

Start a site created with a backup succeeds

  • Run the app with the command npm start.
  • Click on Add site.
  • Drop a backup file.
  • Create the site.
  • Observe the import process succeeds.
  • Start the site.
  • Navigate to the homepage.
  • Observe the site loads successfully.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@fluiddot
fluiddot requested a review from a team September 25, 2024 13:55
@fluiddot fluiddot self-assigned this Sep 25, 2024
@wojtekn

wojtekn commented Sep 26, 2024

Copy link
Copy Markdown
Contributor

Thanks for the fix @fluiddot . It's great that Playground provides a way to add multiple files for preload.

It works well. The output:

Current umask: 0022
File 'example-default-umask.txt' created successfully.

And file permissions:

-rw-r--r--@   1 cyphelf  staff    462 Sep 26 12:43 test.php

I've also tried installing Sage Vite theme, and it worked fine.

@fluiddot
fluiddot merged commit bc5d68a into trunk Sep 26, 2024
@fluiddot
fluiddot deleted the fix/avoid-overriding-php-auto-prepend-file branch September 26, 2024 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants