Automattic / Automattic/gp-import-export

PHP Warnings during export

Open
#11 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
PHP
Stars
6
Forks
2
PR merge metrics
No merged PRs in 30d

Description

This plugin is running on translate.wordpress.org and is generating some warnings during export.

For example:
```
E_WARNING: file_put_contents(/tmp/meta-openverse-2024-01-02-0239/meta-openverse-su.jed.json): failed to open stream: No such file or directory in wp-content/plugins/gp-import-export/includes/router.php:108
```

This suggests that either
- The `mkdir()` is failing, and it's spitting out an empty ZIP sometimes (I guess)
- Multiple requests are running within the same minute on the same server, causing it to delete the directory out of underneath another process.

https://github.com/Automattic/gp-import-export/blob/master/includes/router.php#L76-L86

As it also ends up generating this warning sometimes, it would suggest that it's likely that the directory was never created.
```
E_WARNING: rmdir(/tmp/meta-openverse-2024-01-02-0309): No such file or directory in wp-content/plugins/gp-import-export/gp-import-export.php:78
```

It might also be worth using `wp_mkdir_p()` instead of `mkdir()` directly.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading includes/router.php around lines 76-108 and gp-import-export.php around line 78, then reproduce an export on translate.wordpress.org or inspect how its temporary directory is created and removed. Determine whether concurrent requests can remove or reuse the same directory; done means exports complete without the reported file_put_contents or rmdir warnings and do not produce empty ZIP files.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.