Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-08-28 12:09:16

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

One place to put external libraries and classes

Often when developing websites / plugins need to use external php libraries and classes.

I suggest that in the file structure Textpattern determine where to place them. This will allow plugins to keep external libraries more orderly and easier redistribution plugins. Also, it will simplify the update Textpattern, when all external libraries in a one separate directory, and not mixed with files CMS.

For example you can create a directory textpattern/libext with short readme.txt inside.

Last edited by makss (2012-08-28 12:09:59)


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

#2 2012-08-28 13:08:34

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: One place to put external libraries and classes

Currently you can just throw libraries in the plugin cache directory, and you can also package libraries as library type plugins, making end-users life much easier.

As the 3rd-party library directory goes, I’m not a fan of creating one inside textpattern directory. Any additional user-configurable item that is versioned and isn’t ignored by SVN/git makes updating bit harder.

Whenever possible, plugins should always try to avoid external dependencies and conflicts, and not require any external libraries or uploading files. Textpattern directory itself should be treated as a no-go zone, used only when absolutely mandatory.

Last edited by Gocom (2012-08-28 13:11:19)

Offline

#3 2012-08-28 13:49:24

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: One place to put external libraries and classes

As the 3rd-party library directory goes, I’m not a fan of creating one inside textpattern directory. Any additional user-configurable item that is versioned and isn’t ignored by SVN/git makes updating bit harder.

Also, some users may update their TXP installation by moving the /textpattern folder to /textpattern.old/ and then uploading the corresponding one for the new version. If user isn’t aware about having 3rd-party librarys stored there, it may be already too late when he realizes that their were now stored at /textpattern.old/ folder, which he may have already deleted :)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2012-08-28 15:15:10

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

Re: One place to put external libraries and classes

Gocom wrote:

Currently you can just throw libraries in the plugin cache directory,

And every time you start Textpattern will load ALL libraries.

and you can also package libraries as library type plugins, making end-users life much easier.

I know about this feature, but the library contains a lot of files, so this is not an option.

As the 3rd-party library directory goes, I’m not a fan of creating one inside textpattern directory. Any additional user-configurable item that is versioned and isn’t ignored by SVN/git makes updating bit harder.

svn up ignore files of which he does not know, I think that git do the same.

Whenever possible, plugins should always try to avoid external dependencies and conflicts, and not require any external libraries or uploading files.

I totally agree with that, but to use large libraries / classes / external API / etc, there is no other choice but to keep those all libraries in a separate directory. And connect them only as needed (include_once, require_once).

So the question is how to do it with the least problems.

maniqui wrote:

Also, some users may update their TXP installation by moving the /textpattern folder to /textpattern.old/ and then uploading the corresponding one for the new version. If user isn’t aware about having 3rd-party librarys stored there, it may be already too late when he realizes that their were now stored at /textpattern.old/ folder, which he may have already deleted :)

I also always do, but I do remember about textpattern/config.php file so I wanted to define a place for three-party libraries to remember about him, too.


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

Board footer

Powered by FluxBB