• My own plugin (ecSTATic) has an option to use functions in supplemental files (Maxmind’s geolocation routines) that aren’t included in the basic plugin download. After upgrading ecSTATic to handle the WordPress 3.3 jQuery 1.7 change, I found that the four Maxmind files were gone from the plugin folder. It’s possible other files were deleted as well. During plugin development I tend to stash test files in with the working ones.

    Not sure if this is a bug or a feature.

Viewing 12 replies - 1 through 12 (of 12 total)
  • During an automatic plugin upgrade, the whole plugin directory is removed and then replaced by the upgrade file. It’s what I observed during my own plugin development. So if you want to keep files during the upgrade process, you have to backup them to a transient directory before the upgrade and restore them after the upgrade. I use the filters ‘upgrader_pre_install’ and ‘upgrader_post_install’ to do this.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    That’s a poorly written plugin. Store the data in wp-content/ecstatic or some place OUTSIDE the plugin folder 🙂

    Thread Starter MikeSoja

    (@mikesoja)

    –*Store the data in wp-content/ecstatic or some place OUTSIDE the plugin folder*–

    Tanks a million, but I like Chouby’s idea better.

    Even better, maybe: I could incorporate the three small Maxmind include and php files in the ecSTATic distribution with a dummy, one byte GeoLiteCity.dat file, add a check for filesize or date in my script, which would still allow the option of user choice (simplifying it, actually), and not require other gymnastics and complications.

    Also, this new information made me aware that Maxmind recently updated their include and php files, which happens very rarely, but which might be a thing to keep track of.

    I’m still just a little surprised that plugin upgrades wipe the folder.

    Do they wipe subfolders?

    Yes everything. I am not surprised and I believe it’s the best way to keep the disk clean for example if a plugin author changed the directory structure between two versions.

    @ipstenu: Of course you can store data outside the plugin directory but I prefer keeping everything in one place when it’s possible. I believe that it is more convenient for users and keep things clean. Otherwise, and since I am not aware that there is a common policy for plugin or themes to store local data, we may find files everywhere…

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Otherwise, and since I am not aware that there is a common policy for plugin or themes to store local data, we may find files everywhere…

    There is 🙂 Every plugin that has to write a file for itself is supposed to put it in wp-content, as that is the ONLY folder WordPress upgrades won’t touch.

    I have six plugins that do that.

    (Themes, you should make a child theme, but that’s another story).

    Those are your best practices, as you will find not every host will let you copy files out and back in, in an automated fashion, due to the myriad differences between servers.

    Of course in wp-content or one of its subdirectory. But where exactly ? It’s why I meaned by common policy. I do not have a big experience because I do not use a lot of plugins. I have seen that WP Super Cache creates one folder and two files directly in wp-content while Contact Form 7 creates one folder inside wp-content/uploads. What about others ?

    Those are your best practices, as you will find not every host will let you copy files out and back in, in an automated fashion, due to the myriad differences between servers.

    I do not understand what could be the problem but I am interested to know more. Before the plugin upgrade I move the files in a transient wp-content subdirectory and move them back after the upgrade. Do you mean that some servers would disallow this ? I don’t see much difference (from server point of view) with other plugins which create a wp-content subdirectory and put files inside. Could you explain ?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Most plugins make a folder like wp-content/pluginname

    Do you mean that some servers would disallow this ?

    Exactly.

    I don’t see much difference (from server point of view) with other plugins which create a wp-content subdirectory and put files inside. Could you explain ?

    Not every plugin CAN write to a new folder in wp-content. Mostly this is because people like me lock down that folder so evil plugins can’t. When I install w3-total-cache, for example, which stores multiple files and folders in wp-content, it tells me I have to temporarily allow writing to that folder, so it can create the folder. Then I switch my permissions back and grant them ONLY to that new folder.

    This is for security, and is something I suggest everyone do.

    In addition, not all PHP installs permit this at all, and you have to make allowances for that (DSO is notably annoying that way).

    После обновления WordPress3,2 на 3,3 на сайте не возможно изменить фон, причем с изменением темы остается та же проблема!!!

    @ipstenu: Thank you for your clear explanation. It will help me for the future.

    I just dealt with this problem myself. I heard recently that WordPress updates to core now only modify files that have been updated since the last version, and will leave other files alone.

    I haven’t looked into how that actually works, but I’m wondering if perhaps a similar approach could be taken to plugin updating. Perhaps the old plugin directory could be moved to a tmp location, the new plugin folder unzipped and then a unix ditto-like action to copy out of scope files back into the plugin folder?

    This may be a conversation to have in trac, but thought I’d pose it here first.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Yes, this is true for WordPress core.

    There’s no plan, currently to do that with Plugins, that I’m aware of. I don’t know if the overhead would be worth it, as right now I believe the ‘changed files’ zip in WP is generated automatically.

    That is I believe they say ‘This is 3.4’ and a cool tool says ‘Okay let’s compare to 3.3. Here’s what changed. I’ll put those in wordpress-3.3-incremental.zip! Here you go!’ And then we download a pre-made zip, ONLY if we’re going from 3.3.1 to 3.3.2

    You still get the whole thing going from 3.3.x to 3.4, in order to allow other updatey things to run.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘After 3.3 upgrade, plugin upgrade deletes files in plugin folder’ is closed to new replies.