From 785e6df89e9730b8ae02a4245bc9fb0115b3735a Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Sun, 13 Apr 2025 01:53:34 +0100 Subject: [PATCH] Fix View details link and Git Updater integration, update deploy script to use build.sh --- scripts/deploy-local.sh | 26 ++++++++++++++++-------- wp-fix-plugin-does-not-exist-notices.php | 23 ++++++++++++--------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/scripts/deploy-local.sh b/scripts/deploy-local.sh index acad82c..ed82ec7 100755 --- a/scripts/deploy-local.sh +++ b/scripts/deploy-local.sh @@ -3,9 +3,22 @@ # Exit on error set -e -# Define source and destination paths -SOURCE_DIR="/Users/marcusquinn/Git/wp-fix-plugin-does-not-exist-notices" -DEST_DIR="/Users/marcusquinn/Local/plugin-testing/app/public/wp-content/plugins/wp-fix-plugin-does-not-exist-notices" +# Define paths +PLUGIN_SLUG="wp-fix-plugin-does-not-exist-notices" +SOURCE_DIR="/Users/marcusquinn/Git/wp-fix-plugin-does-not-exist-notices/build/$PLUGIN_SLUG" +DEST_DIR="/Users/marcusquinn/Local/plugin-testing/app/public/wp-content/plugins/$PLUGIN_SLUG" + +# Check if build directory exists +if [ ! -d "$SOURCE_DIR" ]; then + echo "Build directory not found. Running build script first..." + cd /Users/marcusquinn/Git/wp-fix-plugin-does-not-exist-notices + ./build.sh "$(grep -m 1 "Version:" wp-fix-plugin-does-not-exist-notices.php | awk -F': ' '{print $2}' | tr -d '[:space:]')" + # Exit if build failed + if [ ! -d "$SOURCE_DIR" ]; then + echo "❌ Build failed: Build directory was not created" + exit 1 + fi +fi # Check if destination directory exists, create if not if [ ! -d "$DEST_DIR" ]; then @@ -15,12 +28,7 @@ fi # Rsync the plugin files to the local WordPress installation echo "Deploying to local WordPress installation..." -rsync -av --delete \ - --exclude-from="$SOURCE_DIR/.gitignore" \ - --exclude="scripts" \ - --exclude=".git" \ - --exclude=".gitignore" \ - "$SOURCE_DIR/" "$DEST_DIR/" +rsync -av --delete "$SOURCE_DIR/" "$DEST_DIR/" echo "✅ Local deployment successful!" echo "Plugin deployed to: $DEST_DIR" diff --git a/wp-fix-plugin-does-not-exist-notices.php b/wp-fix-plugin-does-not-exist-notices.php index 1cad0e0..ecd655f 100644 --- a/wp-fix-plugin-does-not-exist-notices.php +++ b/wp-fix-plugin-does-not-exist-notices.php @@ -141,12 +141,13 @@ class Fix_Plugin_Does_Not_Exist_Notices { // Add each invalid plugin to the plugin list. foreach ( $invalid_plugins as $plugin_path ) { if ( ! isset( $plugins[ $plugin_path ] ) ) { - $plugin_name = basename( $plugin_path ); + $plugin_name = basename( $plugin_path ); $plugin_slug = dirname( $plugin_path ); if ( '.' === $plugin_slug ) { $plugin_slug = basename( $plugin_path, '.php' ); } + // Create a basic plugin data array $plugins[ $plugin_path ] = array( 'Name' => $plugin_name . ' (File Missing)', /* translators: %s: Path to wp-content/plugins */ @@ -155,20 +156,22 @@ class Fix_Plugin_Does_Not_Exist_Notices { '/wp-content/plugins/' ), 'Version' => FPDEN_VERSION, // Use our plugin version instead of 'N/A' - 'Author' => 'Marcus Quinn & WP ALLSTARS', + 'Author' => 'Marcus Quinn & WP ALLSTARS', 'PluginURI' => 'https://www.wpallstars.com', 'AuthorURI' => 'https://www.wpallstars.com', 'Title' => $plugin_name . ' (' . __( 'Missing', 'wp-fix-plugin-does-not-exist-notices' ) . ')', 'AuthorName' => 'Marcus Quinn & WP ALLSTARS', - // Add fields needed for the "View details" link - 'slug' => $plugin_slug, - 'plugin' => $plugin_path, - // Add fields for plugin details and Git Updater - 'update-supported' => true, - 'GitHub Plugin URI' => 'wpallstars/wp-fix-plugin-does-not-exist-notices', - 'GitHub Branch' => 'main', - 'TextDomain' => 'wp-fix-plugin-does-not-exist-notices', ); + + // Add the data needed for the "View details" link + $plugins[ $plugin_path ]['slug'] = $plugin_slug; + $plugins[ $plugin_path ]['plugin'] = $plugin_path; + $plugins[ $plugin_path ]['type'] = 'plugin'; + + // Add Git Updater fields + $plugins[ $plugin_path ]['GitHub Plugin URI'] = 'wpallstars/wp-fix-plugin-does-not-exist-notices'; + $plugins[ $plugin_path ]['GitHub Branch'] = 'main'; + $plugins[ $plugin_path ]['TextDomain'] = 'wp-fix-plugin-does-not-exist-notices'; } }