Skip to content

Fix PDF sitemap edge cases and harden release workflows - #9

Merged
jdevalk merged 4 commits into
mainfrom
codex/pdf-sitemap-hardening
Nov 17, 2026
Merged

jdevalk merged 4 commits into
mainfrom
codex/pdf-sitemap-hardening

Conversation

@jdevalk

@jdevalk jdevalk commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Sites with no PDFs currently rescan uploads even when an empty result is cached, and missing or unreadable directories can break sitemap generation. This change reuses empty caches, handles failed directory opens, escapes XML output, and prevents direct access to the plugin file.

Filesystem discovery remains intentional: the documentation explains that PDFs are included independently of media-library registration or parent-post visibility. The plugin also recognizes uppercase extensions, clears its cache when PDF attachments are deleted, uses the home URL for the sitemap index link, and resets generation state between calls.

The deployment workflow pins checkout and WordPress.org deployment actions to verified commit SHAs and replaces the archived release action with GitHub CLI. All workflows default to read-only repository access, with write access limited to the GitHub release job. Scheduled dependency scans now target this repository, and the workflow has been re-enabled after GitHub disabled it for inactivity. PHP_CodeSniffer is explicitly required at 3.13.6 or later in the 3.x series, with the lock file updated to the patched 3.13.6 release for CVE-2026-67434.

Validation:

  • 15 isolated regression checks passed on PHP 7.4.33, 8.2.27, and 8.4.15, using WordPress escaping helpers with stubbed WordPress/Yoast services.
  • Direct-access checks exit silently.
  • PHP 7.4 syntax and repository coding-style checks pass after rebasing onto current main.
  • PHP 7.4+ static compatibility, workflow YAML/permission checks, and git diff --check pass.
  • Composer validation and the locked dependency audit pass with no known vulnerability advisories.
  • No live WordPress integration or release/deployment run was performed.

…r, fix XSL comment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Signed-off-by: Filip Ilic <ilic.filip@gmail.com>
@ilicfilip

Copy link
Copy Markdown
Contributor

Pushed a follow-up commit (860a86d) on top of this PR:

  • Sitemap index link: now uses Yoast's WPSEO_Sitemaps_Router::get_base_url() when available, so it respects index.php permalinks and the wpseo_sitemaps_base_url filter; falls back to home_url() if Yoast's method is missing.
  • Filetypes filter: the filter result is cast to an array before array_map, so a filter returning a single string no longer causes a fatal error.
  • XSL comment: updated to describe what the code actually does (XSL is served from the plugin directory and only applies when on the same domain as the sitemap).

Tested locally: phpcs and lint pass, the index link is correct with normal and index.php permalinks, the Yoast filter is respected, the fallback works with Yoast not loaded, and both sitemaps render in the browser.

Also noting: PDFs attached to private/draft posts are still listed, as before. This PR documents that as intended in the FAQ, so worth confirming that's what we want.

@jdevalk
jdevalk merged commit c32bb68 into main Nov 17, 2026
8 checks passed
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.

2 participants