4 votes
Accepted

CLI directory is publicly accessible. Is it supposed to be? Is that safe?

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).
Sharky's user avatar
  • 11.2k
3 votes
Accepted

Loading a helper file in Joomla 4

JLoader::register() call should include fully qualified class name. In your case it's Myhelper\MyHelper: JLoader::register('Myhelper\Myhelper', 'templates/mytemplate/html/helper.php'); The class also ...
Sharky's user avatar
  • 11.2k
3 votes

CLI directory is publicly accessible. Is it supposed to be? Is that safe?

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 ...
Irata's user avatar
  • 3,927
3 votes
Accepted

How to use external PHP library in Joomla! CLI application - Class not found

Use JLoader::registerNamespace() to register this library's namespace. This should work for you current folder structure: JLoader::registerNamespace('EmailReplyParser\\Parser', __DIR__, false, false, ...
Sharky's user avatar
  • 11.2k
3 votes

How to add a CLI file to the /CLI directory as part of a component install

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>...
Sharky's user avatar
  • 11.2k
2 votes
Accepted

Installing language from CLI

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 ...
John Rix's user avatar
  • 551
2 votes

Error JLIB_APPLICATION_ERROR_INVALID_CONTROLLER from CLI on Joomla 3.7

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/...
Patrick Jackson's user avatar
2 votes

CLI directory is publicly accessible. Is it supposed to be? Is that safe?

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 ...
pe7er's user avatar
  • 2,023
2 votes

Change debug variable during cli script execution

If you're using JFactory::getDbo() to get the database instance, it could be that something else calls it before you set the configuration value. So you would need to make sure you set debug ...
Sharky's user avatar
  • 11.2k
2 votes
Accepted

Omit previously imported articles by comparing existing articles aliases with generated aliases

You will need to move your query into your insertArticles() method scope so that $results is available as well as move your filtration before the save() call is executed. I will propose creating a ...
mickmackusa's user avatar
  • 4,791
2 votes
Accepted

"In Folder.php line 108: Cannot open source folder" after running core:update

Setting tmp_path in configuration.php to a proper location fixed it.
Olle Härstedt's user avatar
2 votes

Execute Joomla CLI script to bulk import JSON data to articles

I found when running CLI scripts that other things that you don't really need to execute, i.e. plugins, will cause failures because they don't check themselves to disable if they are running under a ...
Irata's user avatar
  • 3,927
1 vote

can I fix (update) the database from the CLI? (J4)

The Update Structure button on the Maintenance:Database appears to execute the fix() method at line #40 of this file ..\administrator\components\com_installer\src\Controller\DatabaseController.php ...
Irata's user avatar
  • 3,927
1 vote
Accepted

" ! [NOTE] There are available updates to apply" - but no way to apply them via CLI?

There are a number of options available to handle the extensions extension extension:discover Discover extensions extension:discover:install Install discovered extensions ...
Irata's user avatar
  • 3,927
1 vote
Accepted

How do Joomla CLI/Console jobs and Task Scheduler jobs fit together?

Not all Cli based applications are required to be run on a schedule therefore not all Cli instances are suited to be created or converted to the Task Scheduler approach thus there is no choice for ...
Irata's user avatar
  • 3,927
1 vote

Help with update a JoomlaCli-Application from Joomla 3 to Joomla 4

Your code needs to be updated to form the Joomla 4 application environment correctly as there are major changes between what you have for Joomla 3 and the way Joomla 4 now loads. You can use the code ...
Irata's user avatar
  • 3,927
1 vote

How to setup a custom command-line class in Joomla4?

These are two references I think cover the basics and should get you started. https://www.dionysopoulos.me/book/com-cli.html https://magazine.joomla.org/all-issues/june-2022/joomla-4-a-powerful-cli-...
Irata's user avatar
  • 3,927
1 vote

Execute Joomla CLI script to bulk import JSON data to articles

Here is the final working code courtesy of @mickmackusa. It took the addition of $app = JFactory::getApplication( 'site' ); to fix the Failed to start application error in the command line. /** * A ...
Mike Hermary's user avatar
1 vote
Accepted

Joomla Framework folder "libraries" missing

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....
Arlen's user avatar
  • 802
1 vote

Installing language from CLI

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 ...
Alex Mahr's user avatar
1 vote

How to add a CLI file to the /CLI directory as part of a component install

The current Joomla package manifest has the ability to block child uninstalls so only the full package can be uninstalled, not individual components. Use the following in your package manifest: <...
Alex Chartier's user avatar
1 vote

How to add a CLI file to the /CLI directory as part of a component install

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 ...
Dom's user avatar
  • 512

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