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

Video file does not get deleted from server in stateless mode #418

Closed
alimuzzaman opened this issue Nov 26, 2019 · 28 comments
Closed

Video file does not get deleted from server in stateless mode #418

alimuzzaman opened this issue Nov 26, 2019 · 28 comments
Assignees
Labels
Milestone

Comments

@alimuzzaman
Copy link
Contributor

https://wordpress.org/support/topic/media-not-synced-to-google-cloud-storage/#post-12172313

I set the wp-stateless settng to “Stateless” but when I upload a video file it does not delete from the local server, i have to synchronize before it is deleted, but this does not happen with image files, for image files when i upload them they are deleted automatically from the server. i use the latest wp-stateless version. this is a major bug that has been with the plugin and you have not solve it. please solve this problem.

@alimuzzaman
Copy link
Contributor Author

The required WordPress version has been increased to 4.7.0 from 4.0.

image

@dewlonse
Copy link

hi alimuzzaman, on the issue of the "video not being deleted from the server on stateless mode" when will the update be released that has this issue solved ?

@alimuzzaman
Copy link
Contributor Author

Hi @dewlonse,
The update will be released soon.

For the time being, you can use https://github.com/wpCloud/wp-stateless/releases/tag/2.3.2-RC.2

@dewlonse
Copy link

thks for the update. But there is still an issue. the issue of the "video not being deleted from the server on stateless mode" was solved but only when you upload a video from the backend admin "media Library" that the video gets deleted from the server. When you upload a video through the frontend using "contact form 7", the video does not delete from the server. But if you upload image file through the frontend using contact form 7, it will delete from the server. You need to please solve this issue.

@dewlonse
Copy link

dewlonse commented Dec 26, 2019

find the attached pictures, of the issue when you upload video file from the frontend, the video does not get deleted from the server while in stateless mode. When you synchronize the video the error goes away and the video file is deleted from the server. The issue is that video files uploaded from the frontend does not automatically synchronize that is why I get the error .
error uploading video file from frontend contact form 7 pics 2
error uploading video file from frontend contact form 7 pics 1

@dewlonse
Copy link

if i remove the plugin and upload the video file from the frontend, it goes to the server and shows no errors.

@dewlonse
Copy link

  1. is there is code snippet that can synchronize video files on the fly , that is video files are automatically synchronized when they are uploaded.
  2. I see that for "Stateless mode" setting the "Synchronize non-images files between Google Storage and local server" when you run the process, files that are already deleted from the server still undergo the synchronization process. is possible to prevent a file from being re-synchronized.
  3. How can I schedule a cron job to synchronized video files ?

@alimuzzaman alimuzzaman modified the milestones: v2.3.2, v2.4.0, v2.3.3 Dec 28, 2019
@alimuzzaman
Copy link
Contributor Author

alimuzzaman commented Dec 30, 2019

Hi @dewlonse

is there is code snippet that can synchronize video files on the fly , that is video files are automatically synchronized when they are uploaded.

Yes, we have a hook for it.

 $gs_path = apply_filters( 'wp_stateless_file_name', $full_local_path_or_url);

do_action( 'sm:sync::syncFile', $gs_path, $full_local_path_or_url);

I see that for "Stateless mode" setting the "Synchronize non-images files between Google Storage and local server" when you run the process, files that are already deleted from the server still undergo the synchronization process. is possible to prevent a file from being re-synchronized.

Sorry, it is by design.

How can I schedule a cron job to synchronized video files ?

Please create a issue. We will look into it.

@alimuzzaman
Copy link
Contributor Author

Hi @dewlonse,
I wasn't able to replicate your issue.
Is there any addon you are using for CF7?

@dewlonse
Copy link

dewlonse commented Dec 30, 2019 via email

@alimuzzaman
Copy link
Contributor Author

@dewlonse
How do you upload videos from the frontend?

find the attached pictures, of the issue when you upload video file from the frontend

@alimuzzaman
Copy link
Contributor Author

@dewlonse

Please send me the code snippet that will synchronize video files on the fly , so that video files are automatically synchronized when they are uploaded

We have to identify what is creating the problem first. Then we can create a solution.

Here is the code you can use to sync a single file:

$gs_path = apply_filters( 'wp_stateless_file_name', $full_local_path_or_url);
do_action( 'sm:sync::syncFile', $gs_path, $full_local_path_or_url);

@dewlonse
Copy link

I use the vidorev theme it has a frontend upload form. https://themeforest.net/item/vidorev-video-wordpress-theme/21798615

@dewlonse
Copy link

This is the upload form, http://demo.beeteam368.com/vidorev/submit-your-video-2/

@alimuzzaman
Copy link
Contributor Author

Can you help us to replicate the issue on our server?

Please send me an mail at alim@udx.io, I will send you details.

@udx udx deleted a comment from dewlonse Dec 30, 2019
@dewlonse
Copy link

the code snippet did not solve the issue. I used the code snippet plugin to paste the code.

@dewlonse
Copy link

This is may have to with mime. Wp-stateless does allow mp4 upload from frontend.

@alimuzzaman
Copy link
Contributor Author

The problem is that VidoRev Extensions don't generate attachment metadata for a video as it does for an image attachment.

WP Stateless works on wp_update_attachment_metadata filter wich is not fired for video files.

In vidorev_cf7_save_posted_data and vidorev_front_end_edit_post_data function adding the following code

$attach_data = wp_generate_attachment_metadata( $attach_id, $movefile['file'] );
wp_update_attachment_metadata( $attach_id, $attach_data );	

after $attach_id = wp_insert_attachment( $attachment, $movefile['file'], $newPostID ); solves the problem.

@dewlonse please contact VidoRev if they add those lines for video attachment then the image will be automatically synced.

I will also try to contact them.

@dewlonse
Copy link

dewlonse commented Jan 1, 2020 via email

@alimuzzaman
Copy link
Contributor Author

It can't be added as a code snippet. You can directly edit their plugin though.

I will add a patch to our plugin for the time being.

@dewlonse
Copy link

dewlonse commented Jan 1, 2020 via email

@alimuzzaman
Copy link
Contributor Author

If you want to directly edit the plugin file. Though I will recommend the patch.
wp-content\plugins\vidorev-extensions\inc\cf7-addons.php

image

wp-content\plugins\vidorev-extensions\inc\front-end-edit-post.php

image

@alimuzzaman
Copy link
Contributor Author

@dewlonse
Copy link

dewlonse commented Jan 2, 2020

1.there is some issues with wp-stateless when synchronizing non-media library files. Files that are not media library files both video and image files, do not get deleted from the local server in stateless mode even when the url is changed to google cloud storage url, this cause file. error
2. is there a code snipet that can prevent auto synchronizing of non-media files (video and image) and also prevent changing there url to google cloud storage url.

@dewlonse
Copy link

dewlonse commented Jan 2, 2020

hi, I added the code to the vidorev extensions as suggested but it did not solve the issue. It is the wp-stateless patch that solve the issue because you made it compatible with the vidorev extension plugin. therefore my theme author does not need to add the codes as you suggested.

@dewlonse
Copy link

dewlonse commented Jan 2, 2020

thank you for solving this issue.

@dewlonse
Copy link

dewlonse commented Jan 2, 2020 via email

alimuzzaman pushed a commit that referenced this issue Jan 3, 2020
Video file does not get deleted from server in stateless mode #418
@alimuzzaman
Copy link
Contributor Author

@dewlonse Please create a new issue if you have further questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants