WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 6 months ago

#35016 new enhancement

New plugin version in upgrader object

Reported by: eclev91 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Upgrade/Install Keywords:
Focuses: Cc:
PR Number:

Description

The current upgrader object only has the old plugin version (->skin->plugin_info['Version'] unless you parse out the source URL.

Plugin_Upgrader Object
(
    [result] => Array
        (
            [source] => Q:/dev/webspec-design/wp-content/upgrade/types.1.8.11/types/
            [source_files] => Array
                (
                    [0] => admin.php
                    [1] => classes
                    [2] => embedded
                    [3] => help.php
                    [4] => includes
                    [5] => marketing
                    [6] => marketing.php
                    [7] => plus
                    [8] => readme.txt
                    [9] => resources
                    [10] => wpcf.php
                    [11] => wpml-config.xml
                )

            [destination] => Q:\dev\webspec-design/wp-content/plugins/types/
            [destination_name] => types
            [local_destination] => Q:\dev\webspec-design/wp-content/plugins
            [remote_destination] => Q:/dev/webspec-design/wp-content/plugins/types/
            [clear_destination] => 1
        )

    [bulk] => 1
    [strings] => Array
        (
            [skin_upgrade_start] => The update process is starting. This process may take a while on some hosts, so please be patient.
            [skin_update_failed_error] => An error occurred while updating %1$s: %2$s
            [skin_update_failed] => The update of %1$s failed.
            [skin_update_successful] => %1$s updated successfully. Show Details
            [skin_upgrade_end] => All updates have been completed.
            [skin_before_update_header] => Updating Plugin %1$s (%2$d/%3$d)
            [bad_request] => Invalid Data provided.
            [fs_unavailable] => Could not access filesystem.
            [fs_error] => Filesystem error.
            [fs_no_root_dir] => Unable to locate WordPress Root directory.
            [fs_no_content_dir] => Unable to locate WordPress Content directory (wp-content).
            [fs_no_plugins_dir] => Unable to locate WordPress Plugin directory.
            [fs_no_themes_dir] => Unable to locate WordPress Theme directory.
            [fs_no_folder] => Unable to locate needed folder (%s).
            [download_failed] => Download failed.
            [installing_package] => Installing the latest version…
            [no_files] => The package contains no files.
            [folder_exists] => Destination folder already exists.
            [mkdir_failed] => Could not create directory.
            [incompatible_archive] => The package could not be installed.
            [files_not_writable] => The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.
            [maintenance_start] => Enabling Maintenance mode…
            [maintenance_end] => Disabling Maintenance mode…
            [up_to_date] => The plugin is at the latest version.
            [no_package] => Update package not available.
            [downloading_package] => Downloading update from %s…
            [unpack_package] => Unpacking the update…
            [remove_old] => Removing the old version of the plugin…
            [remove_old_failed] => Could not remove the old plugin.
            [process_failed] => Plugin update failed.
            [process_success] => Plugin updated successfully.
            [process_bulk_success] => Plugins updated successfully.
        )

    [skin] => Bulk_Plugin_Upgrader_Skin Object
        (
            [plugin_info] => Array
                (
                    [Requires WP] => 
                    [Requires PHP] => 
                    [GitHub Plugin URI] => 
                    [GitHub Branch] => 
                    [GitHub Enterprise] => 
                    [GitHub CE] => 
                    [Bitbucket Plugin URI] => 
                    [Bitbucket Branch] => 
                    [Bitbucket Enterprise] => 
                    [Bitbucket CE] => 
                    [GitLab Plugin URI] => 
                    [GitLab Branch] => 
                    [GitLab Enterprise] => 
                    [GitLab CE] => 
                    [Name] => Types
                    [PluginURI] => http://wordpress.org/extend/plugins/types/
                    [Version] => 1.8.10
                    [Description] => Define custom post types, custom taxonomies and custom fields.
                    [Author] => OnTheGoSystems
                    [AuthorURI] => http://www.onthegosystems.com
                    [TextDomain] => 
                    [DomainPath] => 
                    [Network] => 
                    [Title] => Types
                    [AuthorName] => OnTheGoSystems
                )

            [in_loop] => 
            [error] => 
            [upgrader] => Plugin_Upgrader Object
 *RECURSION*
            [done_header] => 
            [done_footer] => 
            [result] => Array
                (
                    [source] => Q:/dev/webspec-design/wp-content/upgrade/types.1.8.11/types/
                    [source_files] => Array
                        (
                            [0] => admin.php
                            [1] => classes
                            [2] => embedded
                            [3] => help.php
                            [4] => includes
                            [5] => marketing
                            [6] => marketing.php
                            [7] => plus
                            [8] => readme.txt
                            [9] => resources
                            [10] => wpcf.php
                            [11] => wpml-config.xml
                        )

                    [destination] => Q:\dev\webspec-design/wp-content/plugins/types/
                    [destination_name] => types
                    [local_destination] => Q:\dev\webspec-design/wp-content/plugins
                    [remote_destination] => Q:/dev/webspec-design/wp-content/plugins/types/
                    [clear_destination] => 1
                )

            [options] => Array
                (
                    [url] => update.php?action=update-selected&plugins=types%2Fwpcf.php
                    [nonce] => bulk-update-plugins
                    [title] => 
                    [context] => 
                )

            [plugin_active] => 1
        )

    [update_count] => 1
    [update_current] => 1
)

Change History (5)

#1 @eclev91
4 years ago

Ah - by which I mean, it'd be great to get both versions.

#2 @swissspidy
4 years ago

  • Component changed from General to Upgrade/Install

#3 follow-ups: @eclev91
3 years ago

I was looking at patching this - can someone explain the difference between package updates happening via WP_Upgrader->run() vs the bulk_upgrade function within Theme_Upgrader and Plugin_Upgrader and the upgrade function within Core_Upgrader?

#4 in reply to: ↑ 3 @swissspidy
3 years ago

Replying to eclev91:

I was looking at patching this - can someone explain the difference between package updates happening via WP_Upgrader->run() vs the bulk_upgrade function within Theme_Upgrader and Plugin_Upgrader and the upgrade function within Core_Upgrader?

@dd32 or @ocean90 probably know best.

#5 in reply to: ↑ 3 @ocean90
3 years ago

@eclev91 I'm not exactly sure what you're asking for. WP_Upgrader->run() is the underlying method which is called by all upgraders, except Core_Upgrader because it also handles rollbacks and more. run() is used for updates but also for new installs. bulk_upgrade() is used to update multiple plugins at once, upgrade() can only update one package. (Note: In Language_Pack_Upgrader upgrade() is just a wrapper for bulk_upgrade().)

Note: See TracTickets for help on using tickets.