GithubHelp home page GithubHelp logo

joomlatools / joomlatools-console Goto Github PK

View Code? Open in Web Editor NEW
111.0 29.0 48.0 827 KB

Command line interface (CLI) for Joomla.

Home Page: https://www.joomlatools.com/developer/tools/console/

License: Mozilla Public License 2.0

PHP 100.00%
console

joomlatools-console's Introduction

Screenshot

Joomlatools Console

Joomlatools Console simplifies the management of Joomla sites. It is designed to work on Linux and MacOS. Windows users can use it in Joomlatools Server.

Requirements

  • PHP7.3 or newer
  • Linux, MacOS, or Joomlatools Server
  • Composer
  • Joomla versions 3.5 and 4.x

Installation

  1. Install using Composer:

$ composer global require joomlatools/console

  1. Tell your system where to find the executable by adding the composer directory to your PATH. Add the following line to your shell configuration file called either .profile, .bash_profile, .bash_aliases, or .bashrc. This file is located in your home folder.

$ export PATH="$PATH:~/.composer/vendor/bin"

For Ubuntu 19+ you may find you should use:

export PATH="$PATH:$HOME/.config/composer/vendor/bin"

  1. Verify the installation

$ joomla --version

  1. To create a new site with the latest Joomla version, run:
   joomla site:create testsite

The newly installed site will be available at /var/www/testsite and testsite.test after that. The default Super User's name and password is set to: admin / admin.

By default, the web server root is set to /var/www. You can pass --www=/my/server/path to commands for custom values. You can choose the Joomla version or the sample data to be installed:

  joomla site:create testsite --release=4.0 --sample-data=blog
  1. For other available options, run:

$ joomla --list

  1. Read our documentation pages to learn more about using the tool.

Development

To setup the tool for development:

  1. Clone the repository:
git clone [email protected]:joomlatools/joomlatools-console.git
  1. Fetch the dependencies:
composer install
  1. Now you can execute the tool with:
bin/joomla list
  1. Happy coding!

Contributing

Joomlatools Console is an open source, community-driven project. Contributions are welcome from everyone. We have contributing guidelines to help you get started.

Contributors

See the list of contributors.

License

Joomlatools Console is free and open-source software licensed under the MPLv2 license.

Community

Keep track of development and community news.

joomlatools-console's People

Contributors

alexandreelise avatar amazeika avatar application2000 avatar cheesegrits avatar davidgrayston avatar ercanozkaya avatar florianv avatar genu avatar greenleafmedia avatar hermsi1337 avatar jissereitsma avatar johanjanssens avatar krizalys avatar levnikmyskin avatar magneticmg avatar miljan-aleksic avatar msaladna avatar rodolfovillaruz avatar securez avatar smetdenis avatar steenschutt avatar stevenrombauts avatar tonypartridge avatar totten avatar yiendos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

joomlatools-console's Issues

Only execute service restarts on box

Because there are so many different ways to restart the various services based on OS and tools, it will be easiest to replace the command with our own box server:restart command. Only run it if the environment is the Joomlatools Vagrant box.

extension:install bug when using discover install

In Extension.Install.php

 $model = new \InstallerModelDiscover();
 $model->discover();

 $results = $model->getItems();

But $model->getItems() return limited result. By default only 20 extensions have been returning.

In getItems:

		try
		{
			// Load the list items and add the items to the internal cache.
			$this->cache[$store] = $this->_getList($this->_getListQuery(), $this->getStart(), $this->getState('list.limit'));
		}

As a result, if the extension is not included in the first twenty, it will be ignored.

Update the #__schema and #__extensions tables after installation

The joomla site:create command needs a bit more database queries now than before. In particular, we are missing the insertion of the j_schemas table. The missing logic is highlighted here: https://github.com/joomla/joomla-cms/blob/04f09d5c9b834c5a8a1707013a94720e777ceed7/installation/model/database.php#L482-L537

Two ways to try and solve this:

  1. Copy over the DB logic manually
  2. See if we can bootstrap the installer application and just run that. No need for us to take these special cases into account then.

More info: https://groups.google.com/forum/?fromgroups#!topic/joomla-dev-cms/ohoKk6h7VI0

Joomla 4 compatibility

Are you in the right place?

I think this is a bug.

Describe your environment

  • OS: Sierra
  • Joomla version: 4.0-dev
  • Joomlatools Console version: Joomla Console tools 1.5.2
  • Are you working on the Joomlatools Vagrant box: no (using valet)

Describe the problem:

I am trying to register my custom component and I am getting a PhP Fatal Error.

