Git Product home page Git Product logo

base-distribution's Introduction

phpList core module

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

About phpList

phpList is an open source newsletter manager. This project is a rewrite of the original phpList.

About this package

This is the core module of the successor to phpList 3. It will have the following responsibilities:

  • provide access to the DB via Doctrine models and repositories (and raw SQL for performance-critical parts that do not need the models)
  • routing (which the web frontend and REST API will use)
  • authentication (which the web frontend and REST API will use)
  • logging
  • a script for tasks to be called from the command line (or a cron job)
  • tasks to create and update the DB schema

Please note that this module does not provide a web frontend or a REST API. There are the separate modules phpList/web-frontend and phpList/rest-api for these tasks.

This module should not be modified locally. It should be updated via Composer.

Installation

Since this package is only a service required to run a full installation of phpList 4, the recommended way of installing this package is to run composer install from within the phpList base distribution which requires this package. phpList/base-distribution containrs detailed installation instructions in its README.

Contributing to this package

Contributions to phpList repositories are highly welcomed! To get started please take a look at the contribution guide. It contains everything you would need to make your first contribution including how to run local style checks and run tests.

Code of Conduct

This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you are expected to uphold this code.

Structure

Running the web server

The phpList application is configured so that the built-in PHP web server can run in development and testing mode, while Apache can run in production mode.

Please first set the database credentials in config/parameters.yml.

Development

To run the application in development mode using PHP's built-in server, use this command:

bin/console server:run -d public/

The server will then listen on http://127.0.0.1:8000 (or, if port 8000 is already in use, on the next free port after 8000).

You can stop the server with CTRL + C.

Development and Documentation

We use phpDocumentor to automatically generate documentation for classes. To make this process efficient and easier, you are required to properly "document" your classes,properties, methods ... by annotating them with docblocks.

More about generatings docs in PHPDOC.md

Testing

