This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 6 replies, has 2 voices.

Last updated by Bruno Kos 5 months, 2 weeks ago.

Assigned support staff: Bruno Kos.

Author Posts
May 7, 2019 at 10:36 am #3756473

charlottev-6

Hi,

I'am trying to upload a valid ZIP file containing xliff translation jobs.

It is not clear for me, why the ZIP file gives an "Incompatible Archive" message.

If I can provide you two zip files, one that is working and an other that is not working (in a private message).

PHP does not give a error.

May 7, 2019 at 11:23 am #3757023

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

Please see this answer:
https://wpml.org/forums/topic/can-not-import-translated-xliff-not-a-valid-xliff-file/#post-2475163

It is not clear for me, why the ZIP file gives an "Incompatible Archive" message.

Can you tell me if you asked host about this perhaps - maybe a write permission somewhere (based on the answer above)?

Otherwise, I have marked your next reply as private - can you put the link of the files into Duplicator package field so that I can try on my localhost as well (so that we exclude write permission error)?

Regards,
Bruno Kos

May 7, 2019 at 3:32 pm #3759821

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

I've tried it on my localhost - these are the results:

ArchiveOld.zip - it worked (I got The uploaded xliff file doesn't belong to this system, as expected)
ArchiveNew.zip - I also got "Incompatible Archive

But then I did the following - extracted the files from ArchiveNew.zip and created a new zip archive (I am using Kubuntu Linux OS, which uses Ark KDE Archiving tool). After that I tried to upload it and got "The uploaded xliff file doesn't belong to this system", meaning that it would most likely work. So the solution might be very simple hopefully - simply extract files and create an archive anew. It might help :).

Regards,
Bruno Kos

May 7, 2019 at 4:47 pm #3760717

charlottev-6

Hi Bruno,
thnx again for the prompt reply!

Your suggestion is indeed one of the solutions I had in mind.

But I also want to understand why ArchiveOld.zip is not accepted.

WPML is generating the message "Incompatible Archive", so can you tell me what checks WPML do?

May 8, 2019 at 8:24 am #3764553

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

WPML is generating the message "Incompatible Archive", so can you tell me what checks WPML do?

Please see this answer:
https://wpml.org/forums/topic/can-not-import-translated-xliff-not-a-valid-xliff-file/#post-2475163

George is our 3rd tier support and he said this in that reply: "Yes, WPML uses the temporary folder that PHP uses to read and generate the appropriate xliff files. You can take a look at the method import_xliff() in /wpml-translation-management/classes/xliff/class-wpml-tm-xliff-frontend.php"

Here is a chunk of code from there with our error message:

  
		if ( class_exists( 'ZipArchive' ) ) {
					$z     = new ZipArchive();
					$zopen = $z->open( $file['tmp_name'], 4 );
					if ( true !== $zopen ) {
						$this->error = new WP_Error( 'incompatible_archive', __( 'Incompatible Archive.', 'wpml-translation-management' ) );

						return false;
					}
					$empty_files = array();
					for ( $i = 0; $i < $z->numFiles; $i ++ ) {
						if ( ! $info = $z->statIndex( $i ) ) {
							$this->error = new WP_Error( 'stat_failed', __( 'Could not retrieve file from archive.', 'wpml-translation-management' ) );

							return false;
						}
						$content = $z->getFromIndex( $i );
						if ( false === (bool) $content ) {
							$empty_files[] = $info['name'];
						}
						$contents[ $info['name'] ] = $content;
					}
					if ( $empty_files ) {
						$this->error = new WP_Error( 'extract_failed', __( 'The archive contains one or more empty files.', 'wpml-translation-management' ), $empty_files );

						return false;
					}
				} else {
					require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
					$archive = new PclZip( $file['tmp_name'] );
					// Is the archive valid?
					$archive_files = $archive->extract( PCLZIP_OPT_EXTRACT_AS_STRING );
					if ( false == $archive_files ) {
						$this->error = new WP_Error( 'incompatible_archive', __( 'You are trying to import an incompatible Archive.', 'wpml-translation-management' ), $archive->errorInfo( true ) );

						return false;
					}

According do this:

 require_once ABSPATH . 'wp-admin/includes/class-pclzip.php'; 

It would seem that WordPress core function is also included in this, so the issue might be with the zip alone, something went wrong there and recreating it anew would fix it.

Hopefully this will shed some light of this, not sure what else to add here.

Regards,
Bruno Kos

May 8, 2019 at 10:41 am #3765659

charlottev-6

Hi Bruno,
Again thnx for the prompt reply, I really appreciate that!

This morning I also searched for the error log in the WPML plugins and also found class-wpml-tm-xliff-frontend.php. Because for some ZIP files the import goes OK and some not, I presume the PHP class ZipArchive cannot read the ZIP format. Possible there are some issues with the ZIP generator on the client site (Translators).

May 8, 2019 at 12:06 pm #3766439

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Possible there are some issues with the ZIP generator on the client site (Translators).

That would be the only explanation for this, I have no idea what else could it be indeed.

Regards,
Bruno Kos