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

Modernized plugin code-base #132

Open
wants to merge 196 commits into
base: main
Choose a base branch
from

Conversation

onyijne
Copy link

@onyijne onyijne commented Oct 18, 2022

Fixes

Description

  • It has restructured the PHP code to PSR-1 standard.
  • Laid the foundation for plugin to be installed via composer
  • Paid attention to WordPress plugin standard
  • Restructured code to future release proof
  • Containerized plugin
  • Update all JavaScript functions to arrow functions
  • Changed all string concatenations to ES6 literals
  • Adhered to the recent RFC

Technical details

During development to build JavaScript assets cd termination-of-transferthen npm run install to install development dependencies, and npm run build to build the assets

For development purposes a docker-compose.yml file was created with db and PhpMyadmin dbsetup services.
I used 8701 as my outside port, you can use anyone that’s open and free on your host machine.
After getting the files, cd to it
cd termination-of-transfer/dev
and run
docker compose up -d —build
This should start the wp, db and phpmyadmin dbsetup services.
After building for the first time you should login to "phpmyadmin", and create a new database named "wordpress" then grant "dbUsername" access to the database.
A dbsetup service has been added to automate db setup

Tests

To run Result test on your machine type chmod +x test/result-pdf.sh && test/result-pdf.sh 8701 where 8701 is the port number of your host machine.

Screenshots

alt  #screenshot

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main or master).
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

For the purposes of this DCO, "license" is equivalent to "license or public domain dedication," and "open source license" is equivalent to "open content license or public domain dedication."

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

…ce to CreativeCommons_TOT with src folder as the source folder to the plugin codebase susing autoload psr-4.
@onyijne
Copy link
Author

onyijne commented Oct 25, 2022

@onyijne first major roadblock when testing it in a build is that the docker-compose -f docker-compose.dev.yml up —build produces the following error: ERROR: Named volume "composer-fix.sh:/var/www/html/composer-fix.sh:rw" is used in service "wp" but no declaration was found in the volumes section.

I would strongly urge you to avoid utilzing a non-standard docker-compose.yml filename or setup. For reference it would be better to mirror the setup present in other WordPress plugins, such as the Creative Commons WordPress Plugin

That means, likely putting the docker-compose.yml file in a /dev directory along with any other associated scripts related to the docker build/container process.

Hi @possumbilities I have attended to this, thanks.

@possumbilities
Copy link

@onyijne When testing via docker compose -f dev/docker-compose.yml up the following error occurs when opening the site in the browser:
Screen Shot 2022-11-04 at 1 31 06 PM

@onyijne
Copy link
Author

onyijne commented Nov 5, 2022

@onyijne When testing via docker compose -f dev/docker-compose.yml up the following error occurs when opening the site in the browser:
Screen Shot 2022-11-04 at 1 31 06 PM

Hi @possumbilities, yes

After building for the first time you should login to "phpmyadmin", and create a new database named "wordpress" then grant "dbUsername" access to the database.

@possumbilities
Copy link

@onyijne That makes sense, but I would add that the db creation and setup should be a part of the Docker process, not something that should have to be manually performed.

@onyijne
Copy link
Author

onyijne commented Nov 7, 2022

@onyijne That makes sense, but I would add that the db creation and setup should be a part of the Docker process, not something that should have to be manually performed.

Okay @possumbilities I will add a script to dev/docker-compose.yml to automate the db setup for development.

@onyijne
Copy link
Author

onyijne commented Nov 7, 2022

Hi @possumbilities the db setup is now automated. Thanks

@onyijne onyijne requested a review from a team as a code owner April 15, 2024 14:45
@onyijne onyijne requested review from annatuma and removed request for a team April 15, 2024 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

[Feature] Convert repository / codebase to a WordPress plugin that can be installed via composer
3 participants