From aa472ead4fc0e3d6274672271aea118dba0878f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20de=20la=20Pen=CC=83a?=
Date: Fri, 30 Oct 2026 19:18:21 +0000
Subject: [PATCH] feat: Run find-replace on the pre-new-admin admin
Ports the module from develop onto the legacy admin:
- The admin controller lives in admin/controllers, extends the old
Base, and offers the `search` and `replace` permission strings.
- `moduleName` becomes `findReplace` so the router can build the
controller namespace; the module folder follows it.
- Permission strings and admin URLs live in src so the queue task,
the API, and the views can use them without loading the controller.
- The results screen brings its own progress bar and badge colours,
which the Bootstrap 3 admin does not have.
- Dependencies and CI target feature/pre-new-admin.
The JSON status action is dropped; the API already serves it.
Co-Authored-By: Claude Opus 5.5
---
.github/workflows/build_and_test.yml | 6 +-
.github/workflows/migration_numbering.yml | 2 +-
.github/workflows/static_analysis.yml | 4 +-
.phpstan/config.neon | 3 +-
.../controllers}/FindReplace.php | 107 ++++++++++--------
admin/views/FindReplace/changes.php | 6 +-
admin/views/FindReplace/results.php | 18 ++-
assets/css/admin.min.css | 2 +-
assets/js/admin.min.js | 2 +-
assets/js/components/Progress.js | 25 +++-
assets/sass/admin.scss | 63 +++++++++++
composer.json | 16 +--
.../config/email_types.php | 4 +-
.../views/Email/templates/search/complete.php | 0
.../templates/search/complete_plaintext.php | 0
.../views/Email/templates/search/fail.php | 0
.../Email/templates/search/fail_plaintext.php | 0
src/Admin/Permission.php | 13 +++
src/Admin/Permission/Replace.php | 18 ---
src/Admin/Permission/Search.php | 18 ---
src/Admin/Url.php | 19 ++++
src/Api/Controller/Search.php | 6 +-
src/Queue/Task/Search.php | 4 +-
tests/Admin/PermissionTest.php | 44 +++++++
24 files changed, 262 insertions(+), 118 deletions(-)
rename {src/Admin/Controller => admin/controllers}/FindReplace.php (90%)
rename {find-replace => findReplace}/config/email_types.php (86%)
rename {find-replace => findReplace}/views/Email/templates/search/complete.php (100%)
rename {find-replace => findReplace}/views/Email/templates/search/complete_plaintext.php (100%)
rename {find-replace => findReplace}/views/Email/templates/search/fail.php (100%)
rename {find-replace => findReplace}/views/Email/templates/search/fail_plaintext.php (100%)
create mode 100644 src/Admin/Permission.php
delete mode 100644 src/Admin/Permission/Replace.php
delete mode 100644 src/Admin/Permission/Search.php
create mode 100644 src/Admin/Url.php
create mode 100644 tests/Admin/PermissionTest.php
diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml
index 1f7e44d..6b1fd62 100644
--- a/.github/workflows/build_and_test.yml
+++ b/.github/workflows/build_and_test.yml
@@ -1,9 +1,9 @@
name: build_and_test
on:
push:
- branches: [ main, develop ]
+ branches: [ main, develop, feature/pre-new-admin ]
pull_request:
- branches: [ main, develop ]
+ branches: [ main, develop, feature/pre-new-admin ]
jobs:
test:
@@ -61,7 +61,7 @@ jobs:
${{ runner.os }}-yarn-
- name: Install Composer dependencies
- run: COMPOSER_ROOT_VERSION=dev-develop composer install --no-interaction --prefer-dist
+ run: COMPOSER_ROOT_VERSION=dev-feature/pre-new-admin composer install --no-interaction --prefer-dist
- name: Install Yarn dependencies
run: yarn install
diff --git a/.github/workflows/migration_numbering.yml b/.github/workflows/migration_numbering.yml
index 069c767..d2801df 100644
--- a/.github/workflows/migration_numbering.yml
+++ b/.github/workflows/migration_numbering.yml
@@ -2,7 +2,7 @@ name: migration_numbering
on:
pull_request:
push:
- branches: [ main, develop ]
+ branches: [ main, develop, feature/pre-new-admin ]
paths:
- 'src/Database/Migration/**'
- 'composer.json'
diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml
index e1c5360..235a708 100644
--- a/.github/workflows/static_analysis.yml
+++ b/.github/workflows/static_analysis.yml
@@ -3,7 +3,7 @@ on:
pull_request:
# Run on push, but only if PHP files have changed
push:
- branches: [ main, develop ]
+ branches: [ main, develop, feature/pre-new-admin ]
paths:
- '**.php'
- 'composer.json'
@@ -36,7 +36,7 @@ jobs:
${{ runner.os }}-composer-
- name: Install Composer dependencies
- run: COMPOSER_ROOT_VERSION=dev-develop composer install --no-interaction --prefer-dist
+ run: COMPOSER_ROOT_VERSION=dev-feature/pre-new-admin composer install --no-interaction --prefer-dist
- name: Run PHPStan
run: composer analyse
diff --git a/.phpstan/config.neon b/.phpstan/config.neon
index 0761360..72705b8 100644
--- a/.phpstan/config.neon
+++ b/.phpstan/config.neon
@@ -1,6 +1,7 @@
parameters:
level: 10
paths:
+ - ../admin/controllers
- ../src
- ../tests
bootstrapFiles:
@@ -9,4 +10,4 @@ parameters:
- ../vendor/nails/common/helpers/url.php
- ../vendor/nails/common/src/Common/CodeIgniter/Core/Common.php
- ../vendor/nails/module-auth/helpers/user.php
- - ../vendor/nails/module-admin/helpers/permission.php
+ - ../vendor/nails/module-admin/src/Controller/Base.php
diff --git a/src/Admin/Controller/FindReplace.php b/admin/controllers/FindReplace.php
similarity index 90%
rename from src/Admin/Controller/FindReplace.php
rename to admin/controllers/FindReplace.php
index 3afbb5e..6e1a067 100644
--- a/src/Admin/Controller/FindReplace.php
+++ b/admin/controllers/FindReplace.php
@@ -1,16 +1,18 @@
+ */
+ public $data;
+
+ /**
+ * @return Nav|array