modxcms / revolution

MODX Revolution - Content Management Framework
https://modx.com/
GNU General Public License v2.0
1.36k stars 529 forks source link

Add version_compare() to MODx js #12206

Open pepebe opened 9 years ago

pepebe commented 9 years ago

Don't know if this has already been done, but I have a humble feature request.

Considering a bunch of problems migrating packages, snippets and plugins for from revo 2.2 to 2.3 (example: https://github.com/modxcms/revolution/issues/831), I vote for something like "version_compare" (http://phpjs.org/functions/version_compare/) to be included in the core.

Its very useful and I see home-grown solutions for this problem in a lot if places.

Cheers,

pepebe

exside commented 9 years ago

can this not be accomplished with php's version_compare() and $modx->getVersionData()?

argnist commented 9 years ago

Easy way to know 2.2 or 2.3 in manager JS: MODx.config.connector_url is undefined in 2.2

pepebe commented 9 years ago

@exside: Thanks, I can see that http://rtfm.modx.com/revolution/2.x/developing-in-modx/other-development-resources/class-reference/modx/modx.getversiondata is quite useful, but it solves the problem on a php level, which might not always be an option.

@argnist. Neat :) It totally beats substr(getVersionData['full_version'], 0, 3);

Mark-H commented 2 years ago

Including a library for such a limited use case seems like overkill; generally feature detection would be preferred to version sniffing as well I'd say.

Removing from the 3.0 milestone.