Fix Git Updater configuration with correct Update URI and server URL
Some checks failed
Build Release / Build and Create Release (push) Has been cancelled
Build Release / Deploy to WordPress.org (push) Has been cancelled
ci/woodpecker/push/woodpecker Pipeline is running
ci/woodpecker/tag/woodpecker Pipeline failed

This commit is contained in:
2025-04-12 00:40:22 +01:00
parent 0fa1e048ef
commit 9c557bc46d
4 changed files with 16 additions and 13 deletions

View File

@ -9,7 +9,7 @@ namespace WPAllStars\FixPluginDoesNotExistNotices;
/**
* Class Updater
*
*
* Handles plugin updates from different sources based on installation origin.
*/
class Updater {
@ -59,7 +59,7 @@ class Updater {
private function determine_installation_source() {
// Default to WordPress.org
$source = 'wordpress.org';
// Check if the plugin was installed from GitHub
if ($this->is_github_installation()) {
$source = 'github';
@ -68,7 +68,7 @@ class Updater {
elseif ($this->is_gitea_installation()) {
$source = 'gitea';
}
return $source;
}
@ -80,7 +80,7 @@ class Updater {
private function is_github_installation() {
// Check for GitHub-specific markers in the plugin directory
$plugin_dir = plugin_dir_path($this->plugin_file);
// Look for .git directory with GitHub remote
if (file_exists($plugin_dir . '.git')) {
$git_config = @file_get_contents($plugin_dir . '.git/config');
@ -88,12 +88,12 @@ class Updater {
return true;
}
}
// Check for GitHub-specific files that might indicate it was downloaded from GitHub
if (file_exists($plugin_dir . '.github')) {
return true;
}
return false;
}
@ -105,7 +105,7 @@ class Updater {
private function is_gitea_installation() {
// Check for Gitea-specific markers in the plugin directory
$plugin_dir = plugin_dir_path($this->plugin_file);
// Look for .git directory with Gitea remote
if (file_exists($plugin_dir . '.git')) {
$git_config = @file_get_contents($plugin_dir . '.git/config');
@ -113,7 +113,7 @@ class Updater {
return true;
}
}
return false;
}
@ -136,10 +136,8 @@ class Updater {
// Set the update server based on the installation source
add_filter('gul_update_server', function() {
if ($this->source === 'github') {
return 'https://wpallstars.com'; // GitHub update server
} elseif ($this->source === 'gitea') {
return 'https://wpallstars.com'; // Gitea update server
if ($this->source === 'github' || $this->source === 'gitea') {
return 'https://git-updater.wpallstars.com'; // Update server for both GitHub and Gitea
}
return '';
});