From 0e41b5d52fdc6af6442816b5f465c9db9f84e126 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 19 Sep 2024 06:51:18 +0200 Subject: Adding upstream version 6.6.1+dfsg1. Signed-off-by: Daniel Baumann --- wp-admin/includes/class-language-pack-upgrader.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'wp-admin/includes/class-language-pack-upgrader.php') diff --git a/wp-admin/includes/class-language-pack-upgrader.php b/wp-admin/includes/class-language-pack-upgrader.php index 855dbe6..6f7cf74 100644 --- a/wp-admin/includes/class-language-pack-upgrader.php +++ b/wp-admin/includes/class-language-pack-upgrader.php @@ -332,26 +332,34 @@ class Language_Pack_Upgrader extends WP_Upgrader { // Check that the folder contains a valid language. $files = $wp_filesystem->dirlist( $remote_source ); - // Check to see if a .po and .mo exist in the folder. - $po = false; - $mo = false; + // Check to see if the expected files exist in the folder. + $po = false; + $mo = false; + $php = false; foreach ( (array) $files as $file => $filedata ) { if ( str_ends_with( $file, '.po' ) ) { $po = true; } elseif ( str_ends_with( $file, '.mo' ) ) { $mo = true; + } elseif ( str_ends_with( $file, '.l10n.php' ) ) { + $php = true; } } + if ( $php ) { + return $source; + } + if ( ! $mo || ! $po ) { return new WP_Error( 'incompatible_archive_pomo', $this->strings['incompatible_archive'], sprintf( - /* translators: 1: .po, 2: .mo */ - __( 'The language pack is missing either the %1$s or %2$s files.' ), + /* translators: 1: .po, 2: .mo, 3: .l10n.php */ + __( 'The language pack is missing either the %1$s, %2$s, or %3$s files.' ), '.po', - '.mo' + '.mo', + '.l10n.php' ) ); } -- cgit v1.2.3