cfdocs icon indicating copy to clipboard operation
cfdocs copied to clipboard

Lucee 5 extensionList() method #hacktoberfest

Open michaelborn opened this issue 4 years ago • 1 comments

We're missing documentation for this little-known but extremely handy Lucee-specific method: extensionList().

  • This method takes no arguments
  • This method returns a query object

Here's a quick example of using this method to check the version of an installed extension:

var extension = extensionList().filter( ( extension ) => extension.name == "Hibernate ORM Engine" );
if ( !extension.recordCount ){
  throw( "Hibernate extension is not installed; please install it now" );
} else {
  var installedExtensionVersion = extension.version;
  writeOutput( "You have the Hibernate extension version #installedExtensionVersion# installed. " );
}

https://github.com/lucee/Lucee/blob/5.3.8/core/src/main/java/lucee/runtime/functions/system/ExtensionList.java#L0-L1

michaelborn avatar Jul 28 '21 14:07 michaelborn

Nice! thanks for posting details and an example @michaelborn

For anyone looking to add this, you'll need to add a new json file to the data/en directory to document the function.

pfreitag avatar Jul 28 '21 15:07 pfreitag

It's always fun to go to fix an issue and find out you've already fixed it. :-)

This can probably be closed.

shawnoden avatar Oct 20 '22 23:10 shawnoden

thx for letting me know 🥇

pfreitag avatar Oct 21 '22 13:10 pfreitag