From fe569069da766df99f240737f28e7ada1b1dbb1f Mon Sep 17 00:00:00 2001 From: Cyril Date: Mon, 14 Dec 2015 02:48:50 -0600 Subject: [PATCH 1/2] Not deleting other webhooks Paymill could be used in the organization for several purposes. Since webhooks are not mutually exclusive, there is simply no need to delete other webhooks found. --- lib/setup.inc.php | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/lib/setup.inc.php b/lib/setup.inc.php index 2907dab..d770af2 100644 --- a/lib/setup.inc.php +++ b/lib/setup.inc.php @@ -35,19 +35,6 @@ function paymill_install_webhooks(){ }catch(Exception $e){ echo __($e->getMessage(),'paymill'); } - - // orphaned webhooks found, delete them - try{ - if($webhooks != false){ - foreach($webhooks as $hook){ - $GLOBALS['paymill_loader']->request_webhook = new $GLOBALS['paymill_loader']->request_webhook; // re-init class - $GLOBALS['paymill_loader']->request_webhook->setId($hook['id']); - $response = $GLOBALS['paymill_loader']->request->delete($GLOBALS['paymill_loader']->request_webhook); - } - } - }catch(Exception $e){ - echo __($e->getMessage(),'paymill'); - } } // still here? create new webhook @@ -107,8 +94,6 @@ function paymill_check_webhook(){ $webhook_found .= ''; $nothing_found = false; - }else{ - $additional_webhooks[] = $webhook['id']; } } } @@ -119,12 +104,7 @@ function paymill_check_webhook(){ }elseif($webhook_found){ $output .= $webhook_found; } - - if(count($additional_webhooks) > 0){ - $output .= '

'.__('Orphaned Webhooks found:').'

'.implode('
',$additional_webhooks).'
'; - $output .= '

'.__('These orphaned Webhooks should be deleted. Normally this will be done automaticly when saving new API keys via General Settings, but you can delete them via Paymill Dashboard, too.').'

'; - } - + $output .= ''; return $output; @@ -203,4 +183,4 @@ function paymill_install(){ }elseif(get_option('paymill_db_version') != PAYMILL_VERSION){ paymill_install(); } -?> \ No newline at end of file +?> From 4e5fcb397ade72d819b7c5070dd7525cc32a752c Mon Sep 17 00:00:00 2001 From: Cyril Date: Mon, 14 Dec 2015 02:50:54 -0600 Subject: [PATCH 2/2] Removing unnecessary variable --- lib/setup.inc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/setup.inc.php b/lib/setup.inc.php index d770af2..9100f0f 100644 --- a/lib/setup.inc.php +++ b/lib/setup.inc.php @@ -69,7 +69,6 @@ function paymill_check_webhook(){ $webhook_found = false; $nothing_found = true; - $additional_webhooks = array(); $output = false; $output .= '

'.__('Webhook Status Check','paymill').'

'.__('Please note that Webhooks are currently used in WooCommerce integration only.','paymill').'

';