Steps to reproduce:

I am doing:

joomla extension:register --www=/Volumes/DataDrive/Sites/Joomla joomla4 com_church

Observed Results:

`joomla extension:register --www=/Volumes/DataDrive/Sites/Joomla joomla4 com_church
PHP Fatal error: Class Joomlatools\Console\Joomla\Application contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Joomla\Application\AbstractApplication::doExecute) in /Volumes/UserDrive/Users/username/.composer/vendor/joomlatools/console/src/Joomlatools/Console/Joomla/Application.php on line 24

Fatal error: Class Joomlatools\Console\Joomla\Application contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Joomla\Application\AbstractApplication::doExecute) in /Volumes/UserDrive/Users/username/.composer/vendor/joomlatools/console/src/Joomlatools/Console/Joomla/Application.php on line 24`

Add global config.yaml

Since the list of available options is getting a bit big, it would make life easier if we could store the settings in a config.yaml file.

Create relative symlinks

Add a --relative flag to the extension:symlink command to make symlinks relative to the site root directory.

Add Application::isClient

Joomla added a new isClient method to JApplication derivatives to replace isSite and isAdmin. We should define this ourselves in the Application since it's breaking with Joomla 3.7.0

site:init

Hello joomlatools,

really nice CLI tool, great and very helpful.

In my eyes a very important function is missed to use it on a daily base - a command to initialize an existing site like for eg. composer does.
I did not check your routines so much for now, but maybe you do see an option to add a class / cmd for this feature request?

PHP Notice: Undefined property: stdClass::$name

Describe your environment

$ uname -a
Linux tower 5.2.8-1-MANJARO #1 SMP PREEMPT Fri Aug 9 19:34:20 UTC 2019 x86_64 GNU/Linux
$ joomla --version
Joomla Console tools 1.5.3

Are you working on the Joomlatools Vagrant box: no

Describe the problem:

PHP Notice: Undefined property: stdClass::$name in /srv/http/.composer/vendor/joomlatools/console/src/Joomlatools/Console/Joomla/Ut

Steps to reproduce:

[me@tower http]$ sudo -u http joomla site:list --www /srv/http
PHP Notice: Undefined property: stdClass::$name in /srv/http/.composer/vendor/joomlatools/console/src/Joomlatools/Console/Joomla/Util.php on line 140
2. salon (joomla-cms 3.9.11)

Observed Results:

A PHP Notice.

Requirement: git

It's logical but without the git package, downloading the Joomla! versions won't work. It isn't mentioned in the installation nor in the requirements:

Requirements
Composer
Joomla version 2.5 and up.

Upgrade symfony/console

The symfony/console package version is currently locked at 2.7.x, while 4.0 is already released. Update composer.json and the code accordingly.

option --mysql_db_prefix will not overwrite the default value j_

using official version 1.4.11
Using the option --mysql-db-prefix produces an error, That's fine for the moment, because the syntax is not allowed (yet). Using --mysql_db_prefix instead is accepted, but the new value is not used with the table names. They still are prefixed with the default "j_".

Improve autoloader locator

