mirror of
https://github.com/soulsites/wp-git-installer.git
synced 2025-11-19 16:15:48 +08:00
Compare commits
2 commits
a38c6fe04d
...
1a4a9c3c36
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a4a9c3c36 | ||
|
|
3bbee760ce |
1 changed files with 6 additions and 6 deletions
|
|
@ -342,7 +342,7 @@ function install_update_github_plugin($repo_url, $access_token, $selected_versio
|
|||
|
||||
// Validate version before checkout
|
||||
if (!empty($selected_version)) {
|
||||
$update_command = "cd " . escapeshellarg($plugin_dir) . " && git fetch --all && git checkout " . escapeshellarg($selected_version) . " 2>&1";
|
||||
$update_command = "cd " . escapeshellarg($plugin_dir) . " && git fetch --all && git reset --hard && git clean -fd && git checkout " . escapeshellarg($selected_version) . " 2>&1";
|
||||
exec($update_command, $output, $return_var);
|
||||
|
||||
if ($return_var !== 0) {
|
||||
|
|
@ -354,8 +354,8 @@ function install_update_github_plugin($repo_url, $access_token, $selected_versio
|
|||
wp_die('Failed to update the plugin. Error: ' . implode("\n", $output));
|
||||
}
|
||||
} else {
|
||||
// If no version specified, just fetch and pull the default branch
|
||||
$update_command = "cd " . escapeshellarg($plugin_dir) . " && git fetch --all && git pull 2>&1";
|
||||
// If no version specified, just fetch and reset to remote branch (overwrites local changes)
|
||||
$update_command = "cd " . escapeshellarg($plugin_dir) . " && git fetch origin && git reset --hard @{u} && git clean -fd 2>&1";
|
||||
exec($update_command, $output, $return_var);
|
||||
|
||||
if ($return_var !== 0) {
|
||||
|
|
@ -633,7 +633,7 @@ function sync_github_project() {
|
|||
|
||||
// Update existing plugin - validate version before checkout
|
||||
if (!empty($version)) {
|
||||
$update_command = "cd " . escapeshellarg($plugin_dir) . " && git fetch --all && git checkout " . escapeshellarg($version) . " 2>&1";
|
||||
$update_command = "cd " . escapeshellarg($plugin_dir) . " && git fetch --all && git reset --hard && git clean -fd && git checkout " . escapeshellarg($version) . " 2>&1";
|
||||
exec($update_command, $output, $return_var);
|
||||
|
||||
if ($return_var !== 0) {
|
||||
|
|
@ -645,8 +645,8 @@ function sync_github_project() {
|
|||
wp_send_json_error('Synchronisierung fehlgeschlagen: ' . implode("\n", $output));
|
||||
}
|
||||
} else {
|
||||
// If no version specified, just fetch and pull the default branch
|
||||
$update_command = "cd " . escapeshellarg($plugin_dir) . " && git fetch --all && git pull 2>&1";
|
||||
// If no version specified, just fetch and reset to remote branch (overwrites local changes)
|
||||
$update_command = "cd " . escapeshellarg($plugin_dir) . " && git fetch origin && git reset --hard @{u} && git clean -fd 2>&1";
|
||||
exec($update_command, $output, $return_var);
|
||||
|
||||
if ($return_var !== 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue