diff --git a/.distignore b/.distignore index d0c5bdb8b..eca30b739 100644 --- a/.distignore +++ b/.distignore @@ -6,7 +6,7 @@ resources/ !vendor/mollie/mollie-api-php/Resources vendor/**/test* vendor/mollie/mollie-api-php/examples/ -languages/*.po +languages/ bin/ *.lock composer.json diff --git a/.psalm/stubs.php b/.psalm/stubs.php index b0916a8fc..dc6613dff 100644 --- a/.psalm/stubs.php +++ b/.psalm/stubs.php @@ -4,7 +4,6 @@ function as_unschedule_action($string) {} function mollieWooCommerceIsCheckoutContext() {} function wcs_get_subscriptions($subs) {} function mollieWooCommerceFormatCurrencyValue($value, $currency){} -function mollieDeleteWPTranslationFiles(){} function mollieWooCommerceIsPayPalButtonEnabled($page){} function mollieWooCommerceIsApplePayDirectEnabled($page){} function mollieWooCommerceCheckIfNeedShipping($product){} diff --git a/inc/utils.php b/inc/utils.php index 75427b863..2acee663a 100644 --- a/inc/utils.php +++ b/inc/utils.php @@ -190,50 +190,6 @@ function mollieWooCommerceFormatCurrencyValue($value, $currency) return number_format($value, 2, '.', ''); } -function mollieUpdateCompleted($upgrader_object, $options) -{ - //whenever something gets updated they update the languages, we need to delete them - mollieDeleteWPTranslationFiles(); -} - -function mollieDeleteWPTranslationFiles() -{ - if (!function_exists('WP_Filesystem')) { - require_once ABSPATH . '/wp-admin/includes/file.php'; - } - WP_Filesystem(); - global $wp_filesystem; - if (!$wp_filesystem) { - return; - } - $remote_destination = $wp_filesystem->find_folder(WP_LANG_DIR); - if (!$wp_filesystem->exists($remote_destination)) { - return; - } - $languageExtensions = [ - 'de_DE', - 'de_DE_formal', - 'es_ES', - 'fr_FR', - 'it_IT', - 'nl_BE', - 'nl_NL', - 'nl_NL_formal', - 'en_GB', - 'nl_BE_formal', - ]; - $translationExtensions = ['.mo', '.po', '.l10n.php']; - $destination = WP_LANG_DIR - . '/plugins/mollie-payments-for-woocommerce-'; - foreach ($languageExtensions as $languageExtension) { - foreach ($translationExtensions as $translationExtension) { - $file = $destination . $languageExtension - . $translationExtension; - $wp_filesystem->delete($file, false); - } - } -} - function transformPhoneToNLFormat($phone) { $startsWith06 = preg_match('/^06/', $phone); diff --git a/mollie-payments-for-woocommerce.php b/mollie-payments-for-woocommerce.php index 2085bf537..fbafd7de6 100644 --- a/mollie-payments-for-woocommerce.php +++ b/mollie-payments-for-woocommerce.php @@ -47,20 +47,6 @@ define('M4W_PLUGIN_URL', plugin_dir_url(M4W_FILE)); } -/** - * Called when plugin is activated - */ -function mollie_wc_plugin_activation_hook() -{ - require_once __DIR__ . '/inc/functions.php'; - - if (!mollie_wc_plugin_autoload()) { - return; - } - - mollieDeleteWPTranslationFiles(); -} - function mollie_wc_plugin_autoload() { @@ -174,5 +160,3 @@ function initialize() } add_action('plugins_loaded', __NAMESPACE__ . '\\initialize'); - -register_activation_hook(M4W_FILE, __NAMESPACE__ . '\mollie_wc_plugin_activation_hook'); diff --git a/src/Activation/ActivationModule.php b/src/Activation/ActivationModule.php index 598bcef29..cfab7d182 100644 --- a/src/Activation/ActivationModule.php +++ b/src/Activation/ActivationModule.php @@ -41,7 +41,6 @@ public function run(ContainerInterface $container): bool [$this, 'pluginInit'] ); $this->declareCompatibleWithHPOS(); - $this->handleTranslations(); $this->mollieWcNoticeApiKeyMissing(); $this->appleValidationFileRewriteRules(); return true; @@ -77,20 +76,6 @@ public function initDb() } } - /** - * - */ - public function handleTranslations(): void - { - add_action('upgrader_process_complete', 'mollieUpdateCompleted', 10, 2); - // we need to handle this version specifically, we can remove this on the next - $translationFlag = get_option('mollie_plugin_update_translation'); - if ($translationFlag !== 'yes') { - mollieDeleteWPTranslationFiles(); - update_option('mollie_plugin_update_translation', 'yes'); - } - } - /** * */