Chapter: New features
^ Introduction | Migrating from a previous version » |
− Table of content
Improvements provided by the version 1.7 ¶
Jelix 1.7 brings many new features. However, migration is easy, as a migration script do many things.
Jelix 1.7 is now compatible only with PHP 5.6 or higher, until PHP 8.0.
Composer integration ¶
- Jelix is now installable with Composer
- Some modules and plugins are now in their own repository and available separately with Composer.
- Configuration parameters
modulesPath
andpluginsPath
are not supported anymore and replaced by a new API to call fromapplication.init.php
:jApp::declareModulesDir()
,jApp::declarePluginsDir()
,jApp::declareModuleDir()
. It si also possible to declare modules and plugins path in your composer.json file.
New app/
directory ¶
An application contains now a new app/
directory in which some files
and directory have been moved from var/
and responses/
. It allows
to separate files that are common for all environment (in app/
), from
those that are specific to a server (in var/
).
This is the case for:
- main configuration. It is now in
app/system
, containingmainconfig.ini.php
,urls.xml
, configuration files of plugins, of SOAP etc. Other files likelocalconfig.ini.php
,profiles.ini.php
stay invar/config
. config.ini.php
of entry points can be in bothapp/system
andvar/config
overloads
,themes
andlocales
directories. They should be inapp/
.var/overloads
,var/themes
andvar/locales
can be still used but only for ressources created by the application, or installed by modules added during the life of the application.responses/
has been moved toapp/responses
.- the list of entry points is not anymore into project.xml, but in a new file
app/system/framework.ini.php
andvar/config/localframework.ini.php
New URL engine ¶
There is now only one URL engine, which is a mix of significant
and
basic_significant
url engine of Jelix 1.6. It has many improvements to ease
configuration. There is not anymore a plugin system for url engines, so
simple
, significant
and basic_significant
plugins are gone.
- "module" and "action" parameters are not supported anymore (but you can still retrieve them from your controllers, even if this feature is deprecated)
- parameters
startModule
andstartAction
in the configuration do no exist anymore, as well asengine
,defaultEntrypoint
,simple_urlengine_https
,simple_urlengine_entrypoints
,basic_significant_urlengine_entrypoints
. - An API allows Installer scripts to declare new URL (so it modify
the urls.xml file):
jInstallerGlobalSetup::getUrlModifier()
,jInstallerGlobalSetup::declareNewEntryPoint()
- In the urls.xml file:
- it si possible to indicate a pathinfo on
<url module="..">
- it is required to indicate an action for the url "/". It replace the
deprecated
startModule
andstartAction
configuration parameters. - an empty pathinfo in
<url>
is equivalent to "/". - Errors during the parsing of urls.xml have been improved
- it is possible to declare an url for a controller, without declaring all of its methods.
- it si possible to indicate a pathinfo on
The migration tools generates the new urls.xml for you.
Improvements of the installer ¶
Until Jelix 1.6, the installation system called installation script of modules for each entry point. This is not the case anymore. Installation script are called only one time.
So modules declarations ( [modules]
section) is not possible anymore in
entry point configuration, but only in mainconfig.ini.php
or localconfig.ini.php
,
and a new API for installation scripts has been created.
The new installation system introduces a new step for the installation of a module: configuration. A module can provide a class that will modify configuration and install files when the developer import the module into the application. The installation will just have to finish to initialize in the application instance.
A module can also provide a class for the deinstallation. There is no anymore
uninstall()
methods into installation class. The deinstallation class is
copied outside the module when the developer "deconfigure" the module, so it
allows to execute some tasks in an application instance to remove properly
things created by the installer, even if the source code of the module has been
removed (this is the case when it was installed with Composer and then removed).
For the update of a module, you can now provide an upgrade.php
script, similar
to install.php
, which will be called at each update of the module, after
update scripts dedicated to a specific version. It allows to do repetitive
tasks at each update, and avoid to rewrite them in all update scripts.
All this changes imply changes into API and new class to inherit from into
module scripts. However classes written for the previous installation system
(based on jInstallerModule
and jInstallerEntryPoint
) are still
supported, even if they are deprecated and won't be supported in next versions
of Jelix.
There are new commands, like module:configure
and module:unconfigure
,
but some other have disappear, like installmodule
and migrate
.
During an upgrade, jInstaller does a backup of installer.ini.php
, so if
something goes wrong, you can restore it.
An other new feature, is the possibility to indicate into module.xml files, some alternative modules or some incompatible modules, in the dependencies section.
New assets system: webassets ¶
Jelix 1.7 offers a new way to declare in the HTML, assets like JS and CSS. In the configuration you can set some lists of JS scripts and CSS urls. Each lists are a named group.
So in your controller, instead of setting directly JS and CSS content, you just indicate the name of webassets group you want to use.
It allows to modify easily what a module want to load into your web page, without modifying the module itself. It could be very useful with external modules, or even modules provided by Jelix. For example, you can indicate other version of bundled library, ou you can change CSS and JS depending of the environment (demo vs production).
Note that libraries jQuery, jQueryUI and Markitup have been updated to their last version (respectively 3.3.1, 1.12.1, 1.1.15). jQueryUI is now provided as a unique file containing all components. WymEditor has been replaced by CKEditor5.
Command line script in modules ¶
In Jelix 1.6 and lower, it was possible to create command line scripts by
creating a controller inheriting of jControllerCmdLine
and an entry point
using jCmdLineCoordinator etc.. This mechanism is still usable but is deprecated.
A new mechanism is available: the module can provide
commands implemented with Symfony Console, and are
callable with a new script console.php
provided by the application, and
which will discover (almost) automatically all of these commands.
Jelix Scripts ¶
Commands that help the developer, are callable with the script cmd.php of the application. They have been totally rewritten by using Symfony Console. Names and parameters of these commands have been changed. The cmd.php script has been renamed to dev.php.
Commands about jAcl2 have been migrated into the module jacl2db, and are now callable with the new console.php script.
The createapp.php script has been moved to a bin/ directory, renamed as create-jelix-app
and is based on Symfony Console. This script asks now parameters to the user,
because of the configuration system.
jDb and jDao ¶
- jDb: improved the support of prepared queries
- bindValue and bindParam should follow signature of PDO'ones
- sqlite: support of prepared queries
- pgsql: support of named parameters for prepared queries
- mysqli: improved support of prepared queries
- jDb/mysqli: use modern api to start transaction
- jDao has now its own plugins to generate classes. So "daobuilder" classes of jDb plugins are not recognized anymore.
- jDb schema: all improvements coming from Jelix 1.6.16. Full support of SQL schema changes with Mysql, Postgresql Sqlite3, OCI and SQLServer.
- Classes of jDbTools have been migrated outside the database plugins.
- jProfiles:
- The content of profiles.ini.php is optimized and stored in a cache
- it is extensible with plugins: these plugins can process a specific type
of profile and store some additionnal informations in the cache.
(plugin :
profiles/<type>/<type>.profiles.php
, class:<type>ProfilesCompiler
). - A plugin for jDb is provided, allowing jDb to improve the connection speed.
jForms ¶
- jForms does not store instances data into the session, but into a cache, by using jCache (so you can configure the cache : in files, or in memcache, Redis...)
- For the
choice
control, an item can now be an empty value. - a
choice
control can be used inside agroup
. - The javascript generated for a form is now loaded as a separate file, and is not anymore inline, with the HTML code. This is useful to have clean CSP rules.
- All components of jForms, as well as wikieditor and htmleditor, are now using the new web assets system, so it is easy to replace javascript and CSS url.
- In Javascript, you can now reload a listbox generated dynamically, by calling
the new method
jforms::updateDynamicList()
. - The datetime picker allows now to select time
- new control
<color>
to select a color. - new control
<upload2>
enhancing the actual<upload>
with management of already uploaded files.
API change in the framework core ¶
- The property
_lang
ofjResponseHtml
does contain now only the lang code (XX) instead of the full locale (XX_YY). The full locale is now in a new property_locale
. - jRequest parse now automatically JSON content from the body request. This feature was introduced in Jelix 1.6.12 but it was deactivated by default.
- new method
jCoordinator::execOriginalAction()
to know when there is an internal redirection - jCmdLineRequest: the module and the action name should be given to the constructor when the script is dedicated to a specific action.
- CRUD controller: the records list can be ordered
- jAcl2: the notion of 'subject' has been replaced by the notion of 'right', which is more relevant. API having the word 'subject' in their name have been replaced by API using the 'right' name, but they are still available.
jApp
:- new method
jApp::urlBasePath()
which allow to retrieve the base path, so it is a shortcut forjApp::config()->urlengine['basePath']
. - new method
jApp::version()
- jApp is now using internally a new class jAppInstance to ease context switching
- new method
jAppInstance::includePlugin()
to load a plugin class without instancying it directly
- new method
- new object
jFramework
allowing to access to some informations about the framework (version...) - In new application created with createapp.php, the temp directory is now in the application directory
- Web assets of modules loaded by the www controller of Jelix are now put in the cache of the browser.
Other new features ¶
- by default, in all new application, the content of jelix-www is duplicated
into the directory www/jelix/ of the application, so it ease the start
of the developpement of the application. You can keep the old behavior:
having a web alias to jelix-www/ in the web server configuration. You can
also create a symbolic link. This is configurable by launching the configurator
of the module jelix, with the new command
module:configure
.
- jAuth: persistant_crypt_key has been renamed to persistant_encryption_key and use a stronger random generation algorithm.
- jAuth, plugin ldap: connection information (host, login, password etc.) should now be into the profiles.ini.php file
- jAuth: new method
canChangePassword()
- jauthdb_admin: Users list can be filtered and ordered
- jacl2db_admin: Users list can be filtered
- jLocale can now try a locale key in a similar locale of the current one
- Organize zones cache into subdirectories
jIniFileModifier
: no empty line added at the end of the file at each savejFile
is based on the Composer package "jelix/file-utilities", which have more useful methods.jFile::getMimeTypeFromFilename()
: support of a mime type list defined into a[mimeTypes]
section in the configuration- fix jDatetime about RCF822 format and timezone
- new exceptions for controllers,
jHttpErrorException
,jHttp404NotFoundException
,jHttp401UnauthorizedException
andjHttp403ForbiddenException
to return easily an HTTP response (Jelix 1.7.2+). - jAuth: new method
getReasonToForbiddenPasswordChange
(1.7.11) - New CRUD controller
jControllerDaoCrudFilter
(1.7.9)
Modules and plugins removed ¶
Like the jtcpdf module in previous version of Jelix, some modules and plugins are not provided anymore with the Jelix package, but available separately via Composer.
Here are these modules and plugins
- jSoap module: jelix/soap-server-module
- jtcpdf module: jelix/tcpdf-module.
- Minify plugin for jResponseHtml: jelix/minify-module.
- redis plugin for jKVDb: jelix/php-redis-plugin.
- jsitemap module : jelix/sitemap-module
- diff plugin for jTpl
Some other components, modules and plugins are now in their own repository, although there are available with the Jelix package via Composer dependencies.
- new module jFeeds containing classes and responses object to generate RSS and ATOM feeds
- Standalone version of jTpl: Castor
- IniModifier and MultiIniModifier, (formely known as jIniFileModifier and jIniMultiFilesModifier)
- jWiki and WikiRenderer
Deprecated features, modules and plugins ¶
- There are not anymore en_EN locales files. Configure your application to use en_US or en_GB locales
- The memcache22 plugin for jCache has been removed
- Method
jInstallerBase::declarePluginsPath()
has been removed - jIniFile, jIniFileModifier, jIniMultiFilesModifier have other names: Jelix\IniFile\Util, Jelix\IniFile\IniModifier, Jelix\IniFile\MultiIniModifier. But it is still possible to use old name until the next version.
- The method
jApp::configPath()
is deprecated and replaced byjApp::varConfigPath()
- The class
jJson
has been removed. Use json PHP functions instead. - The class
jCrypt
has been removed. The API it used has been deprecated in PHP and is not maintained anymore. You should use other stronger libraries like defuse/php-encryption for example. - the class
jVersionComparator
has been replaced by another similar classJelix\Version\VersionComparator
(package "jelix/version") - Remove <directories> from project.xml. It is not supported anymore.
- the plugin zendframework has been removed
- jDao: the 'driver' attribute on the
binary_op
element is deprecated, and is replaced by a 'dbtype' attribute - jDao: the support of the attribute
groupby
on the elementmethod
has been removed - jDao: the deprecated method
jDaoConditions::addItemGroup()
has been removed - the driver
mssql
for jDb has been deprecated. Use the driversqlsrv
instead.
- Simpletests and the junittests module has been removed. If you need them, you can still installed separately (with Composer for example).
- mysql and sqlite plugins. They used deprecated PHP API. Note that there are still a mysqli and a sqlite3 plugin in Jelix
- jHttp is now deprecated and available as a Composer package
- Clearbricks files have been removed
- files json.js, json2.js and xul/jsonrpc.js have been removed since browsers support now JSON natively.
- plugin
LDS
for jAuth has been removed.
For contributors ¶
- The Vagrant configuration for contributors is now in testapp
- No need anymore to "build" Jelix from the git repository: it is more easy to contribute ;-)
- FakeServerConf, Minify, PHPMailer are now installed via Composer
- In testapp, a new application "adminapp" is available to test admin modules
Contributors to Jelix 1.7 ¶
- Brunto (crud controller)
- Julien Issler (improvements on jForms)
- Laurent Jouanneau (most of improvements)