iolevel / wpdotnet-sdk

WordPress compiled to .NET Standard. SDK for ASP.NET Core.
http://www.wpdotnet.com
Other
416 stars 71 forks source link

Need help with ‍WPDOTNET_HOTPLUG_ENABLE‍‍ property #119

Open jakubmisek opened 2 years ago

jakubmisek commented 2 years ago

@amira133 at https://github.com/peachpiecompiler/peachpie/issues/1020:

The description of WPDOTNET_HOTPLUG_ENABLE in this address is ambiguous. You may explain more. If WPDOTNET_HOTPLUG_ENABLE is equal to 1 , effectively disallows downloading plugins from the dashboard Or if it is 0? Also how do I set this utility in ConfigureServices?

thanks

jakubmisek commented 2 years ago

you are right, this needs some more explanation.

We are using this internally for our projects, although it deserves more information. Does something like this make sense?


WPDOTNET_HOTPLUG_ENABLE‍‍ = 1: plugins can be downloaded on the live website and PHP code will be compiled in-memory once the application starts, and whenever it changes during the application run.

WPDOTNET_HOTPLUG_ENABLE‍‍ = 0: any PHP code added after the application is compiled and published won't work; plugins and themes can't be downloaded on the live website. All the PHP code is compiled once during the dotnet build.

To set this constant within ConfigureServices:

            services.AddWordPress(options => {
                options.Constants = new Dictionary<string, string>() {
                    { "WPDOTNET_HOTPLUG_ENABLE‍‍", "0" },
                };
            });
amira133 commented 2 years ago

Thank you @jakubmisek

Yes, this explanation is quite clear.

amira133 commented 2 years ago

Apparently this feature does not work. This feature in both cases(means 0,1), it is possible to download and install the plugin and theme.

PeachPied.WordPress 5.8.2-preview12 .netcore 5

jakubmisek commented 2 years ago

and do they work?

amira133 commented 2 years ago

yes, forexample I download and install Twenty Fifteen theme, and set as my theme. (same for Elementor, but it seems some problem with Elementor in both WPDOTNET HOTPLUG Enabled or Disabled)

image

my StartUp code :

  services.AddWordPress(options =>
  {

    options.DbHost = _appConfiguration["WordPress:Database:DbHost"];
    options.DbPassword = _appConfiguration["WordPress:Database:DbPassword"];
    options.DbUser = _appConfiguration["WordPress:Database:DbUser"];
    options.DbName = _appConfiguration["WordPress:Database:DbName"];

    options.Constants = new Dictionary<string, string>() {
        { "WPDOTNET_HOTPLUG_ENABLE‍‍", "0" },
    };

  });