Ejemplo n.º 1
0
        PhpValue InstallSourceSelection(string source)
        {
            if (_packages.InstallPackage(source, out var nuspec))
            {
                // TODO: check the plugin has dependency on the current wpdotnet+runtime (is compatible)

                // get content of the plugin to be copied to wp-content/[plugins|themes]/
                // TODO: themes
                return(Path.Combine(source, "contentFiles/any/netcoreapp2.0/wordpress/wp-content/plugins", nuspec.GetId()) + "/"); // ends with / because wp expects so
            }
            else
            {
                // fallback to regular WP plugin, results in error
                return(source); // PhpValue.FromClass( new WP_Error );
            }
        }
Ejemplo n.º 2
0
        PhpValue InstallSourceSelection(string source)
        {
            if (_packages.InstallPackage(source, out var nuspec))
            {
                // TODO: check the plugin has dependency on the current wpdotnet+runtime (is compatible)

                // get content of the plugin to be copied to wp-content/[plugins|themes]/
                var contentsource = Path.Combine(source, "contentFiles/any/netcoreapp2.0/wordpress/wp-content");
                Debug.Assert(Directory.Exists(contentsource));

                foreach (var type in new[] { "plugins", "themes" })
                {
                    var fullcontentsource = Path.Combine(contentsource, type, nuspec.GetId()) + "/";    // ends with / because wp expects so
                    if (Directory.Exists(fullcontentsource))
                    {
                        return(fullcontentsource);
                    }
                }
            }

            // fallback to regular WP plugin, results in error
            return(source); // PhpValue.FromClass( new WP_Error(...) );
        }
Ejemplo n.º 3
0
        PhpValue InstallSourceSelection(string source)
        {
            var package = _packages.InstallPackage(source, out var nuspec);

            if (package != null)
            {
                // get content of the plugin to be copied to wp-content/[plugins|themes]/
                var contentsource = Path.Combine(source, "contentFiles/any/netcoreapp2.0/wordpress/wp-content");
                Debug.Assert(Directory.Exists(contentsource));

                foreach (var type in new[] { "plugins", "themes" })
                {
                    var fullcontentsource = Path.Combine(contentsource, type, nuspec.GetId());
                    if (Directory.Exists(fullcontentsource))
                    {
                        return(fullcontentsource + "/");    // ends with / because wp expects so
                    }
                }
            }

            // fallback to regular WP plugin, results in error
            return(source); // PhpValue.FromClass( new WP_Error(...) );
        }