Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow scaffolding without WordPress being present #157

Open
swissspidy opened this issue Jun 20, 2018 · 4 comments
Open

Allow scaffolding without WordPress being present #157

swissspidy opened this issue Jun 20, 2018 · 4 comments

Comments

@swissspidy
Copy link
Member

I don't see why a command like wp scaffold plugin-tests should require WordPress to be loaded. Using WP_Fileystem to copy/create a bunch of files seems unnecessary in this case IMO.

@schlessera
Copy link
Member

The reason why commands like this use WP_Filesystem is because we want to adhere to all permissions/security settings on the server that were configured for WordPress. Otherwise, we might create files with too lax permissions that are directly accessible from the web.

@swissspidy
Copy link
Member Author

@BrianHenryIE
Copy link
Member

BrianHenryIE commented Jul 12, 2024

wp scaffold plugin works if you add this to the beginning of the function.

define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' );
define( 'WPINC', 'wp-includes' );
require_once ABSPATH . 'wp-includes/functions.php';
require_once ABSPATH . 'wp-includes/load.php';
require_once ABSPATH . 'wp-includes/formatting.php';
require_once ABSPATH . 'wp-includes/plugin.php';
require_once ABSPATH . 'wp-includes/l10n.php';
require_once ABSPATH . 'wp-admin/includes/file.php';

In my case, I do have the WordPress files present, but I don't have a database connection.

@swissspidy
Copy link
Member Author

A blast from the past 😄

So my original issue was that I wanted to scaffold a plugin in an arbitrary location, without having a WordPress install. But if WP is detected, using the filesystem functions make sense. Right now that's not possible though.

@swissspidy swissspidy changed the title Don't use WordPress filesystem functions Allow scaffolding without WordPress being present Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants