- Implemented `GET /repo-folders` to list available sub-folders in the configured repository. - Added `POST /push` to push a single page to the repository. - Introduced `POST /push-all` to push all synced pages back to the repository. - Enhanced `oribi_sync_rest_sync` to push local changes after pulling, except during dry runs. - Created `oribi_sync_push_page` and `oribi_sync_push_all` functions to handle page pushing logic. - Updated post meta on successful pushes to track last push time and SHA. - Added logging for push actions and errors. Enhance sync engine to support theme file synchronization - Added functionality to auto-apply changed theme files from the repository's theme directory. - Created `oribi_sync_apply_theme_files` to handle theme file updates during sync. - Ensured the existence of a minimal theme structure in the `ots-theme` directory. Refactor uninstall process to clean up additional post meta - Updated `uninstall.php` to remove new post meta related to push operations. - Ensured comprehensive cleanup of options and metadata upon plugin uninstallation. Introduce push client for handling page pushes to Gitea - Created `push-client.php` to encapsulate logic for pushing pages back to the Git repository. - Implemented conflict resolution by creating branches and opening pull requests when necessary. - Added helper functions for authenticated API requests to Gitea.
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Oribi Sync — Uninstall routine.
|
|
*
|
|
* Called by WordPress when the plugin is deleted via the admin UI.
|
|
* Removes all plugin options from the database.
|
|
*/
|
|
|
|
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit;
|
|
|
|
delete_option( 'oribi_sync_repo' );
|
|
delete_option( 'oribi_sync_branch' );
|
|
delete_option( 'oribi_sync_provider' );
|
|
delete_option( 'oribi_sync_pat' );
|
|
delete_option( 'oribi_sync_last_run' );
|
|
delete_option( 'oribi_sync_log' );
|
|
delete_option( 'oribi_sync_webhook_secret' );
|
|
delete_option( 'oribi_sync_theme_applied' );
|
|
delete_option( 'oribi_sync_push_log' );
|
|
|
|
// Remove sync metadata from posts
|
|
$posts = get_posts( [
|
|
'post_type' => 'page',
|
|
'post_status' => 'any',
|
|
'posts_per_page' => -1,
|
|
'meta_key' => '_oribi_sync_checksum',
|
|
'fields' => 'ids',
|
|
] );
|
|
|
|
foreach ( $posts as $post_id ) {
|
|
delete_post_meta( $post_id, '_oribi_sync_checksum' );
|
|
delete_post_meta( $post_id, '_oribi_sync_git_sha' );
|
|
delete_post_meta( $post_id, '_oribi_sync_source' );
|
|
delete_post_meta( $post_id, '_oribi_sync_last_run' );
|
|
delete_post_meta( $post_id, '_oribi_sync_last_push' );
|
|
delete_post_meta( $post_id, '_oribi_sync_pr_url' );
|
|
}
|
|
|
|
// Clear any scheduled cron
|
|
wp_clear_scheduled_hook( 'oribi_sync_cron_run' );
|