Skip to content

Conversation

@up1512001
Copy link
Member

@up1512001 up1512001 commented Dec 17, 2025

Overview

This PR refactors the OneUpdate plugin to follow PSR-4 autoloading standards and modern PHP best practices, improving code organization, maintainability, and developer experience.

Code Organization & Architecture

PSR-4 Autoloading: Restructured all PHP classes to follow PSR-4 naming conventions and directory structure
Namespace Organization: Organized code into logical modules under OneUpdate\Modules*

  • Core: Core functionality (Assets, DB, REST)
  • Plugin: Plugin-specific features (Admin, Cache, S3, Settings, VIP)
  • Rest: REST API controllers
  • Settings: Settings management

Checklist

  • I have read the Contribution Guidelines.
  • I have read the Development Guidelines.
  • My code is tested to the best of my abilities.
  • My code passes all lints (ESLint etc.).
  • My code has detailed inline documentation.
  • I have updated the project documentation as needed.
  • I have added a changeset for this PR using npm run changeset.

@up1512001 up1512001 self-assigned this Dec 17, 2025
Copilot AI review requested due to automatic review settings December 17, 2025 18:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the OneUpdate plugin to follow PSR-4 autoloading standards and modern PHP best practices. The refactoring reorganizes code into logical modules, improves code organization, implements proper encryption for sensitive data, and enhances the development tooling infrastructure.

Key changes:

  • Migrated from classmap autoloading to PSR-4 namespace structure under OneUpdate\Modules\*
  • Implemented encryption for sensitive credentials (API keys, GitHub tokens, S3 credentials)
  • Enhanced build tooling with TypeScript support and improved webpack configuration
  • Added comprehensive code quality tools (PHPStan, expanded PHPCS rules)
  • Restructured REST API controllers with a base abstract class

Reviewed changes

Copilot reviewed 88 out of 95 changed files in this pull request and generated no comments.

Show a summary per file
File Description
webpack.config.js Updated build paths and added TypeScript support with path aliases
uninstall.php Enhanced multisite support and comprehensive cleanup
tsconfig.json Added TypeScript configuration with strict type checking
phpunit.xml.dist New PHPUnit configuration for testing
phpstan.neon.dist Added static analysis configuration
phpcs.xml.dist Comprehensive PHPCS rules with Slevomat standards
package.json Updated dependencies and build scripts
oneupdate.php Simplified entry point using autoloader
inc/Main.php New main plugin class with registrable pattern
inc/Autoloader.php PSR-4 autoloader with graceful failure handling
inc/Encryptor.php AES-256-GCM encryption for sensitive data
inc/Modules/* Reorganized code into logical modules
inc/Contracts/* Interfaces and traits for architecture
composer.json Updated to PSR-4 autoloading with modern dev dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@up1512001 up1512001 requested a review from justlevine December 17, 2025 18:06
Copy link
Collaborator

@justlevine justlevine left a comment

Choose a reason for hiding this comment

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

Looks great!
As with previous migrations, I'm not sure what exactly is preexisting and what is from the refactor (for some reason git isn't recognizing them as renames), so use your discretion

"composer/installers": true
},
"platform": {
"php": "8.1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is intentionally PHP 8.1 and not 8.0? If so we should update the docs + plugin headers + phpcs/phpstan configs. If not, we should drop this + the require below.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, make sure to bump readme.txt and remove it from the (commented out) phpunit matrix in test.yml

@up1512001 up1512001 requested a review from justlevine December 18, 2025 08:46
justlevine
justlevine previously approved these changes Dec 18, 2025
Copy link
Collaborator

@justlevine justlevine left a comment

Choose a reason for hiding this comment

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

Once those last 2 comments are handled, go ahead and merge - no reason to wait on me.

@up1512001
Copy link
Member Author

Merging since it's already being approved.

@up1512001 up1512001 merged commit e0bb986 into develop Dec 18, 2025
10 checks passed
@up1512001 up1512001 deleted the dev/refactoring branch December 18, 2025 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants