- Added debug statements in `generate-pr-plugin.sh` to display the tarball path, backup directory, and list of files being processed, improving visibility during deployment.
- Updated `pr-plugin-build.yml` to include output of the file list and tarball contents, aiding in verification and troubleshooting during the build process.
- Updated `generate-pr-plugin.sh` to accept an optional plugin URL parameter for improved flexibility.
- Modified the script to generate a default plugin URL if none is provided, ensuring consistent naming conventions.
- Enhanced the GitHub Actions workflow to generate and output stable URLs for both the tarball and plugin files, facilitating easier updates.
- Updated the file extraction method in `generate-pr-plugin.sh` to use a temporary file, improving compatibility and avoiding subshell issues.
- Added cleanup for the temporary file after processing the extracted file list.
- Updated the GitHub Actions workflow to append changed files to the output for PR comments.
- Added debug output to display the list of changed files found during the workflow execution.
- Added error handling and improved variable handling in `generate-pr-plugin.sh`.
- Updated placeholder values in the generated plugin file for clarity.
- Enhanced the UI in `Plugins.page` to indicate that the page is modified for PR testing.
- Updated `generate-pr-plugin.sh` to include a new parameter for TXZ URL and modified usage instructions.
- Enhanced the GitHub Actions workflow to upload the TXZ file to R2 and generate the corresponding public URL.
- Improved installation instructions in the PR comment to provide direct download links for the PLG and TXZ files.
- Added permissions for reading contents and pull requests, and reading actions.
- Introduced a step to retrieve the artifact download URL after uploading the plugin artifact.
- Updated installation instructions to provide direct links for downloading the plugin files from GitHub Artifacts.
- Modified the sed command in `generate-pr-plugin.sh` to support both Linux and macOS environments.
- Updated the `pr-plugin-build.yml` workflow documentation to include a step for creating the necessary plugin directory.
- Changed the local path for the downloaded tarball to include the 'webgui-pr' directory.
- Updated the cleanup command to remove the correct plugin file based on the new path structure.
- Introduced a new script `generate-pr-plugin.sh` to automate the creation of Unraid PR plugin files.
- Added a GitHub Actions workflow `pr-plugin-build.yml` to build and package the plugin when changes are made to the `emhttp` directory.
- The workflow includes steps for checking out code, generating versioning, creating a tarball, and uploading the plugin artifact for PR testing.
- Removed unnecessary 'clone-settings-less-padding' class from the clone-settings div in both SecurityNFS.page and SecuritySMB.page to streamline the layout.
- Added a new form element in ShareEdit.page to enhance share editing functionality.
- Removed unnecessary CSS rules from ShareEdit.css to streamline styling.
- Adjusted padding in default-base.css for better layout consistency.
- Updated CPU load display logic to use dynamic critical and warning thresholds.
- Improved error handling for GraphQL subscription with retry logic and capped backoff.
- Ensured consistent color coding for CPU load indicators.
- Changed Nchan variable to use a consistent naming convention.
- Removed outdated CPU load handling code and replaced it with a GraphQL subscription for real-time CPU metrics.
- Added retry logic for GraphQL subscription initialization.
- Implemented cleanup for the subscription on page unload.
The error occurred because of how searchLink() is called on line 49:
if ($support = searchLink($info, $url) ?: searchLink($info, newurl($url))) {
Here's the sequence of events that caused the issue:
1. First call: searchLink($info, $url) - This works fine if $info contains the JSON data from
/tmp/community.applications/tempFiles/templates.json
2. If first call returns falsy: The ?: operator (shorthand ternary) triggers the second call:
searchLink($info, newurl($url))
3. The problem: When the first searchLink() returns null or false, PHP's ?: operator evaluates
the second expression. However, if $info itself is null (which can happen if the JSON file
doesn't exist or is empty - see line 19 where readJson() returns [] for missing files), then
searchLink(null, newurl($url)) is called.
4. The crash: Inside searchLink(), when $db is null, calling count($db) throws the TypeError
because count() requires an array or Countable object, not null.
Root causes:
- The JSON file at /tmp/community.applications/tempFiles/templates.json might not exist or could
be corrupted
- The readJson() function returns an empty array [] for missing files, but if the JSON decode
fails, it could return null
- The code wasn't defensive against null values being passed to searchLink()
The fix adds is_array($db) check to ensure we only attempt to count when we have a valid array.