To run the server in testing mode (which normally will only be needed for the automated tests, provide the --env option:

bin/console server:run -d public/ --env=test

Production

For documentation on running the application in production mode using Apache, please see the phpList base distribution README.

Changing the database schema

Any changes to the database schema must always be done both in phpList 3 and later versions so that both versions always have the same schema.

For changing the database schema, please edit resources/Database/Schema.sql and adapt the corresponding domain model classes and repository classes accordingly.

Developing phpList modules (plugins)

In phpList, plugins are called modules. They are Composer packages which have the type phplist-module.

Bundle and route configuration

If your module provides any Symfony bundles, the bundle class names need to be listed in the extra section of the module's composer.json like this:

"extra": {
    "phplist/core": {
        "bundles": [
            "Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle",
            "PhpList\\Core\\EmptyStartPageBundle\\PhpListEmptyStartPageBundle"
        ]
    }
}

Please note that the key of the section with extra needs to always be phplist/core, not the name of your module package. Please have a look at the composer.json in the rest-api module for an example.

Similarly, if your module provides any routes, those also need to be listed in the extra section of the module's composer.json like this:

"extra": {
    "phplist/core": {
        "routes": {
            "homepage": {
                "resource": "@PhpListEmptyStartPageBundle/Controller/",
                "type": "annotation"
            }
        }
    }
}

You can also provide system configuration for your module:

"extra": {
    "phplist/core": {
        "configuration": {
            "framework": {
                "templating": {
                    "engines": [
                        "twig"
                    ]
                }
            }
        }
    }
}

It is recommended to define the routes using annotations in the controller classes so that the route configuration in the composer.json is minimal.

Accessing the database

For accessing the phpList database tables from a module, please use the Doctrine model and repository classes stored in src/Domain/ in the phplist/core package (this package).

For accessing a repository, please have it injected via dependency injection. Please do not get the repository directly from the entity manager as this would skip dependency injection for that repository, causing those methods to break that rely on other services having been injected.

Currently, only a few database tables are mapped as models/repositories. If you need a mode or a repository method that still is missing, please submit a pull request or file an issue.

Accessing the phpList data from third-party applications

To access the phpList data from a third-party application (i.e., not from a phpList module), please use the REST API.

Copyright

phpList is copyright (C) 2000-2021 phpList Ltd.

base-distribution's People

Contributors

fenn-cs avatar michield avatar oliverklee avatar schmidtsabine avatar xh3n1 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

base-distribution's Issues

'client denied by server configuration' in /.htaccess

/.htaccess appears to be preventing access to the index page of /web when the base distribution is hosted by Apache.

[Sat Sep 30 12:26:35.310824 2017] [authz_core:error] [pid 14499] [client 127.0.0.1:45252] AH01630: client denied by server configuration: /var/www/base-dist/web/

Relevant section of httpd.conf:

<VirtualHost *:80>
        DocumentRoot /var/www/base-dist/web

        <Directory /var/www/base-dist/web>
            AllowOverride All
            Order Allow,Deny
            Allow from All
        </Directory>

        ServerName local.base-dist
        SetEnv PHPLIST_DATABASE_NAME foo
        SetEnv PHPLIST_DATABASE_USER bar
        SetEnv PHPLIST_DATABASE_PASSWORD bam
</VirtualHost>

`list-modules` script prints two lines per module

The composer script list-modules prints two lines per found module. Is this as intended? E.g.:

$ composer run-script list-modules
> PhpList\PhpList4\Composer\ScriptHandler::listModules
phplist/phplist4-core  4.0.x-dev
phplist/phplist4-core  dev-master
phplist/rest-api       4.0.x-dev
phplist/rest-api       dev-master

[META] base distribution phase 2

This meta ticket covers the base-distribution-related tasks for phase 2. The core-specific tasks are listed in phpList/core#125, the rest-api-specific tasks are listed in phpList/rest-api#20, and the web-frontend-specific-tasks are listed in phpList/web-frontend#16.

  • make sure Composer installs the latest version of the dependencies (should be fixed as it was a Packagist configuration issue)
  • #19 remove the web-frontend dependency
  • #16, #20 make the package installable via composer create-project
  • #21 rename the branch alias from 4.0.0-dev to 4.0.x-dev https://getcomposer.org/doc/articles/aliases.md#branch-alias
  • #22, automatically set up the document root and document this
  • #17, #22 document the installation process
  • add CI stuff for this package
  • #24 add the symfony console
  • #29 prevent access to the application root directory
  • #30 document the Apache settings (with examples)
  • #25 document how to use the different application contexts
  • #31 use the bin/ and web/ generation script from the core
  • #32 set up the log and cache directories
  • #25, #33 document running phpList in development and testing mode
  • #43 automatically clear and warm all caches on composer update
  • #49 add a structure for a configuration file that is outside the vendor folder
  • document how to create downloadable tgz/zip packages

Packaging script

  1. composer install should work without DB credentials
  2. composer create-project should not warm any caches (as those would wind up in the created ZIP)
  3. something like:
    composer create-project phplist/base-distribution phplist 4.0.x-dev --prefer-dist --no-dev --stability=dev
  4. automatically create a TGZ with the version number in the file name

[META] phase 3

`composer create-project` fails with "No such file or directory"

Short description

While installing the base distribution using the supplied instructions, the following error occurs:

$ composer create-project -s dev --no-dev phplist/base-distribution your-project
> cp -rf vendor/phplist/phplist4-core/web/ .
cp: cannot stat 'vendor/phplist/phplist4-core/web/': No such file or directory
Script cp -rf vendor/phplist/phplist4-core/web/ . handling the document-root event returned with error code 1

PHP and Composer version

Composer version 1.5-dev (27ee47def7648652615979e504d6bcc2e7f4bdef) 2017-05-31 14:05:54
PHP 7.1.7 (cli) (built: Jul 6 2017 12:10:54) ( NTS )

Client denied by server configuration for

Short problem description

A plugin URL is going 403 and I can't found why.

Steps to reproduce

From the editor, I go to the image server browsing, calling this url:

https://mailing.site.org/lists/admin/plugins/fckphplist/fckeditor/editor/filemanager/connectors/php/connector.php?Command=GetFoldersAndFiles&Type=File&CurrentFolder=%2F&uuid=1530137988035

Expected behaviour

The URL should be accessible.

Actual behaviour

[Thu Jun 28 00:45:41.966389 2018] [authz_core:debug] [pid 13187] mod_authz_core.c(809): [client 90.110.6.214:43194] AH01626: authorization result of Require all denied: denied
[Thu Jun 28 00:45:41.966482 2018] [authz_core:debug] [pid 13187] mod_authz_core.c(809): [client 90.110.6.214:43194] AH01626: authorization result of <RequireAny>: denied
[Thu Jun 28 00:45:41.966568 2018] [authz_core:error] [pid 13187] [client 90.110.6.214:43194] AH01630: client denied by server configuration: /var/www/site.org/mailing/current/web/lists/admin/plugins/fckphplist/fckeditor/editor/filemanager/connectors/php/connector.php

If there are any error messages, please include those as well.

System configuration

Package version

3.3.1

PHP and Composer version

PHP 7.2.5-0ubuntu0.18.04.1 (cli) (built: May  9 2018 17:21:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.5-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
Composer version 1.6.3 2018-01-31 16:28:17

Apache (2.4) configuration

<VirtualHost *:443>
    ServerName mailing.site.org
    DocumentRoot /var/www/site.org/mailing/current/web

    <Directory "/var/www/site.org/mailing/current/web">
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/mailing.site-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug

    CustomLog ${APACHE_LOG_DIR}/mailing.site-access.log combined

    Include /etc/apache2/sites-ssl/site-org.ssl.conf
    Include /etc/apache2/letsencrypt.conf
</VirtualHost>

/vendor/phplist/phplist4-core/vendor/autoload.php not found

With a clean installation of the base distribution, running on the local PHP development server, the following error occurs when loading the index page in browser via http://127.0.0.1:8000/

[Sat Sep 30 12:16:31 2017] PHP Warning:  require(/var/www/base-dist/vendor/phplist/phplist4-core/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/base-dist/vendor/phplist/phplist4-core/web/app_dev.php on line 7
[Sat Sep 30 12:16:31 2017] PHP Stack trace:
[Sat Sep 30 12:16:31 2017] PHP   1. {main}() /var/www/base-dist/vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php:0
[Sat Sep 30 12:16:31 2017] PHP   2. require() /var/www/base-dist/vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php:42

Add documentation for regarding config file and web root

Please add documentation explaining:

  • Where the database configuration should be set. E.g. should /vendor/phplist/phplist4-core/Configuration/config.ini.dist be copied and modified?
  • What directory should be set as the web root? E.g. /vendor/phplist/phplist4-core/Public/ ? Using that directory gives the following error:
    PHP Fatal error: require_once(): Failed opening required '/var/www/pl4-base-distribution/vendor/phplist/phplist4-core/Public/../vendor/autoload.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/pl4-base-distribution/vendor/phplist/phplist4-core/Public/index.php on line 6

If this is already documented in another module repository, a 'See also' note or similar would be useful, as this base-distribution will presumably be the first interaction with phpList 4 for many developers.

Stable version required by composer but none available

Short problem description

Composer fails to create the project due to lack of a stable version of this package

Steps to reproduce

  1. Execute $ composer create-project phplist/base-distribution
  2. Get error: [InvalidArgumentException] Could not find package phplist/base-distribution with stability stable.

Expected behaviour

Composer creates the project successfully

Actual behaviour

Error printed

System configuration

Package version

NA

PHP and Composer version

PHP 7.1.7 (cli) (built: Jul 6 2017 12:10:54) ( NTS )
Composer version 1.5-dev (27ee47def7648652615979e504d6bcc2e7f4bdef)

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.