WWBN / AVideo

Create Your Own Broadcast Network With AVideo Platform Open-Source. OAVP OVP
https://avideo.tube/AVideo_OpenSource
Other
1.91k stars 972 forks source link

Unable to remove video's with mysql errors in log #2029

Closed ustoopia closed 5 years ago

ustoopia commented 5 years ago

I'm a very happy user of youphptube. So great work all!!

I currently have an issue with a youphptube installation ubuntu 18.04. I am unable to remove several video's that I've uploaded directly as mp4. When I delete it , the site shows me a progress bar that doesn't go away untill I refresh the page. I've tried to leave it running a long long time to see if that works but that's not the issue. One thing worth mentioning is that my videos directory is actually a symlink to a different drive. But I've never had any issues with that before, and nothing has changed in that so I didn't think that would have anything to do with the issue. So, I checked out the youphptube.log file and noticed some errors at the time I tried to delete the video. I have no idea what this error message means so I decided to create this ticket. The error message is at the bottom here:

    [2] => Array
        (
            [file] => /var/www/web8/web/objects/videoDelete.json.php
            [line] => 22
            [function] => delete
            [class] => Video
            [object] => Video Object
                (
                    [id:Video:private] => 81
                    [title:Video:private] => Spitsbroers
                    [clean_title:Video:private] => spitsbroers
                    [filename:Video:private] => Spitsbroers_5d700a52b525f7.92116550
                    [description:Video:private] => 
                    [views_count:Video:private] => 3
                    [status:Video:private] => u
                    [duration:Video:private] => 0:47:08
                    [users_id:Video:private] => 2
                    [categories_id:Video:private] => 11
                    [old_categories_id:Video:private] => 
                    [type:Video:private] => video
                    [rotation:Video:private] => 0
                    [zoom:Video:private] => 1
                    [videoDownloadedLink:Video:private] => 
                    [videoLink:Video:private] => 
                    [next_videos_id:Video:private] => 72
                    [isSuggested:Video:private] => 0
                    [videoGroups:Video:private] => 
                    [youtubeId:Video:private] => 
                    [user] => Andre
                    [name] => Andre
                    [email] => myemail@gmail.com
                    [password] => perhapsnot
                    [created] => 2019-09-04 21:02:42
                    [modified] => 2019-09-10 13:31:40
                    [isAdmin] => 1
                    [photoURL] => videos/userPhoto/photo2.png
                    [lastLogin] => 2019-09-10 13:19:49
                    [recoverPass] => ornot
                    [backgroundURL] => videos/userPhoto/background2.png
                    [canStream] => 1
                    [canUpload] => 1
                    [canViewChart] => 0
                    [about] => 
                    [channelName] => SB
                    [emailVerified] => 1
                    [analyticsCode] => 
                    [externalOptions] => YTowOnt9
                    [order] => 1
                    [next_title] => Spitsbroers2
                    [next_clean_title] => spitsbroers
                    [next_filename] => Spitsbroers_5d70098ad15ba5.46468512
                    [next_id] => 72
                    [category_id] => 11
                    [iconClass] => fa fa-fw iconpicker-component
                    [category] => Spitbroers
                    [clean_category] => spitbroers
                    [category_description] => 
                    [category_order] => 0
                    [videoCreation] => 2019-09-04 21:02:42
                    [likes] => 0
                    [dislikes] => 0
                    [myVote] => 
                    [groups] => Array
                        (
                        )
                )
            [type] => ->
            [args] => Array
                (
                )
        )
)
[10-Sep-2019 13:43:39 Europe/Berlin] Error in writeSql : (1451) Cannot delete or update a parent row: a foreign key constraint fails (`dt_youphptube`.`videos`, CONSTRAINT `fk_videos_videos1` FOREIGN KEY (`next_videos_id`) REFERENCES `videos` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION), SQL-CMD:DELETE FROM videos WHERE id = ?

The above doesn't look like Chinese but it might as well because that's how much of it I can understand from it. I'm hoping that somebody who does have knowledge on this can tell me what the problem is, and hopefully also provide a solution :-)

Thanks in advance!!

JoshWho commented 5 years ago

Not sure what would cause that but I would redact some of that you are showing and change your password to that account now on your site.

ustoopia commented 5 years ago

I edited that before posting it is doesn't reflect the real password or videofile names etc

DanielnetoDotCom commented 5 years ago

Looks like the video you are trying to delete is setup as a next video somewhere

image

But if you are using the regular delete button and the newest version of YouPHPTube it should not be a problem because we delete all relations

https://github.com/YouPHPTube/YouPHPTube/blob/956e565c6266b92e2527530beb42b850e12652f4/objects/video.php#L1250

ustoopia commented 5 years ago

The video's indeed used to have a next video set. But during troubleshooting I thought that this might be the cause of my problem, so I removed all the Next video links and they are now labeled as: Next video NOT set. This unfortunately did not resolve the issue.

Capture

I usually use the default delete button shown in the screenshot. What I also tried is to select several video's and delete them all at once using the top buttons. But in both cases I get the same result.

Capture2

After testing a bit more I found out that whenever I add a new video, and try to delete it afterwards, everything goes fine. It's just a handful of older video's that I can't seem to get rid of.

If this turns out to be an issue that no human can explain, I should find another way to remove the video's cleanly. So my next question is... Can I cleanly remove everything related to these video's directly in the database using phpmyadmin or heidisql? If so, where should I pay attention to and what data should I remove. I'm not a big fan of editing data within databases manually but if that gets the trick done then I may want to go ahead and pursue that solution. Any tips are welcome..

Thanks!

DanielnetoDotCom commented 5 years ago

I am not sure what data may be removed on PHPMYADMIN, if you remove all next videos from your database, your logo should show some other error.

ustoopia commented 5 years ago

I'm not sure what you are saying.... What would you guys suggest I do now? What's the best way to remove these video's without breaking everything else?

JoshWho commented 5 years ago

I would make a backup first then just drop rows out of the Videos Table. If it messes up then just import the old one back.

ustoopia commented 5 years ago

Ok. I will try this. Thanks

ustoopia commented 5 years ago

I would make a backup first then just drop rows out of the Videos Table. If it messes up then just import the old one back.

This turned out to be easier as I thought. And it did indeed solve my problem, so thank you very much!! This also gave me a chance to get to know database structure a little bit, which is nice. Again, thank you for the support!

Greetings from the Netherlands

JoshWho commented 5 years ago

Good deal. Glad it worked out for you.