Skip to content
New issue

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

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

Already on GitHub? # to your account

Move custom DB scripts to separate files #592

Merged
merged 1 commit into from
Dec 6, 2018

Conversation

joshcanhelp
Copy link
Contributor

Changes

This is the first PR in a process to improve the user migration setup process.

  • Move custom DB scripts from PHP string to separate JS file
  • Add method to get script file contents with a name
  • Updated tests for minor format changes
  • Update version number to 3.9.0-beta

Testing

No new tests added, previous tests updated to new format.

Checklist

  • All existing and new tests complete without errors
  • All code quality tools/guidelines in the Contribution guide have been run/followed
  • All active GitHub CI checks have passed

@codecov-io
Copy link

Codecov Report

Merging #592 into master will increase coverage by 0.04%.
The diff coverage is 77.77%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #592      +/-   ##
============================================
+ Coverage     28.52%   28.57%   +0.04%     
- Complexity     1308     1309       +1     
============================================
  Files            51       52       +1     
  Lines          4203     4200       -3     
============================================
+ Hits           1199     1200       +1     
+ Misses         3004     3000       -4
Impacted Files Coverage Δ Complexity Δ
lib/WP_Auth0_DBManager.php 18.38% <ø> (ø) 82 <0> (ø) ⬇️
WP_Auth0.php 22.36% <ø> (ø) 62 <0> (ø) ⬇️
lib/WP_Auth0_CustomDBLib.php 100% <100%> (ø) 1 <1> (?)
lib/WP_Auth0_Api_Operations.php 52% <50%> (+0.27%) 15 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 85a6d36...cc89e65. Read the comment docs.

@@ -45,6 +45,7 @@ public function install_db( $version_to_install = null, $app_token = '' ) {
$sso = $options->get( 'sso' );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just comments in this file ... I was researching the DB version and wanted to persist what I found.

@@ -2,13 +2,13 @@
/**
* Plugin Name: Login by Auth0
* Description: Login by Auth0 provides improved username/password login, Passwordless login, Social login and Single Sign On for all your sites.
* Version: 3.8.1
* Version: 3.9.0-beta
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First change after a release needs to bump the version number in master in a way that can be updated when the official release comes out.

Copy link
Member

@cocojoe cocojoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

* @return bool|string
*/
public static function get_script( $name, $token ) {
$script = (string) file_get_contents( WPA0_PLUGIN_DIR . 'lib/scripts-js/db-' . $name . '.js' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whenever I see file_get_contents followed by a variable. 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://secure.php.net/manual/en/function.file-get-contents.php

This function is similar to file(), except that file_get_contents() returns the file in a string, starting at the specified offset up to maxlen bytes. On failure, file_get_contents() will return FALSE.

Worst that happens is a PHP warning if the file does not exist.

@joshcanhelp joshcanhelp merged commit 60df121 into master Dec 6, 2018
@joshcanhelp joshcanhelp deleted the improve-user-migration branch December 6, 2018 15:43
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants