Here’s an update for this post. Just a few observations as well.
You can copy all files from one project to another, but there are differences and you have to re-create some files.
A. First, rename all web files from *.aspx to *.php.
And if you are using ASP embedded server code, you will have to convert them to PHP code manually. This is also true if you are using Security Provider Enforcer because it is using ASP.NET code.
B. Migrating the Server Action files.
Create the necessary DB connection first and link it before migrating your Server Actions.
To migrate the Server Actions:
In ASP.NET, the Server Action files consists of 2 files:
- the aspx files in the
dmxConnect/api
directory, and the
- JSON files in the
App_Data/ServerConnect/api
directory.
In PHP, the Server Action files are only the dmxAppConnect/api/your_server_connect_folder/*.php
files.
You will only need the JSON files under App_Data
from your ASP.NET project.
To migrate them over, you will need to create first the same Server Actions in the PHP Server Model. It will create the JSON files under dmxConnect/api
. (the name of the Server Action is the same as the filename of the JSON files)
Then copy the contents of the ASP.NET JSON file to the highlighted region in the screenshot below of the PHP JSON file (between $app->define(<<<'JSON'
and JSON
):
After saving, you can open the Server Action in Wappler and check.
C. The Server Action Security Providers
It will be easier to just re-create the Security Provider directly in the Action Steps than just copying the files as they have different formats. The files are located in App_Data/ServerConnect/modules/SecurityProviders/your_security_provider_file.json
for ASP.NET while dmxConnect\modules\SecurityProviders/your_security_provider_file.php
for PHP.
You can copy the contents of the JSON file to the PHP file in between the $exports = <<<'JSON'
and JSON;
of the PHP file if you want.
D. The dmxAppConnect/config.js
file.
The App Connect Manager strings are stored in the config.js
file, like the Query Manager query strings and the Cookie Manager cookies. It also stores the meta data of your BS4 Tables and ServerConnect queries.
In case you have accidentally deleted your aspx/PHP files, the State Manager strings can be recalled/restored if you created the file with the same App Name
and add the State Managers.
If you have copied all directories/files of your .NET Project to the PHP Project, then no need to copy the config.js
separately.
E. Update your SQL queries.
As you know, there are differences in the SQL language implementation between MS SQL and MySQL (e.g. ISNULL vs IFNULL). You will have to update your queries for the migration.
OTHER NOTES
The following are observations, they may be bugs or limitations.
- Decimal data types are returned to your page as decimals in ASP.NET, while they are strings in PHP Server Model. So you will need to modify your page by adding
.toNumber()
first before .formatNumber
(e.g. .toNumber().formatNumber(xxxxx)
).
Or if you want to keep the codes on your pages, you can modify server-side via your Server Actions and update if you have variables created there.
-
e.g. {{ mynumber.default(0).toNumber().formatNumber(2, ".", ",") * 1 }}
is the same as {{ mynumber.default(0).formatNumber(2, ".", "").toNumber() }}
.
-
Notice the omitted separator string on the second example. If you put comma as the separator, the .toNumber()
function will only convert the numbers before the separator. It is as if the string was split between the separator.
- File cleanup is not working in ASP.NET implementation.
- If you have deleted, for example, a Server Connect Action File, the equivalent file is not deleted and will stay on your filesystem.
- In PHP Server Model, this is working fine.
-
Permissions are still not working in ASP.NET.
-
Using the query as the parameter in a Condition in Server Connect Action Steps in ASP.NET is still not working and returns an error saying that the array or something cannot be converted to Boolean. As mentioned on one of my posts, I am using COUNT in the query and use query(0).countalias >= 1 as the parameter of the Condition. In PHP, using this as parameter in a Condtion works just fine.
eg.
That’s all for now. I will update this post from time to time as I progress with the migration.
Hope this helps.