How do I re-create a web app from one Server Model to another?

Hello,

I would like to ask how to re-create an existing web app from a Server Model to another, for example ASP.NET to Php.
I have an existing web app created for a particular customer using ASP.NET Server Model and I now want to have a “standard” web app that can also support Php. There are no embedded ASP.NET codes, just plain HTML/CSS + Wappler modules (which I believe are mostly json + JavaScript files). I am thinking the migration of the pages are straightforward. But how about the other components?

  1. How do I migrate/copy the Server Actions from one server model to the other?
  2. Is it just copying the json files under App_Data?
  3. How about the automatically-generated aspx files under dmxConnect?
  4. Or do I need to re-create the Server Actions manually?
  5. Are there any other files/settings I need to migrate?

If anyone has already done this I would appreciate if you can share what you have done.

Thanks in advance.

How about duplicating the project (just copy the main folder) and change the server model?

Hi @mebeingken, thank you for your suggestion. I have tried what you have suggested immediately after seeing your post. But it has issues.

I have observed the following:

  1. Upon changing the server model to PHP, I can see the folders in Wappler but cannot view the files/actions/steps. When I change back to ASP.NET, I was able to view everything.
    I guess this is because when changing to PHP, it will not read the aspx files.
  2. Also, I have observed if you are using ASP.NET, it uses json files together with the aspx files. In PHP, steps/actions are in the php files.
  3. And ASP.NET is using App_Data folder, while PHP is using dmxConnectLib folder.

The Server Actions for ASP.NET are in 2 folders:

  1. App_Data = where the json files are located. The steps and queries are in the json files.
  2. dmxConnect = where the server-side files are located that has extension of .aspx

If we are going to use PHP as the Server Model, then the files under dmxConnect needs to be using .php extension.

So I guess it would be easier in the long run to just recreate the Server Connect steps and actions. >>> UPDATE: Just copy the json file contents and paste them inside the dmxConnect/api php files. I guess this will work, will try testing everything out later.

How how I wish there is a tool to easily convert them. :thinking:
I would like to wait for the Wappler Team’s response. :smile:

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:

  1. the aspx files in the dmxConnect/api directory, and the
  2. 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):

migrate_to_php_serverconn

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.

  1. 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.

  1. 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.
  1. Permissions are still not working in ASP.NET.

  2. 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.
    image

That’s all for now. I will update this post from time to time as I progress with the migration.
Hope this helps.

About the Notes:

  1. The data types returned by the database depends on the database used and the driver. It is true that PHP with PDO returns 64bit numbers as strings. You should always check what the query returns and then use the appropriate formatters to correctly format it for your page.

  2. The files should get deleted, if not then it is a bug. If it still happens for you then please post a bug report for it.

  3. This is indeed a bug, we have a fix for it in the upcoming update.

  4. The parser in ASP.NET was buggy, there where several expressions that didn’t work correctly. This will be greatly improved with the upcoming update.