wpdotnet-sdk icon indicating copy to clipboard operation
wpdotnet-sdk copied to clipboard

Need help with ‍WPDOTNET_HOTPLUG_ENABLE‍‍ property

Open jakubmisek opened this issue 3 years ago • 5 comments

@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 avatar Jan 15 '22 14:01 jakubmisek

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" },
                };
            });

jakubmisek avatar Jan 15 '22 14:01 jakubmisek

Thank you @jakubmisek

Yes, this explanation is quite clear.

amira133 avatar Jan 15 '22 15:01 amira133

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

amira133 avatar Jan 15 '22 15:01 amira133

and do they work?

jakubmisek avatar Jan 15 '22 15:01 jakubmisek

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" },
    };

  });

amira133 avatar Jan 15 '22 16:01 amira133