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

Add code quality workflow #10

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Code Quality Checks

on:
pull_request:
push:
branches:
- main
- master

jobs:
code-quality:
uses: wp-cli/.github/.github/workflows/reusable-code-quality.yml@main
15 changes: 15 additions & 0 deletions .github/workflows/regenerate-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Regenerate README file

on:
workflow_dispatch:
push:
branches:
- main
- master
paths-ignore:
- "features/**"
- "README.md"

jobs:
regenerate-readme:
uses: wp-cli/.github/.github/workflows/reusable-regenerate-readme.yml@main
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"homepage": "https://github.com/ernilambar/database-command",
"require": {
"wp-cli/wp-cli": "^2"
"wp-cli/wp-cli": "^2.9"
},
"require-dev": {
"wp-cli/entity-command": "2.5",
Expand Down
9 changes: 9 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,13 @@
<!-- Rules: Include the base ruleset for WP-CLI projects. -->
<rule ref="WP_CLI_CS"/>

<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="Nilambar\WP_CLI_Database"/><!-- Namespaces. -->
<element value="wpcli_database_command"/><!-- Global variables and such. -->
</property>
</properties>
</rule>

</ruleset>
6 changes: 3 additions & 3 deletions src/DatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function reset( $args, $assoc_args ) {
private function reset_callback( $user ) {
WP_CLI::log( 'Resetting...' );

// We dont want email notification.
// We don't want email notification.
if ( ! function_exists( 'wp_new_blog_notification' ) ) {
function wp_new_blog_notification() {
// Silence is golden.
Expand All @@ -79,10 +79,10 @@ function wp_new_blog_notification() {

$prefix = str_replace( '_', '\_', $wpdb->prefix );

$tables = $wpdb->get_col( "SHOW TABLES LIKE '{$prefix}%'" );
$tables = $wpdb->get_col( $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $prefix . '%' ) ) );

foreach ( $tables as $table ) {
$wpdb->query( "DROP TABLE $table" );
$wpdb->query( $wpdb->prepare( 'DROP TABLE %s', $table ) );
}

// Set site URL.
Expand Down
Loading