We are currently hardcoding a bunch of possible locations for autoload.php (see #44). If possible we should make this more flexible, and find the autoloader.php location based on the Composer manifest.

Update the access log path and format

Recent changes to joomlatools/joomlatools-vagrant have changed the default log path name and format. We need to update this in console as well otherwise the vhosts are not picked up by pimpmylog on the box.

Run Composer with --no-interaction flag

When trying to install a first plugin, there is no composer.json yet in the plugins directory. Recent versions of Composer will prompt the user if they want to use a composer.json file in the parent directory if it exists. This breaks the plugin:install command.

Add the --no-intercation flag to fix this.

Run PHP code in Joomla

Is there a way to get a PHP shell or run raw PHP code after Joomla is loaded?

Something like joomla eval 'echo JRoute::_("url-query-string");'

Thank you.

Issue installing symlinked extension

https://github.com/joomlatools/textman/pull/431#issuecomment-339886990

It seems Joomla Console has an issue installing a symlinked extension when it has similarly named plugin folder, it somehow calls the uninstall.sql when trying install the TEXTman Notify plugin plugins/textman/notify.

$ joomla site:create textman --symlink=textman -vvv
...
Installing textman ..
Enabling plugin `textman` (ID #10001) ..
Installing textman ..
Enabling plugin `textman` (ID #10002) ..
Installing textman ..
Enabling plugin `textman` (ID #10004) ..
Installing com_textman ..
Installing notify ..
Enabling plugin `notify` (ID #10005) ..
Your new Joomla site has been configured.
You can login using the following username and password combination: admin/admin.

It installs everything but it drops the #__textman_revisions table and deletes textman-files and textman-images in the #__files_containers table, pretty much everything in the uninstall.sql. It works, however, when I renamed the plugin plg:textman.notify to plg:koowa.textman i.e. moving the notify plugin from plugins/textman folder to plugins/koowa/textman

Don't work "joomla site:create test"

2018-04-07_12-34-40

Describe your environment

  • OS: CentOS 7
  • Joomla version: 3.8.6
  • Joomlatools Console version: 1.5.0
  • Are you working on the Joomlatools Vagrant box: no

Describe the problem:

try to use your command
joomla site:create test

and get

Observed Results:


gzip: /root/.config/composer/vendor/joomlatools/console/bin/.files/cache/7522513af9d772a10efbc54fc410dbce/current.tar.gz: not in gzip format


  [RuntimeException]
  Downloaded tar archive "current.tar.gz" could not be verified. A common cause is an interrupted download:
   check your internet connection and try again.

Redundant library import rises errors

Environment

  • OS: Debian
  • Joomla version: 3.9.0
  • Joomlatools Console version: 1.5.1
  • Are you working on the Joomlatools Vagrant box: no

Problem:

The extension:install and other related commands are failing to execute when Joomla error_reporting is set to Development:

Notice: Constant JROUTER_MODE_RAW already defined in /var/www/html/libraries/import.php on line 60
Notice: Constant JROUTER_MODE_SEF already defined in /var/www/html/libraries/import.php on line 67
Warning: session_name(): Cannot change session name when headers already sent in /var/www/html/libraries/joomla/session/handler/native.php on line 128
Warning: session_cache_limiter(): Cannot change cache limiter when headers already sent in /var/www/html/libraries/joomla/session/handler/native.php on line 235

The conflict relies on both libraries/import.php and libraries/import.legacy.php being required. The first directly by Bootstrapper and the latest indirectly by includes/framework.php which will ultimately require it. Usually this kind of conflicts would have been unnoticed because of the use of required_once statement, but in this case those are two different files.

This has been already reported at #97 but aparently not identified as an issue, most likely because of the error_reporting setting.

Option --www does not work for vhost.conf

Here cmd:

joomla site:create joomla1 --www=/var/www/html

Joomla creates at the /var/www/html/joomla1, but

cat sites-available/1-joomla1.conf | grep '/var/www/'
    DocumentRoot /var/www/joomla1
    <Directory /var/www/joomla1>

And if i run

 joomla vhost:create joomla1 --www=/var/www/html

i see:

cat sites-available/1-joomla1.conf | grep '/var/www/'
    DocumentRoot /var/www/html/joomla1
    <Directory /var/www/joomla1>

Errors when installing extensions using extension:install

Describe your environment

  • OS: alpine linux in docker
  • Joomla version: latest (3.8.13) just downloaded with joomla console
  • Joomlatools Console version: Joomla Console tools 1.5.2
  • Are you working on the Joomlatools Vagrant box: no

Describe the problem:

I try to setup Joomla in a docker imaged, based on alpine linux, derieved from mwaeckerlin/php-fpm. Basic Joomla now works, but when I try to install any extension, I get several error messages.

Steps to reproduce:

Create file Dockerfile:

FROM mwaeckerlin/php-fpm

ENV LANGUAGES      ""
ENV MYSQL_USER     "root"
ENV MYSQL_PASSWORD "ert456"
ENV MYSQL_DATABASE "websites"
ENV MYSQL_HOST     "mysql"
ENV WEB_ROOT_PATH  "/joomla/websites"

ENV CONTAINER      "websites"
USER root
RUN apk add composer git mysql-client php7-mbstring php7-simplexml php7-session php7-mysqli php7-mbstring php7-bz2 php7-zip \
 && (test ! -d "${WEB_ROOT_PATH%/*}" || rm -rf "${WEB_ROOT_PATH%/*}") \
 && mkdir -p "${WEB_ROOT_PATH%/*}" \
 && mkdir /composer \
 && cd /composer \
 && composer require joomlatools/console \
 && /composer/vendor/bin/joomla site:download --www "${WEB_ROOT_PATH%/*}" "${WEB_ROOT_PATH##*/}" \
 && chown -R nginx "${WEB_ROOT_PATH%/*}" \
 && sed -i 's,^ *;\? *session.save_path =.*,session.save_path = "/tmp",' /etc/php7/php.ini \
 && mkdir /joomla/plugins \
 && mv /start.sh /start-php-fpm.sh
USER nginx
ADD start.sh /start.sh

Create file start.sh and set it's executable mode chmod +x start.sh:

#!/bin/sh -e

echo | mysql -u root -pert456 -h mysql websites || \
    /composer/vendor/bin/joomla database:install \
                                --www "${WEB_ROOT_PATH%/*}" \
                                -L "${MYSQL_USER}:${MYSQL_PASSWORD}" \
                                --mysql-database "${MYSQL_DATABASE}" \
                                -H "${MYSQL_HOST}" \
                                "${WEB_ROOT_PATH##*/}"

test -e ${WEB_ROOT_PATH}/configuration.php || \
    /composer/vendor/bin/joomla site:configure \
                                --www "${WEB_ROOT_PATH%/*}" \
                                -L "${MYSQL_USER}:${MYSQL_PASSWORD}" \
                                --mysql-database "${MYSQL_DATABASE}" \
                                -H "${MYSQL_HOST}" \
                                "${WEB_ROOT_PATH##*/}"
sed -i "s,public *\$session_handler *=.*;,public \$session_handler = 'none';," ${WEB_ROOT_PATH}/configuration.php

/start-php-fpm.sh
  1. build docker image: docker build --rm --force-rm -t mwaeckerlin/joomla .
  2. run mysql database: docker run --name joomla-mysql -d -e MYSQL_ROOT_PASSWORD=ert456 mysql:5
  3. run the joomla image: docker run -d --name joomla -p 8001:8080 --link joomla-mysql:mysql mwaeckerlin/joomla
  4. open a shell in the joomla container: docker exec -it joomla sh
  5. try to install an extension, e.g. VirtueMart: /composer/vendor/bin/joomla extension:install --www "${WEB_ROOT_PATH%/*}" "${WEB_ROOT_PATH##*/}" com_virtuemart

Observed Results:

Get error messages:

nginx@php-fpm[59717c39181a]:/$ /composer/vendor/bin/joomla extension:install --www "${WEB_ROOT_PATH%/*}" "${WEB_ROOT_PATH##*/}" com_virtuemart
PHP Notice:  Constant JROUTER_MODE_RAW already defined in /joomla/websites/libraries/import.php on line 60
Notice: Constant JROUTER_MODE_RAW already defined in /joomla/websites/libraries/import.php on line 60
PHP Notice:  Constant JROUTER_MODE_SEF already defined in /joomla/websites/libraries/import.php on line 67
Notice: Constant JROUTER_MODE_SEF already defined in /joomla/websites/libraries/import.php on line 67

Does not install the component, com_virtuemart is missing:

nginx@php-fpm[59717c39181a]:/$ ls /joomla/websites/components/
com_ajax            com_fields          com_newsfeeds
com_banners         com_finder          com_search
com_config          com_mailto          com_tags
com_contact         com_media           com_users
com_content         com_menus           com_wrapper
com_contenthistory  com_modules         index.html

Expected Results:

Installation succeeds.

More Information

I also tried to install from zip-files using extension:installfile, but I get the same result.

Add superuser params

Add pls superuser login:password parameters to site:create and/or site:install to create a custom superuser for the first install. Admin/admin is kinda unsecure.

Unlucky option name --mysql_db_prefix

seen with official version 1.4.11.
All option names use "-" as delimiter, just mysql_db_prefix uses "_". I would suggest to do it in a unique way.
Since there might be a lot of scripts in use, maybe it is a better approach to add the option mysql-db-prefix instead of replacing the old value with it. One could declare the old one as obsolete and remove it at a later time

Failed to start session when using Joomlatools on the CLI with Joomla! 3.7.5

No idea why it wants to start a session but something seems to break.

PHP 7.1
Joomla CMS 3.7.5
Joomla Console tools 1.4.10

$ joomla extension:install --www=/var/www mysite 'mod_upload'

                               
  [RuntimeException]           
  Failed to start the session  
                               

extension:install [--www WWW] [--] <site> <extension> (<extension>)...

Add --clone argument

Instead of downloading the site from and extracting it to /var/www, make it possible to clone the repo instead.

Store plugins outside of composer directory

Right now we store plugins inside the installed directory. If we update or change the version, Composer will completely remove this directory. Result is missing plugins.

Store plugins in a ~/.joomlatools directory to solve this.

Fix Git URL for platform

By default, we clone platform using the SSH protocol, which does not work if there is no correct key installed. Use HTTPS for platform.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.