Skip to content

Add optional setting to use system temp directory for H5P temporary files#204

Open
Lin87 wants to merge 1 commit intoh5p:masterfrom
Lin87:master
Open

Add optional setting to use system temp directory for H5P temporary files#204
Lin87 wants to merge 1 commit intoh5p:masterfrom
Lin87:master

Conversation

@Lin87
Copy link

@Lin87 Lin87 commented Jan 15, 2026

Hello,

This pull request introduces an optional admin setting that allows H5P to store temporary/working files in the server’s system temporary directory (via PHP's sys_get_temp_dir() function) instead of the H5P plugin directory.

Background

In our environment, WordPress content is stored on AWS Elastic File System (EFS). While EFS works well for persistent content, it performs poorly when handling large numbers of small, frequently changing files—such as those created during H5P uploads and processing.

By using the server's system temp directory for these temporary files, we've observed:

  • Significantly faster upload and processing times
  • Reduced I/O overhead on networked file systems like EFS
  • Improved performance on resource-constrained servers

This aligns with common best practices of using local system temp storage for short-lived working files.

What This PR Does

  • Adds a new admin-configurable setting to enable use of the system temp directory for H5P temporary files
  • Keeps the setting disabled by default, preserving existing behavior
  • Ensures the change is fully opt-in and does not impact existing installations unless explicitly enabled by an administrator

Backward Compatibility & Safety

  • No changes to default behavior
  • No migration required
  • Existing installs will continue to use the current plugin directory unless the setting is enabled
  • The feature is isolated to temporary file handling only

This pull request is based on the earlier work from PR #130, originally submitted several years ago. That PR was created by my colleague and did not receive any follow-up, so this submission reintroduces the feature with minor updates to align with the current H5P codebase.

Thank you for considering this improvement. I'm happy to adjust the implementation or documentation if needed.

Introduces a new admin setting allowing users to store temporary files in the server's system temp folder instead of the plugin directory. Updates settings UI, option handling, and file path logic to support this feature, improving performance on resource-limited servers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant