-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a93db57
commit b3b60d4
Showing
8 changed files
with
344 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: WPCS check | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
phpcs: | ||
name: WPCS | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: WPCS check | ||
uses: 10up/wpcs-action@stable | ||
- name: Update summary | ||
run: | | ||
npm i -g github:10up/phpcs-json-to-md | ||
phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md | ||
cat phpcs.md >> $GITHUB_STEP_SUMMARY | ||
if: always() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
.DS_Store | ||
.husky |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = { extends: ['@commitlint/config-conventional'] }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* Database handlers. | ||
* | ||
* @package WPPluginScaffold | ||
*/ | ||
|
||
namespace WPPluginScaffold\Database; | ||
|
||
/** | ||
* Set up the database | ||
* | ||
* @return void | ||
*/ | ||
function setup() { | ||
$n = function( $func ) { | ||
return __NAMESPACE__ . "\\$func"; | ||
}; | ||
|
||
add_action( 'init', $n( 'update' ), 11 ); | ||
} | ||
|
||
/** | ||
* Run functions on plugin update/activation | ||
* | ||
* @return void | ||
*/ | ||
function update() { | ||
$previous_version = get_option( 'wp_plugin_scaffold_version', 0 ); | ||
|
||
if ( version_compare( $previous_version, '0.0.1', '<=' ) ) { | ||
update_database(); | ||
} | ||
|
||
update_option( 'wp_plugin_scaffold_version', WP_PLUGIN_SCAFFOLD_PLUGIN_VERSION ); | ||
} | ||
|
||
function update_database() { | ||
global $wpdb; | ||
|
||
$table_name = $wpdb->prefix . 'wp_plugin_scaffold'; | ||
|
||
$sql = "CREATE TABLE $table_name ( | ||
);"; | ||
|
||
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); | ||
dbDelta( $sql ); | ||
} |
Oops, something went wrong.