Hot answers tagged

4

CLI applications included in Joomla perform checks to ensure they're being executed from command line. They do not run when accessed directly by URL (using browser, cURL or anything else).


3

The /cli directory holds command line routines that can be executed either manually via terminal or via host managed tools like cron(scheduler) and can be called directly from the php directory or by a service like cURL which is why it needs to visible to the public with a permission of 755. Using the .htaccess directives, the list of files in the /cli ...


3

Use JLoader::registerNamespace() to register this library's namespace. This should work for you current folder structure: JLoader::registerNamespace('EmailReplyParser\\Parser', __DIR__, false, false, 'psr0'); Or you can use the included autoloader: require_once __DIR__ . '/autoload.php'; Then add import statements before using the classes: use ...


2

Yes, the /cli/ scripts can only be run from the command line on the server. Note that the PHP run on the CLI might use another PHP version + settings, set in /etc/php/[your php version]/cli/php.ini The Joomla site itself might use another PHP version. On an Apache web server that configuration might be loaded from: /etc/php/[your php version]/apache2/php.ini


2

For anybody else running into this, I ended up solving it using the installation script linked to in my question, after correctly locating the latest language file version as follows: LANGUAGE=ga-IE cd $JPATH_ROOT PACKAGE_URL=`curl -s https://update.joomla.org/language/details3/${LANGUAGE}_details.xml | grep downloadurl | tail -1 | sed -r 's/.*>(.*)<.*...


2

Use file manifest to install files not belonging to any extension: <?xml version="1.0" encoding="UTF-8"?> <extension version="3.9" type="file" method="upgrade"> <name>files_cli_example</name> <author>Example</author> <version>1.0.0</version> <creationDate>January 2019</creationDate> ...


2

Start by updating to the latest version of Joomla - 3.9.20 - if you're able to first. A number of changes regarding JControllerLegacy were made in Joomla 3.8 (see https://github.com/joomla/joomla-cms/pull/13683) and so that is certainly worth investigating first. Next take a look at this post which relates to calling JController from CLI Call Controller'...


1

That doc page references a dead version of the project (joomla/joomla-framework which hasn't seen activity for a half-decade or more) which is a good indication that the rest of it is outdated as well. The current project files are at https://github.com/joomla-framework and the official site is https://framework.joomla.org For a current example application, ...


1

I have not enough reputation to add a comment, so I need to post a new answer. The solution of "John Rix" works perfect but I like add one thing: You have to make sure you sort the data from the xml file by version number. It is not sufficient to use the last occurrence of downloadurl because the list seams to be unsorted. Example: https://update....


1

In the end I went with the script method I'd suggested in my question. Id did this because it meant that I could keep the cli file within the component, add it to the correct location when the component installed and remove it on uninstall. I did this by adding a new cli folder to the root of my component, which contained the cli file I wanted to add ...


Only top voted, non community-wiki answers of a minimum length are eligible