[wp-trac] [WordPress Trac] #19503: Add major core version global for easier plugin/theme development

WordPress Trac wp-trac at lists.automattic.com
Sat Dec 10 17:21:35 UTC 2011


#19503: Add major core version global for easier plugin/theme development
------------------------------------+------------------------------
 Reporter:  johnjamesjacoby         |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  General                 |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+------------------------------
Description changed by johnjamesjacoby:

Old description:

> Problem:
>
> Plugin authors cannot reliably use $wp_version when doing their own
> feature development without hitting a chicken-egg scenario.
>
> Example:
>
> I want a plugin to call function foo_32() for all major WordPress 3.2
> branch versions.
> I want a plugin to call function foo_33() for all major WordPress 3.3
> branch versions.
>
> version_compare() is inadequate for this when used in conjunction with
> WordPress core's versioning scheme:
>
> 3.2.1 is greater than 3.2
> 3.3-RC2 is less than 3.3
>
> Paradox:
>
> version_compare( '3.2', $wp_version ); -- Fails when 3.2.1 comes out
> version_compare( '3.3', $wp_version ); -- Fails before 3.3 is released
>
> Using version_compare() with any combination of operators yields the same
> result.
>
> Proposed Solution:
>
> A new global: $wp_major_version
>
> This would get bumped in trunk when development starts on the next major
> version. It provides plugin and theme authors the luxury of not needing
> to parse the major version out of $wp_version themselves. Patch attached.

New description:

 Problem:

 Plugin/theme authors cannot reliably use $wp_version when doing their own
 feature development without hitting a chicken-egg scenario.

 Example:

 I want a plugin to call function foo_32() for all major WordPress 3.2
 branch versions.
 I want a plugin to call function foo_33() for all major WordPress 3.3
 branch versions.

 version_compare() is inadequate for this when used in conjunction with
 WordPress core's versioning scheme:

 3.2.1 is greater than 3.2
 3.3-RC2 is less than 3.3

 Paradox:

 version_compare( '3.2', $wp_version ); -- Fails when 3.2.1 comes out
 version_compare( '3.3', $wp_version ); -- Fails before 3.3 is released

 Using version_compare() with any combination of operators yields the same
 result.

 Proposed Solution:

 A new global: $wp_major_version

 This would get bumped in trunk when development starts on the next major
 version. It provides plugin and theme authors the luxury of not needing to
 parse the major version out of $wp_version themselves. Patch attached.

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19503#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list