Migrating to v2021

PHPMaker 2021 is another huge upgrade from previous version, it includes a long list of new features. However, if you upgrade from version prior to v2019, please be reminded that v2019 introduced some new features which are not fully compatible with old versions, make sure you read Migrating to v2019 and Migrating to v2020 first. When you open an old project in v2021, PHPMaker will try to convert the changes for you. However, the conversion cannot be 100% and you'll need to do some updates yourself. Please read the follows carefully, review your code, update and test it before deploying the new scripts to your production server.

 

PHP

Requires PHP 7.2 or higher. Using the latest PHP 7.4 is highly recommended.

 

Remote Connection to MySQL/PostgreSQL by URL

The connection script has been changed from phpmaker.php to tunnel.php, make sure you upload the script to your site and update the connection URL in your project. The tunnel.php enables PHPMaker to connect to the database like direct connection, so there could be some minor changes in data types detected, just save the project to update. If you disabled auto synchronization, click Tools -> Synchronize to update manually.

 

Database Abstraction Layer

ADOdb has been replaced by DBAL. If you use PostgreSQL and/or SQLite, the following PDO driver is required:

For other databases (MySQL, Microsoft SQL Server and Oracle), the mysqli, Microsoft PHP drivers for PHP for SQL Server and oci8 extension are required as before.

Microsoft Access is not supported any more. It is recommended that you upsize your Access database to SQL Server. Please also see System Requirements.

If you use ADOdb code in server events, you need to update it. For example, if you have code to execute a SELECT statement, you need to update your server events to use the executeQuery() of the connection object, e.g. change code like:

$rs = $conn->execute($sql);
while (!$rs->EOF) {
    $value = $rs["fieldname"];
    $rs->MoveNext();
}

to:

$stmt = $conn->executeQuery($sql);
while ($row = $stmt->fetch()) {
    $value = $row["fieldname"];
}

Similarly, replace calling the global function Execute() by ExecuteQuery(), e.g.

$stmt = ExecuteQuery("SELECT...");

Note that the result is a Statement object, not Recordset. The old Execute() is deprecated and will be changed or removed in future versions.

To execute an SQL INSERT/UPDATE/DELETE query and returns the number of affected rows, you should use executeUpdate() method of the connection object, e.g.

$rowAffected = ExecuteUpdate("UPDATE MyTable SET... WHERE...");

See Data Retrieval And Manipulation and Server Events and Client Scripts for details.

If you use Database_Connecting server event and set $info["pass"] and/or $info["db"], you need to change it to $info["password"] and/or $info["dbname"] respectively.

 

PSR-12

PHPMaker generated code now follows PSR-12 coding standard. According to the standard, method names MUST be declared in camelCase. Therefore, server events like the Row_Rendered server event (which is actually a method of the table class) will be generated as rowRendered. However, server events that are actually global functions like Database_Connecting are not changed (for backward compatibility).

Also, according to the standard, class names MUST be declared in StudlyCaps (PascalCase), therefore class names such as cars_list are changed to CarsList.

Normally server events are called and table/page objects are created internally by the web application, so these changes should not affect your code in your projects unless you have server events that call these methods or create instances of the table/page classes explicitly.

 

Routing

PHPMaker 2021 generated applications now use Slim Framework. Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs. At its core, Slim is a dispatcher that receives an HTTP request, invokes an appropriate callback routine, and returns an HTTP response.

PHPMaker will generate .htaccess (for Apache) and web.config (for IIS) file to configure the web server to send all appropriate requests to one "front-controller" PHP file, the index.php. A Slim app contains routes that respond to specific HTTP requests. Each route invokes a callback and returns an HTTP response. Each "page" (e.g. /carsview.php?ID=1 previously) is now a route (e.g. /carsview/1). You can add your routes and provide your own route callbacks.

If you have any code that specifies a URL (e.g. pageRedirecting server event), you need to update it. In general, simply remove ".php" and the parameter names for the primary key fields, and separate them by "/", e.g. change carsview.php?ID=1&foo=bar to carsview/1?foo=bar.

Slim might be an advanced topic for PHP beginners, but it provides many useful features that can make your web applications much more powerful and professional, please refer to the official documentation for details and make sure you understand how it works.

Due to this significant change, PHPMaker 2021 projects are incompatible with the old PHP Report Maker 12 projects. If you want to use old reports from PHP Report Maker projects, you must import them into PHPMaker projects.

 

Icons

Font Awesome 5 Free included in AdminLTE 3 is used. Update your icon class names in Menu Editor and server/client events, if used. If you still use v4 class names, you must read Upgrading from Version 4 and update your code. The advanced setting Use Font Awesome v4 shims has been removed, you cannot use old version 4 icon names, aliases, and syntax any more.

 

Locale File

If you edit a locale file when a project is opened, the changes are saved in the project file instead of being saved to the locale file so that the changes can be carried to the newer versions of PHPMaker.

 

Language File

As always there are many new phrases in new major version, make sure you update your non-English language files, otherwise some phrases will be missing in Multi-Language projects.

 

Also See

Migrating to v2020
Migrating to v2019

 

 

 

 ©2002-2020 e.World Technology Ltd. All rights reserved.