Commit Graph

19 Commits

Author SHA1 Message Date
Alexandre Alapetite
7d83321286 Better catch when a user does not exists (#3751)
#fix https://github.com/FreshRSS/FreshRSS/issues/3735
Before, we were relying on an exception during the first stages of user initalisation. Now the check is explicit and cleaner, producing a more appropriate HTTP response for the API.
2021-08-14 12:22:42 +02:00
Alexandre Alapetite
3499f8f1d1 Extensions in CLI (#3443)
* Extensions in CLI

https://github.com/FreshRSS/FreshRSS/pull/3440#discussion_r574659745

* Also user extensions
2021-02-26 19:34:02 +01:00
Alexandre Alapetite
d42b4c299c Add requirements check in CLI (#3410)
* Add requirements check in CLI

#fix https://github.com/FreshRSS/FreshRSS/issues/1853

* More checks

#fix https://github.com/FreshRSS/FreshRSS/issues/1853
2021-02-05 22:21:31 +01:00
Alexis Degrugillier
eb51fd713a Fix coding standard (#3363)
Merged code was not following coding standard. Thus breaking all CI tests.
2021-01-12 16:49:46 +01:00
Alexandre Alapetite
8dfe209799 Possiblity to autoinstall in Docker Compose (#3353)
* Possiblity to autoinstall in Docker Compose

#fix https://github.com/FreshRSS/FreshRSS/issues/3349

It is simply calling our existing CLI: do-install.php and
create-user.php
https://github.com/FreshRSS/FreshRSS/tree/master/cli

FreshRSS will typically be ready a few seconds before the database, so
introduce a tolerance when the database is not available / up (yet) by
trying a few times to connect. Also useful to avoid service interruption
when DB service is restarted.

Example:

```yml
freshrss-app:
    image: freshrss/freshrss
    container_name:
freshrss-app
    hostname: freshrss-app
    restart: unless-stopped

ports:
      - "8080:80"
    depends_on:
      - freshrss-db

volumes:
      - data:/var/www/FreshRSS/data
      -
extensions:/var/www/FreshRSS/extensions
    environment:
      CRON_MIN:
'*/20'
      FRESHRSS_ENV: development
      FRESHRSS_INSTALL: |-

--api_enabled
        --base_url https://rss.example.net

--db-base freshrss
        --db-host freshrss-db
        --db-password
freshrss
        --db-type pgsql
        --db-user freshrss

--default_user admin
        --language en
      FRESHRSS_USER: |-

--api_password freshrss
        --email user@example.net

--language en
        --password freshrss
        --user admin
      TZ:
Europe/Paris
```

* Minor type f in find

* shellcheck
2021-01-11 22:36:50 +01:00
Alexandre Alapetite
9c6682e7ed Avoid manual initialisations of system or user configuration (#3070)
* Avoid manual intialisations of system or user configuration

More consistent use of Context

* Simplify FreshRSS_Context::initUser

* Remove a few manual get_user_configuration

* A bit of debugging

* Fix context user init

* Fix install

* Fix concurrency

Concurrent requests could lead to bad race condition

* Fix actualize cron

Fix case when system i initialised several times
2021-01-02 21:20:19 +01:00
Alexandre Alapetite
0319cc9d23 Minz allow parallel sessions (#3096)
* Minz allow parallel sessions

#fix https://github.com/FreshRSS/FreshRSS/issues/3093

* Array optimisation

* Array optimisation missing

* Reduce direct access to $_SESSION except in install process

* Fix session start headers warning

* Use cookie only the first time the session is started:
`PHP Warning:  session_start(): Cannot start session when headers
already sent in /var/www/FreshRSS/lib/Minz/Session.php on line 39`

* New concept of volatile session for API calls

Optimisation: do not use cookies or local storage at all for API calls
without a Web session
Fix warning:

```
PHP Warning:  session_destroy(): Trying to destroy uninitialized session
in Unknown on line 0
```

* Only call Minz_Session::init once in our index

It was called twice (once indirectly via FreshRSS->init())

* Whitespace

* Mutex for notifications

Implement mutex for notifications
https://github.com/FreshRSS/FreshRSS/pull/3208#discussion_r499509809

* Typo

* Install script is not ready for using Minz_Session
2020-10-06 23:19:45 +02:00
Alexandre Alapetite
f1d1d46651 Fix CLI bug regarding an empty user (#2646)
Fix https://github.com/FreshRSS/FreshRSS/issues/2644
2019-11-08 23:11:35 +01:00
Alexis Degrugillier
71b4226dc7 Add an option validation on cli commands (#2278)
If an option used on cli is not recognized, the command
aborts and displays an error message.
If the typed option is similar to one of the recognized
options, a hint is displayed.

At the moment, there is a limitation on long options.
Short options are not validated at the moment.

See #2046
2019-03-19 20:27:06 +01:00
Alexandre Alapetite
802c264574 Copy syslog to STDERR (#2208)
* Use openlog before syslog
In order to have a copy on stderr when syslog is not available.

* Take advantage of syslog for actualization
Pipe cron job STDERR and syslog to Docker log
Cf. 00bd467655
2019-01-06 00:46:48 +01:00
Alexandre Alapetite
52d0988655 Use __DIR__ for relative include and require
For uniformity, and to avoid having PHP searching in include_path.
http://php.net/manual/function.include.php
https://github.com/FreshRSS/FreshRSS/pull/1715
https://github.com/FreshRSS/FreshRSS/pull/1711#issuecomment-350581350
2017-12-11 21:11:34 +01:00
Kevin Papst
5c52d9b34b Check requirement in CLI script (#1711)
* check requirements in actualize_script before executing, fixes #1710

* removed empty whiteline

* testing all requirements

* incorporated code review feedback

* removed code that is already executed in _cli.php

* added newline at eof

* fixed include problems

* fixed include problems
2017-12-10 22:09:54 +01:00
Alexandre Alapetite
af8960b8b3 Move default configuration files
https://github.com/FreshRSS/FreshRSS/issues/1531
2017-05-12 23:33:58 +02:00
Clément
4eeae5171b use function with preg_match to check username 2017-02-16 18:54:59 +01:00
Clément
8d2b76334c Possibility to register user having a '-', a '_' or a '.' in username 2017-02-16 14:27:45 +01:00
Alexandre Alapetite
ab4ece6780 CLI do-install
https://github.com/FreshRSS/FreshRSS/issues/1095
https://github.com/FreshRSS/FreshRSS/issues/1090
2016-10-24 01:41:09 +02:00
Alexandre Alapetite
fcb9280fc8 CLI export
ZIP export, OPML export.
Corrected height of feeds select in Pafat theme.
https://github.com/FreshRSS/FreshRSS/pull/1338
https://github.com/FreshRSS/FreshRSS/issues/1039
https://github.com/FreshRSS/FreshRSS/issues/1277
2016-10-23 13:37:48 +02:00
Alexandre Alapetite
1b8eb6c7e7 CLI import ZIP/OPML/JSON for user
https://github.com/FreshRSS/FreshRSS/issues/1095
https://github.com/FreshRSS/FreshRSS/issues/851
2016-10-23 01:46:14 +02:00
Alexandre Alapetite
e1f214e9e2 CLI list-users and create-user
https://github.com/FreshRSS/FreshRSS/issues/1095
https://github.com/FreshRSS/FreshRSS/issues/1090
2016-10-22 12:58:06 +02:00