Plugin Directory

Changeset 3765152


Ignore:
Timestamp:
10/25/2026 07:29:43 PM (11 hours ago)
Author:
Gioxx
Message:

Update to version 1.5.16 from GitHub

Location:
posts-to-github-md
Files:
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • posts-to-github-md/tags/1.5.16/CHANGELOG.md

    r3627339 r3765152  
    22
    33All 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.
    412
    513## [1.5.15] - 2026-07-29
  • posts-to-github-md/tags/1.5.16/README.md

    r3626098 r3765152  
    1616## Installation
    1717
    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).
     181. 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).
    19192. Go to **Plugins** in the WordPress dashboard and activate "Posts to GitHub".
    2020
    … …  
    6969
    7070The 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
     74Below 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
     76The 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.
    7177
    7278## WP-CLI
  • posts-to-github-md/tags/1.5.16/includes/ExportTab.php

    r3627339 r3765152  
    8080                    ?>
    8181                    <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                    ?>
    8389                </p>
    8490                <?php $this->render(); ?>
    … …  
    276282            <h2><?php esc_html_e('Taxonomy backup', 'posts-to-github-md'); ?></h2>
    277283            <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'); ?>
    279285            </p>
    280286            <p id="potogh-taxonomy-backup-status">
    … …  
    290296            <?php if ($categoriesUrl !== '' && $tagsUrl !== '') : ?>
    291297                <p class="potogh-taxonomy-backup-links">
     298                    <?php esc_html_e('Go to:', 'posts-to-github-md'); ?>
    292299                    <a href="<?php echo esc_url($categoriesUrl); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html(TaxonomyBackup::CATEGORIES_PATH); ?></a>
    293300                    &middot;
  • posts-to-github-md/tags/1.5.16/includes/functions.php

    r3627311 r3765152  
    2020    $categories = wp_list_pluck(get_the_category($post->ID), 'name');
    2121    $tags = wp_list_pluck(get_the_tags($post->ID) ?: [], 'name');
     22    $exportMeta = owned_export_meta($post->ID);
    2223
    2324    return [
    … …  
    3334        // 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.
    3435        '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'],
    3738    ];
     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 */
     47function 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 */
     73function exclude_export_meta_from_duplicates($excludelist): array
     74{
     75    $excludelist = is_array($excludelist) ? $excludelist : [];
     76    $excludelist[] = '_potogh_*';
     77
     78    return $excludelist;
    3879}
    3980
    … …  
    104145function delete_export_by_id(int $postId): array
    105146{
    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'];
    108150
    109151    if (!$path || !$sha) {
  • posts-to-github-md/tags/1.5.16/post-to-github-md.php

    r3627339 r3765152  
    44 * Plugin URI: https://github.com/gioxx/wp-posts-to-github
    55 * Description: Export published posts as Markdown files to a GitHub repository.
    6  * Version: 1.5.15
     6 * Version: 1.5.16
    77 * Requires PHP: 7.4
    88 * Requires at least: 6.0
    … …  
    2424}
    2525
    26 define('POTOGH_VERSION', '1.5.15');
     26define('POTOGH_VERSION', '1.5.16');
    2727define('POTOGH_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2828define('POTOGH_PLUGIN_URL', plugin_dir_url(__FILE__));
    … …  
    5757    add_action('post_updated', 'POTOGH\\schedule_auto_reexport', 10, 3);
    5858    add_action('potogh_auto_export_event', 'POTOGH\\run_auto_export');
     59    add_filter('duplicate_post_excludelist_filter', 'POTOGH\\exclude_export_meta_from_duplicates');
    5960
    6061    if (defined('WP_CLI') && WP_CLI) {
  • posts-to-github-md/tags/1.5.16/readme.txt

    r3627339 r3765152  
    66Tested up to: 7.0
    77Requires PHP: 7.4
    8 Stable tag: 1.5.15
     8Stable tag: 1.5.16
    99License: GPL v2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    2929
    3030== 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).
     311. 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).
    32322. Activate the plugin through the 'Plugins' menu in WordPress.
    33333. Go to **Settings → Posts to GitHub** and configure a GitHub Personal Access Token and target repository.
    … …  
    5252
    5353== 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
    5458= 1.5.15 =
    5559* 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  
    22    'root' => array(
    33        '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',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
    … …  
    1212    'versions' => array(
    1313        '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',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
  • posts-to-github-md/trunk/CHANGELOG.md

    r3627339 r3765152  
    22
    33All 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.
    412
    513## [1.5.15] - 2026-07-29
  • posts-to-github-md/trunk/README.md

    r3626098 r3765152  
    1616## Installation
    1717
    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).
     181. 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).
    19192. Go to **Plugins** in the WordPress dashboard and activate "Posts to GitHub".
    2020
    … …  
    6969
    7070The 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
     74Below 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
     76The 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.
    7177
    7278## WP-CLI
  • posts-to-github-md/trunk/includes/ExportTab.php

    r3627339 r3765152  
    8080                    ?>
    8181                    <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                    ?>
    8389                </p>
    8490                <?php $this->render(); ?>
    … …  
    276282            <h2><?php esc_html_e('Taxonomy backup', 'posts-to-github-md'); ?></h2>
    277283            <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'); ?>
    279285            </p>
    280286            <p id="potogh-taxonomy-backup-status">
    … …  
    290296            <?php if ($categoriesUrl !== '' && $tagsUrl !== '') : ?>
    291297                <p class="potogh-taxonomy-backup-links">
     298                    <?php esc_html_e('Go to:', 'posts-to-github-md'); ?>
    292299                    <a href="<?php echo esc_url($categoriesUrl); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html(TaxonomyBackup::CATEGORIES_PATH); ?></a>
    293300                    &middot;
  • posts-to-github-md/trunk/includes/functions.php

    r3627311 r3765152  
    2020    $categories = wp_list_pluck(get_the_category($post->ID), 'name');
    2121    $tags = wp_list_pluck(get_the_tags($post->ID) ?: [], 'name');
     22    $exportMeta = owned_export_meta($post->ID);
    2223
    2324    return [
    … …  
    3334        // 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.
    3435        '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'],
    3738    ];
     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 */
     47function 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 */
     73function exclude_export_meta_from_duplicates($excludelist): array
     74{
     75    $excludelist = is_array($excludelist) ? $excludelist : [];
     76    $excludelist[] = '_potogh_*';
     77
     78    return $excludelist;
    3879}
    3980
    … …  
    104145function delete_export_by_id(int $postId): array
    105146{
    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'];
    108150
    109151    if (!$path || !$sha) {
  • posts-to-github-md/trunk/post-to-github-md.php

    r3627339 r3765152  
    44 * Plugin URI: https://github.com/gioxx/wp-posts-to-github
    55 * Description: Export published posts as Markdown files to a GitHub repository.
    6  * Version: 1.5.15
     6 * Version: 1.5.16
    77 * Requires PHP: 7.4
    88 * Requires at least: 6.0
    … …  
    2424}
    2525
    26 define('POTOGH_VERSION', '1.5.15');
     26define('POTOGH_VERSION', '1.5.16');
    2727define('POTOGH_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2828define('POTOGH_PLUGIN_URL', plugin_dir_url(__FILE__));
    … …  
    5757    add_action('post_updated', 'POTOGH\\schedule_auto_reexport', 10, 3);
    5858    add_action('potogh_auto_export_event', 'POTOGH\\run_auto_export');
     59    add_filter('duplicate_post_excludelist_filter', 'POTOGH\\exclude_export_meta_from_duplicates');
    5960
    6061    if (defined('WP_CLI') && WP_CLI) {
  • posts-to-github-md/trunk/readme.txt

    r3627339 r3765152  
    66Tested up to: 7.0
    77Requires PHP: 7.4
    8 Stable tag: 1.5.15
     8Stable tag: 1.5.16
    99License: GPL v2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    2929
    3030== 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).
     311. 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).
    32322. Activate the plugin through the 'Plugins' menu in WordPress.
    33333. Go to **Settings → Posts to GitHub** and configure a GitHub Personal Access Token and target repository.
    … …  
    5252
    5353== 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
    5458= 1.5.15 =
    5559* 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  
    22    'root' => array(
    33        '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',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
    … …  
    1212    'versions' => array(
    1313        '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',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.