Support

Admin Tools

#28449 admin tools component update

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by toonetcreation on Monday, 18 September 2017 02:00 CDT

toonetcreation
Hi,

I have a question about admin tools component update.

Is it mandatory to use joomla backoffice installer to update the component, or is it possible to deploy the update using a shell script on linux system?

I mean, would it be possible to unzip locally the package on the server and the replace current files by the new package?

Will it work correctly through this way or during the update, there is database update so that's why using joomla backoffice installer is needed?

Thanks
Laurent

nicholas
Akeeba Staff
Manager
Is it mandatory to use joomla backoffice installer to update the component, or is it possible to deploy the update using a shell script on linux system?


I'm afraid not. Even though we'd love to let you use a CLI script you have to go through the Joomla! backend. This is NOT a limitation of Admin Tools. It is a limitation of Joomla!. The Joomla! extensions installer API (JUpdate) is unnecessarily tied to JApplicationCms (the class from which the frontend and backend applications extend). If you do not run the installation through a JApplicationCms application object strange things will happen, your site will break and we won't be able to help you.

You may wonder, why use the Joomla! extensions installer if it's so problematic? It's because we need to have our extensions listed on the Joomla! Extensions Directory (JED) for potential users to find them. This is necessary for us to, well, make a living :) The JED rules explicitly state that if the extension does not use the Joomla! extensions installer to install itself (initial installation or updates) the entire company gets booted off the JED. As a result there is no alternative but to use Joomla's ageing installer that nobody wants to modernize - trust me, we had volunteered, multiple times.

I mean, would it be possible to unzip locally the package on the server and the replace current files by the new package?


NO, DO NOT TRY THIS, YOU WILL BREAK YOUR SITE. Admin Tools is a "package" extension. It consists of a library, a component and several plugins. Joomla! needs to install them which is an involved process. Replacing the files is not enough.

Will it work correctly through this way or during the update, there is database update so that's why using joomla backoffice installer is needed?


Indeed, database changes are also required. These MUST be carried out by Joomla! since the affected tables and their field names may vary from one version to the next.

A couple of years ago we had written a CLI script which could update our software from the command line. It was using the JApplicationCli and a lot (A LOT!) of workarounds to simulate the missing bits compared to JApplicationCms. This worked fairly well until Joomla! 3.7 was released. Changes in the underlying API made it impossible for our workarounds to work any more. Therefore the only way to install or update an extension is through the backend of the site.

We do have a CLI script in the automated tests of Admin Tools which can "log in" to the backend and initialize an extension installation or update. However, it's a massive ball of workarounds and borderline black magic. It requires a very specific PHP setup to even run without crashing, let alone working correctly. It's not anywhere near being ready for mass distribution and it will never be. Why am I telling you this? Because this means that I've tried doing what you want and I've already lost a lot of my hair by means of pulling it every time I saw something new break in a new Joomla! version. I wouldn't recommend anyone to try writing something like that unless they enjoy pain and have plenty of time to waste. In so many words, yeah, we'd all like a CLI extensions updater but the way Joomla! is written this ain't happening any time soon :(

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

toonetcreation
Ok I see...That is what I thought

​Because I have many websites to manage and I'm looking for a tool to deploy an extension on many websites instead of logging on every website and using joomla installer.

something like this maybe ?

https://www.jms2win.com

https://watchful.li​

toonetcreation
or with ​a command line script that utilises the ​​Joomla Updater methods.

do you think this will be possible?

nicholas
Akeeba Staff
Manager
something like this maybe ?



https://www.jms2win.com



https://watchful.li​


These are, of course, supported. They use Joomla's extensions updater (which internally uses the Joomla! extensions installer to install the updates) through the web which I already explained is the only one way you can use this code.

Our software, as you are already aware, does support the Joomla! extensions installer and Joomla! extensions updater. It's not like we have a choice on the matter. We either support these -and only these- methods for installing and updating our software or we will be booted out of the Joomla! Extensions Directory.

So, yes, you can use these third party, web-based services.

or with ​a command line script that utilises the ​​Joomla Updater methods.


I already explained why this is not possible. Let me quote myself and add a bit more commentary.

Even though we'd love to let you use a CLI script, you have to go through the Joomla! backend. This is NOT a limitation of Admin Tools. It is a limitation of Joomla!. The Joomla! extensions installer API (JUpdate) is unnecessarily tied to JApplicationCms (the class from which the frontend and backend applications extend). If you do not run the installation through a JApplicationCms application object strange things will happen, your site will break and we won't be able to help you.


In other words, the Joomla! extensions updater uses the Joomla! extensions installer which REQUIRES some stuff that's only available in JApplicationCms. The latter is the base application class used in the frontend and backend of the site. It MUST run through a web interface, it cannot run inside CLI.

A couple of years ago we had written a CLI script which could update our software from the command line. It was using the JApplicationCli and a lot (A LOT!) of workarounds to simulate the missing bits compared to JApplicationCms. This worked fairly well until Joomla! 3.7 was released. Changes in the underlying API made it impossible for our workarounds to work any more. Therefore the only way to install or update an extension is through the backend of the site.


In other words, two years ago I had the same idea as you. I already knew the issues regarding JApplicationCms vs JAppliationCli and I tried to work around them by creating fake methods in my JApplicationCli application. This worked great until Joomla! 3.7 came out. They broke the Session package when used under CLI. I discussed this issue with the leadership at J and Beyond 2017 this past may and they concluded that maybe it will be fixed in Joomla! 4 or, most likely 5 by using a different way to initialize the session. Until then, anything that uses the session in CLI will crash and burn. That includes the extensions installer and the post-installation scripts in most major extensions. Therefore, installing or updating extensions through CLI cannot happen in Joomla! 3.7 and later 3.x releases.

Please note that I do understand why they had to make that change. There are very important security and architecture reasons which I was already aware. I very strongly disagreed with the implementation in Joomla! 3 because it broke backwards compatibility. At the end of the day I was given an unofficial ultimatum: shut up in public or we'll ban you from the project to hurt your business. You know what? They can go jump off a high building. They broke backwards compatibility and made impossible something that other CMS tout as a major feature. I can't fix stupid and I can't put my and my co-worker's ability to provide for our families at risk because of stupid people. If they really want to they know how to fix it (I've told them). But for the love of God, please stop asking me about installation through CLI. It won't happen that easily.

Of course, if you were very observant, you may have read my other paragraph:

We do have a CLI script in the automated tests of Admin Tools which can "log in" to the backend and initialize an extension installation or update. However, it's a massive ball of workarounds and borderline black magic. It requires a very specific PHP setup to even run without crashing, let alone working correctly. It's not anywhere near being ready for mass distribution and it will never be.


So how did I do that? I am simulating an interactive browser installation. I use cURL to log in to the site's backend and store the cookie in a text file. Then I use cURL again to simulate the effect of a logged in Super User (thanks to the saved cookie) going to the Extensions Installer page and submitting the Install from File form, uploading the installation package. It's not pretty and it only works if you do not have any form of protection in the backend login (administrator password protection, secret URL parameter, core or third party two factor authentication) and only if you use the stock backend template. It's definitely NOT ready for prime time and it will never be because of that. The ONLY real way to install stuff from CLI is using the installed API from a CLI script but that, as we determined, is broken and nobody's allowed to fix or complain about it on penalty of their business being crushed.

So, tough luck. You can't install / update stuff through CLI. Sorry.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

toonetcreation
Hi,

Ok I see exactly what you mean, I understand.

So I will check this out regarding watchul solution.

thanks for your time and yout feedback
Laurent

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!