1 Answer
1

Depending on the plugin version delete the file init.php on upgrading from the plugin folder. For this purpose you can use the Filesystem API, especially the delete() method - here exemplary linked to the WP_Filesystem_Direct class.

I have figured it out a while ago too, but what I use is php method unlink(__FILE__), tested ok on my host server though, is there any benefits using delete()?
– EdwardDec 24 '16 at 17:01

@Edward It has an additional security check, but aside from that does use unlink() too. So pretty much no benefits. One point could be consistency with using WordPress API functions, hasn't to do with functionality though.
– NicolaiDec 25 '16 at 11:10