Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MultiSite pull logic for attachments #29

Closed
bobbingwide opened this issue Mar 14, 2019 · 3 comments
Closed

Update MultiSite pull logic for attachments #29

bobbingwide opened this issue Mar 14, 2019 · 3 comments

Comments

@bobbingwide
Copy link
Owner

bobbingwide commented Mar 14, 2019

The MultiSite pull logic does not handle attachments correctly. The attached file is not copied and the resulting URL is wrong. This can lead to a 500 internal error
e.g.
After copying from woocommerce.wp.a2z into blocks.wp.a2z the URL for the WooCommerce icon was set to

https://blocks.wp.a2z/wp-content/uploads/sites/10/2016/04/woocommerce-icon-256x256-1.png

but the file did not exist.

Copying the file manually didn't seem to resolve the problem.
Probably due to _wp_attachment_metadata being wrong/missing.

@bobbingwide
Copy link
Owner Author

oik_clone_attachment_file() needs to create the directory for the target file otherwise you get a strange message from PHP.

Warning: copy(
C:\apache\htdocs\wp-a2z/wp-content/uploads/sites/10/2016/07/wordpress-core-icon-256x256.jpg):
failed to open stream: 
No such file or directory in 
C:\apache\htdocs\wordpress\wp-content\plugins\oik-clone\tests\test-php-copy.php on line 9

It's not at all obvious since the file name given in the message is the target file name.
If there was a problem with the source file you'd see the same message but with the invalid source file name.

Solution: mkdir( dirname( $target )) before the copy().
but you also need to check that the folder doesn't already exist.

@bobbingwide
Copy link
Owner Author

The oik-clone admin page does not list all the attachments... only those which are not attached.

bobbingwide added a commit that referenced this issue Mar 25, 2019
…S pull logic to perform mapping and create target folder for attachments
@bobbingwide bobbingwide added this to In progress in oik-clone v2.0.0 Jun 17, 2019
@bobbingwide
Copy link
Owner Author

oik-clone v2.0.0 has been released. Closing this issue.

oik-clone v2.0.0 automation moved this from In progress to Done Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant