WordPress.org

Ready to get started?Download WordPress

Forums

After 3.3 upgrade, plugin upgrade deletes files in plugin folder (13 posts)

  1. MikeSoja
    Member
    Posted 2 years ago #

    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.

  2. Chouby
    Member
    Posted 2 years ago #

    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.

  3. That's a poorly written plugin. Store the data in wp-content/ecstatic or some place OUTSIDE the plugin folder :)

  4. MikeSoja
    Member
    Posted 2 years ago #

    --*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?

  5. Chouby
    Member
    Posted 2 years ago #

    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...

  6. 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.

  7. Chouby
    Member
    Posted 2 years ago #

    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 ?

  8. 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).

  9. deltajan
    Member
    Posted 2 years ago #

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

  10. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

  11. Chouby
    Member
    Posted 2 years ago #

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

  12. Eric Andrew Lewis
    Member
    Posted 1 year ago #

    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.

  13. 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.

Topic Closed

This topic has been closed to new replies.

About this Topic