Changeset 3765152
- Timestamp:
- 10/25/2026 07:29:43 PM (11 hours ago)
- Location:
- posts-to-github-md
- Files:
-
- 14 edited
- 1 copied
-
tags/1.5.16 (copied) (copied from posts-to-github-md/trunk )
-
tags/1.5.16/CHANGELOG.md (modified) (1 diff)
-
tags/1.5.16/README.md (modified) (2 diffs)
-
tags/1.5.16/includes/ExportTab.php (modified) (3 diffs)
-
tags/1.5.16/includes/functions.php (modified) (3 diffs)
-
tags/1.5.16/post-to-github-md.php (modified) (3 diffs)
-
tags/1.5.16/readme.txt (modified) (3 diffs)
-
tags/1.5.16/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/README.md (modified) (2 diffs)
-
trunk/includes/ExportTab.php (modified) (3 diffs)
-
trunk/includes/functions.php (modified) (3 diffs)
-
trunk/post-to-github-md.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
posts-to-github-md/tags/1.5.16/CHANGELOG.md
r3627339 r3765152 2 2 3 3 All notable changes to this project are documented in this file. 4 5 ## [1.5.16] - 2026-10-25 6 ### Fixed 7 - Posts cloned with Yoast Duplicate Post (or any plugin that copies post meta) inherited the original post's `_potogh_path`/`_potogh_sha`, so exporting the copy silently overwrote the original's Markdown file on GitHub, and "Delete from GitHub" on the copy could remove it. The recorded path is now trusted only when no older post owns the same path; otherwise the copy gets its own path from its slug. 8 - Test suite: `tests/bootstrap.php` now defines `ABSPATH`, so requiring plugin files no longer ends the PHPUnit run early with a success exit code; `SettingsTest` stubs `sanitize_text_field()`. 9 10 ### Added 11 - `_potogh_*` is added to Yoast Duplicate Post's meta exclude list (`duplicate_post_excludelist_filter`), so new copies no longer carry export meta. 4 12 5 13 ## [1.5.15] - 2026-07-29 -
posts-to-github-md/tags/1.5.16/README.md
r3626098 r3765152 16 16 ## Installation 17 17 18 1. Copy the whole plugin folder to `wp-content/plugins/post -to-github-md/` on your WordPress site (the `vendor/` folder with dependencies is already included: no need to run Composer).18 1. Copy the whole plugin folder to `wp-content/plugins/posts-to-github-md/` on your WordPress site (the `vendor/` folder with dependencies is already included: no need to run Composer). 19 19 2. Go to **Plugins** in the WordPress dashboard and activate "Posts to GitHub". 20 20 … … 69 69 70 70 The stat tiles above the table include **"Exported, no longer published"**: posts that were exported to GitHub at some point but are now a draft, pending, private, scheduled, or trashed in WordPress. Selecting that tile switches to a read-only list with a link to the post and a link to the corresponding file on GitHub. The plugin never deletes files from the repository automatically — if you want the file gone, do it manually on GitHub. 71 72 ## Taxonomy backup 73 74 Below the posts table, the **"Taxonomy backup"** section lets you push a JSON snapshot of your categories and tags to the same GitHub repository: `wp-categories.json` and `wp-tags.json`, written to the repository root regardless of the configured base folder. WordPress stays the source of truth — the plugin only writes to GitHub here, it never reads categories or tags back from the repository. 75 76 The status line tells you whether anything changed since the last upload (new/removed categories or tags), based on a hash stored locally in the database — no extra GitHub API calls just to show that status. Click **"Update categories and tags on GitHub"** to push the current state in a single commit; the button stays enabled even when nothing changed, in case you want to force a commit anyway. Direct links to both files on GitHub sit right below the button. 71 77 72 78 ## WP-CLI -
posts-to-github-md/tags/1.5.16/includes/ExportTab.php
r3627339 r3765152 80 80 ?> 81 81 <br> 82 <a href="#potogh-taxonomy-backup"><?php esc_html_e('Back up categories and tags to GitHub', 'posts-to-github-md'); ?></a> 82 <?php 83 printf( 84 /* translators: %s: link to the Taxonomy backup section further down this page */ 85 esc_html__('Want to back up your categories and tags? Head over to %s.', 'posts-to-github-md'), 86 '<a href="#potogh-taxonomy-backup">' . esc_html__('Taxonomy backup', 'posts-to-github-md') . '</a>' 87 ); 88 ?> 83 89 </p> 84 90 <?php $this->render(); ?> … … 276 282 <h2><?php esc_html_e('Taxonomy backup', 'posts-to-github-md'); ?></h2> 277 283 <p> 278 <?php esc_html_e('Keep a JSON backup of your categories and tags in the same GitHub repository. WordPress stays the source of truth —this only pushes a snapshot; nothing is ever read back from GitHub.', 'posts-to-github-md'); ?>284 <?php esc_html_e('Keep a JSON backup of your categories and tags in the same GitHub repository. WordPress stays the source of truth, this only pushes a snapshot; nothing is ever read back from GitHub.', 'posts-to-github-md'); ?> 279 285 </p> 280 286 <p id="potogh-taxonomy-backup-status"> … … 290 296 <?php if ($categoriesUrl !== '' && $tagsUrl !== '') : ?> 291 297 <p class="potogh-taxonomy-backup-links"> 298 <?php esc_html_e('Go to:', 'posts-to-github-md'); ?> 292 299 <a href="<?php echo esc_url($categoriesUrl); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html(TaxonomyBackup::CATEGORIES_PATH); ?></a> 293 300 · -
posts-to-github-md/tags/1.5.16/includes/functions.php
r3627311 r3765152 20 20 $categories = wp_list_pluck(get_the_category($post->ID), 'name'); 21 21 $tags = wp_list_pluck(get_the_tags($post->ID) ?: [], 'name'); 22 $exportMeta = owned_export_meta($post->ID); 22 23 23 24 return [ … … 33 34 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- reuses WordPress core's own 'the_content' filter to render content as the theme would, not a plugin-defined hook. 34 35 'content_html' => apply_filters('the_content', $post->post_content), 35 'existing_path' => get_post_meta($post->ID, '_potogh_path', true) ?: null,36 'existing_sha' => get_post_meta($post->ID, '_potogh_sha', true) ?: null,36 'existing_path' => $exportMeta['path'], 37 'existing_sha' => $exportMeta['sha'], 37 38 ]; 39 } 40 41 /** 42 * Returns the export path/sha recorded on a post, or nulls when an older post 43 * already owns the same path. Duplicating plugins (e.g. Yoast Duplicate Post) 44 * copy the _potogh_* meta onto the copy: trusting it would make the copy 45 * overwrite (or delete) the original post's file on GitHub. 46 */ 47 function owned_export_meta(int $postId): array 48 { 49 $path = get_post_meta($postId, '_potogh_path', true) ?: null; 50 $sha = get_post_meta($postId, '_potogh_sha', true) ?: null; 51 52 if ($path === null) { 53 return ['path' => null, 'sha' => null]; 54 } 55 56 global $wpdb; 57 58 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- single indexed lookup on a plugin-owned meta key; WP_Query cannot return MIN(post_id) across all statuses. 59 $ownerId = (int) $wpdb->get_var( 60 $wpdb->prepare("SELECT MIN(post_id) FROM {$wpdb->postmeta} WHERE meta_key = '_potogh_path' AND meta_value = %s", $path) 61 ); 62 63 if ($ownerId > 0 && $ownerId !== $postId) { 64 return ['path' => null, 'sha' => null]; 65 } 66 67 return ['path' => $path, 'sha' => $sha]; 68 } 69 70 /** 71 * Keeps Yoast Duplicate Post from copying the export meta onto new copies. 72 */ 73 function exclude_export_meta_from_duplicates($excludelist): array 74 { 75 $excludelist = is_array($excludelist) ? $excludelist : []; 76 $excludelist[] = '_potogh_*'; 77 78 return $excludelist; 38 79 } 39 80 … … 104 145 function delete_export_by_id(int $postId): array 105 146 { 106 $path = get_post_meta($postId, '_potogh_path', true) ?: null; 107 $sha = get_post_meta($postId, '_potogh_sha', true) ?: null; 147 $exportMeta = owned_export_meta($postId); 148 $path = $exportMeta['path']; 149 $sha = $exportMeta['sha']; 108 150 109 151 if (!$path || !$sha) { -
posts-to-github-md/tags/1.5.16/post-to-github-md.php
r3627339 r3765152 4 4 * Plugin URI: https://github.com/gioxx/wp-posts-to-github 5 5 * Description: Export published posts as Markdown files to a GitHub repository. 6 * Version: 1.5.1 56 * Version: 1.5.16 7 7 * Requires PHP: 7.4 8 8 * Requires at least: 6.0 … … 24 24 } 25 25 26 define('POTOGH_VERSION', '1.5.1 5');26 define('POTOGH_VERSION', '1.5.16'); 27 27 define('POTOGH_PLUGIN_DIR', plugin_dir_path(__FILE__)); 28 28 define('POTOGH_PLUGIN_URL', plugin_dir_url(__FILE__)); … … 57 57 add_action('post_updated', 'POTOGH\\schedule_auto_reexport', 10, 3); 58 58 add_action('potogh_auto_export_event', 'POTOGH\\run_auto_export'); 59 add_filter('duplicate_post_excludelist_filter', 'POTOGH\\exclude_export_meta_from_duplicates'); 59 60 60 61 if (defined('WP_CLI') && WP_CLI) { -
posts-to-github-md/tags/1.5.16/readme.txt
r3627339 r3765152 6 6 Tested up to: 7.0 7 7 Requires PHP: 7.4 8 Stable tag: 1.5.1 58 Stable tag: 1.5.16 9 9 License: GPL v2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 29 29 30 30 == Installation == 31 1. Copy the whole plugin folder to `wp-content/plugins/post -to-github-md/` (the `vendor/` folder with dependencies is already included: no need to run Composer).31 1. Copy the whole plugin folder to `wp-content/plugins/posts-to-github-md/` (the `vendor/` folder with dependencies is already included: no need to run Composer). 32 32 2. Activate the plugin through the 'Plugins' menu in WordPress. 33 33 3. Go to **Settings → Posts to GitHub** and configure a GitHub Personal Access Token and target repository. … … 52 52 53 53 == Changelog == 54 = 1.5.16 = 55 * Fixed: posts cloned with Yoast Duplicate Post no longer overwrite (or delete) the original post's exported file; the copy gets its own path. 56 * Export meta (`_potogh_*`) is now excluded from Yoast Duplicate Post copies. 57 54 58 = 1.5.15 = 55 59 * Taxonomy backup section: fixed intro paragraph layout and added direct links to `wp-categories.json`/`wp-tags.json` on GitHub. -
posts-to-github-md/tags/1.5.16/vendor/composer/installed.php
r3627339 r3765152 2 2 'root' => array( 3 3 'name' => 'gioxx/post-to-github-md', 4 'pretty_version' => 'dev- a5ed5c74ef1919a6ec3e68d64805caf12835ee70',5 'version' => 'dev- a5ed5c74ef1919a6ec3e68d64805caf12835ee70',6 'reference' => ' a5ed5c74ef1919a6ec3e68d64805caf12835ee70',4 'pretty_version' => 'dev-90e87dbd379ea5789fec4a1728121688de9161d1', 5 'version' => 'dev-90e87dbd379ea5789fec4a1728121688de9161d1', 6 'reference' => '90e87dbd379ea5789fec4a1728121688de9161d1', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'gioxx/post-to-github-md' => array( 14 'pretty_version' => 'dev- a5ed5c74ef1919a6ec3e68d64805caf12835ee70',15 'version' => 'dev- a5ed5c74ef1919a6ec3e68d64805caf12835ee70',16 'reference' => ' a5ed5c74ef1919a6ec3e68d64805caf12835ee70',14 'pretty_version' => 'dev-90e87dbd379ea5789fec4a1728121688de9161d1', 15 'version' => 'dev-90e87dbd379ea5789fec4a1728121688de9161d1', 16 'reference' => '90e87dbd379ea5789fec4a1728121688de9161d1', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../', -
posts-to-github-md/trunk/CHANGELOG.md
r3627339 r3765152 2 2 3 3 All notable changes to this project are documented in this file. 4 5 ## [1.5.16] - 2026-10-25 6 ### Fixed 7 - Posts cloned with Yoast Duplicate Post (or any plugin that copies post meta) inherited the original post's `_potogh_path`/`_potogh_sha`, so exporting the copy silently overwrote the original's Markdown file on GitHub, and "Delete from GitHub" on the copy could remove it. The recorded path is now trusted only when no older post owns the same path; otherwise the copy gets its own path from its slug. 8 - Test suite: `tests/bootstrap.php` now defines `ABSPATH`, so requiring plugin files no longer ends the PHPUnit run early with a success exit code; `SettingsTest` stubs `sanitize_text_field()`. 9 10 ### Added 11 - `_potogh_*` is added to Yoast Duplicate Post's meta exclude list (`duplicate_post_excludelist_filter`), so new copies no longer carry export meta. 4 12 5 13 ## [1.5.15] - 2026-07-29 -
posts-to-github-md/trunk/README.md
r3626098 r3765152 16 16 ## Installation 17 17 18 1. Copy the whole plugin folder to `wp-content/plugins/post -to-github-md/` on your WordPress site (the `vendor/` folder with dependencies is already included: no need to run Composer).18 1. Copy the whole plugin folder to `wp-content/plugins/posts-to-github-md/` on your WordPress site (the `vendor/` folder with dependencies is already included: no need to run Composer). 19 19 2. Go to **Plugins** in the WordPress dashboard and activate "Posts to GitHub". 20 20 … … 69 69 70 70 The stat tiles above the table include **"Exported, no longer published"**: posts that were exported to GitHub at some point but are now a draft, pending, private, scheduled, or trashed in WordPress. Selecting that tile switches to a read-only list with a link to the post and a link to the corresponding file on GitHub. The plugin never deletes files from the repository automatically — if you want the file gone, do it manually on GitHub. 71 72 ## Taxonomy backup 73 74 Below the posts table, the **"Taxonomy backup"** section lets you push a JSON snapshot of your categories and tags to the same GitHub repository: `wp-categories.json` and `wp-tags.json`, written to the repository root regardless of the configured base folder. WordPress stays the source of truth — the plugin only writes to GitHub here, it never reads categories or tags back from the repository. 75 76 The status line tells you whether anything changed since the last upload (new/removed categories or tags), based on a hash stored locally in the database — no extra GitHub API calls just to show that status. Click **"Update categories and tags on GitHub"** to push the current state in a single commit; the button stays enabled even when nothing changed, in case you want to force a commit anyway. Direct links to both files on GitHub sit right below the button. 71 77 72 78 ## WP-CLI -
posts-to-github-md/trunk/includes/ExportTab.php
r3627339 r3765152 80 80 ?> 81 81 <br> 82 <a href="#potogh-taxonomy-backup"><?php esc_html_e('Back up categories and tags to GitHub', 'posts-to-github-md'); ?></a> 82 <?php 83 printf( 84 /* translators: %s: link to the Taxonomy backup section further down this page */ 85 esc_html__('Want to back up your categories and tags? Head over to %s.', 'posts-to-github-md'), 86 '<a href="#potogh-taxonomy-backup">' . esc_html__('Taxonomy backup', 'posts-to-github-md') . '</a>' 87 ); 88 ?> 83 89 </p> 84 90 <?php $this->render(); ?> … … 276 282 <h2><?php esc_html_e('Taxonomy backup', 'posts-to-github-md'); ?></h2> 277 283 <p> 278 <?php esc_html_e('Keep a JSON backup of your categories and tags in the same GitHub repository. WordPress stays the source of truth —this only pushes a snapshot; nothing is ever read back from GitHub.', 'posts-to-github-md'); ?>284 <?php esc_html_e('Keep a JSON backup of your categories and tags in the same GitHub repository. WordPress stays the source of truth, this only pushes a snapshot; nothing is ever read back from GitHub.', 'posts-to-github-md'); ?> 279 285 </p> 280 286 <p id="potogh-taxonomy-backup-status"> … … 290 296 <?php if ($categoriesUrl !== '' && $tagsUrl !== '') : ?> 291 297 <p class="potogh-taxonomy-backup-links"> 298 <?php esc_html_e('Go to:', 'posts-to-github-md'); ?> 292 299 <a href="<?php echo esc_url($categoriesUrl); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html(TaxonomyBackup::CATEGORIES_PATH); ?></a> 293 300 · -
posts-to-github-md/trunk/includes/functions.php
r3627311 r3765152 20 20 $categories = wp_list_pluck(get_the_category($post->ID), 'name'); 21 21 $tags = wp_list_pluck(get_the_tags($post->ID) ?: [], 'name'); 22 $exportMeta = owned_export_meta($post->ID); 22 23 23 24 return [ … … 33 34 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- reuses WordPress core's own 'the_content' filter to render content as the theme would, not a plugin-defined hook. 34 35 'content_html' => apply_filters('the_content', $post->post_content), 35 'existing_path' => get_post_meta($post->ID, '_potogh_path', true) ?: null,36 'existing_sha' => get_post_meta($post->ID, '_potogh_sha', true) ?: null,36 'existing_path' => $exportMeta['path'], 37 'existing_sha' => $exportMeta['sha'], 37 38 ]; 39 } 40 41 /** 42 * Returns the export path/sha recorded on a post, or nulls when an older post 43 * already owns the same path. Duplicating plugins (e.g. Yoast Duplicate Post) 44 * copy the _potogh_* meta onto the copy: trusting it would make the copy 45 * overwrite (or delete) the original post's file on GitHub. 46 */ 47 function owned_export_meta(int $postId): array 48 { 49 $path = get_post_meta($postId, '_potogh_path', true) ?: null; 50 $sha = get_post_meta($postId, '_potogh_sha', true) ?: null; 51 52 if ($path === null) { 53 return ['path' => null, 'sha' => null]; 54 } 55 56 global $wpdb; 57 58 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- single indexed lookup on a plugin-owned meta key; WP_Query cannot return MIN(post_id) across all statuses. 59 $ownerId = (int) $wpdb->get_var( 60 $wpdb->prepare("SELECT MIN(post_id) FROM {$wpdb->postmeta} WHERE meta_key = '_potogh_path' AND meta_value = %s", $path) 61 ); 62 63 if ($ownerId > 0 && $ownerId !== $postId) { 64 return ['path' => null, 'sha' => null]; 65 } 66 67 return ['path' => $path, 'sha' => $sha]; 68 } 69 70 /** 71 * Keeps Yoast Duplicate Post from copying the export meta onto new copies. 72 */ 73 function exclude_export_meta_from_duplicates($excludelist): array 74 { 75 $excludelist = is_array($excludelist) ? $excludelist : []; 76 $excludelist[] = '_potogh_*'; 77 78 return $excludelist; 38 79 } 39 80 … … 104 145 function delete_export_by_id(int $postId): array 105 146 { 106 $path = get_post_meta($postId, '_potogh_path', true) ?: null; 107 $sha = get_post_meta($postId, '_potogh_sha', true) ?: null; 147 $exportMeta = owned_export_meta($postId); 148 $path = $exportMeta['path']; 149 $sha = $exportMeta['sha']; 108 150 109 151 if (!$path || !$sha) { -
posts-to-github-md/trunk/post-to-github-md.php
r3627339 r3765152 4 4 * Plugin URI: https://github.com/gioxx/wp-posts-to-github 5 5 * Description: Export published posts as Markdown files to a GitHub repository. 6 * Version: 1.5.1 56 * Version: 1.5.16 7 7 * Requires PHP: 7.4 8 8 * Requires at least: 6.0 … … 24 24 } 25 25 26 define('POTOGH_VERSION', '1.5.1 5');26 define('POTOGH_VERSION', '1.5.16'); 27 27 define('POTOGH_PLUGIN_DIR', plugin_dir_path(__FILE__)); 28 28 define('POTOGH_PLUGIN_URL', plugin_dir_url(__FILE__)); … … 57 57 add_action('post_updated', 'POTOGH\\schedule_auto_reexport', 10, 3); 58 58 add_action('potogh_auto_export_event', 'POTOGH\\run_auto_export'); 59 add_filter('duplicate_post_excludelist_filter', 'POTOGH\\exclude_export_meta_from_duplicates'); 59 60 60 61 if (defined('WP_CLI') && WP_CLI) { -
posts-to-github-md/trunk/readme.txt
r3627339 r3765152 6 6 Tested up to: 7.0 7 7 Requires PHP: 7.4 8 Stable tag: 1.5.1 58 Stable tag: 1.5.16 9 9 License: GPL v2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 29 29 30 30 == Installation == 31 1. Copy the whole plugin folder to `wp-content/plugins/post -to-github-md/` (the `vendor/` folder with dependencies is already included: no need to run Composer).31 1. Copy the whole plugin folder to `wp-content/plugins/posts-to-github-md/` (the `vendor/` folder with dependencies is already included: no need to run Composer). 32 32 2. Activate the plugin through the 'Plugins' menu in WordPress. 33 33 3. Go to **Settings → Posts to GitHub** and configure a GitHub Personal Access Token and target repository. … … 52 52 53 53 == Changelog == 54 = 1.5.16 = 55 * Fixed: posts cloned with Yoast Duplicate Post no longer overwrite (or delete) the original post's exported file; the copy gets its own path. 56 * Export meta (`_potogh_*`) is now excluded from Yoast Duplicate Post copies. 57 54 58 = 1.5.15 = 55 59 * Taxonomy backup section: fixed intro paragraph layout and added direct links to `wp-categories.json`/`wp-tags.json` on GitHub. -
posts-to-github-md/trunk/vendor/composer/installed.php
r3627339 r3765152 2 2 'root' => array( 3 3 'name' => 'gioxx/post-to-github-md', 4 'pretty_version' => 'dev- a5ed5c74ef1919a6ec3e68d64805caf12835ee70',5 'version' => 'dev- a5ed5c74ef1919a6ec3e68d64805caf12835ee70',6 'reference' => ' a5ed5c74ef1919a6ec3e68d64805caf12835ee70',4 'pretty_version' => 'dev-90e87dbd379ea5789fec4a1728121688de9161d1', 5 'version' => 'dev-90e87dbd379ea5789fec4a1728121688de9161d1', 6 'reference' => '90e87dbd379ea5789fec4a1728121688de9161d1', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 12 12 'versions' => array( 13 13 'gioxx/post-to-github-md' => array( 14 'pretty_version' => 'dev- a5ed5c74ef1919a6ec3e68d64805caf12835ee70',15 'version' => 'dev- a5ed5c74ef1919a6ec3e68d64805caf12835ee70',16 'reference' => ' a5ed5c74ef1919a6ec3e68d64805caf12835ee70',14 'pretty_version' => 'dev-90e87dbd379ea5789fec4a1728121688de9161d1', 15 'version' => 'dev-90e87dbd379ea5789fec4a1728121688de9161d1', 16 'reference' => '90e87dbd379ea5789fec4a1728121688de9161d1', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../',
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)