From 20acf717be403c6386dfa5c3a0dfbaf4fcc189e0 Mon Sep 17 00:00:00 2001 From: Neal Date: Fri, 23 Jan 2026 05:46:58 -0500 Subject: [PATCH 1/8] PHP_CodeSniffer automatic changes. --- app/config/config.php | 10 ++- app/controllers/component.php | 1 + app/controllers/findingaid.php | 25 +++----- app/controllers/home.php | 1 + app/controllers/overview.php | 1 + app/core/application.php | 19 +++--- app/core/brevity.php | 6 +- app/core/controller.php | 1 + app/core/minter.php | 1 + app/core/model.php | 7 +- app/core/render.php | 6 +- app/init.php | 4 +- app/models/component_model.php | 110 +++++++++++++++----------------- app/models/findingaid_model.php | 7 +- app/models/overview_model.php | 4 +- 15 files changed, 93 insertions(+), 110 deletions(-) diff --git a/app/config/config.php b/app/config/config.php index cd3f6dc..e5dde7c 100644 --- a/app/config/config.php +++ b/app/config/config.php @@ -1,4 +1,5 @@ config)) { return $this->config[$key]; - } - else { + } else { return null; } } @@ -39,8 +39,7 @@ public function get_repo($key) { if (array_key_exists($key, $this->repo)) { return $this->repo[$key]; - } - else { + } else { return $this->repo['default']; } } @@ -59,8 +58,7 @@ public function get_nonuk($key) } if (array_key_exists($key, $this->nonuk)) { return $this->nonuk[$key]; - } - else { + } else { return false; } } diff --git a/app/controllers/component.php b/app/controllers/component.php index 569ccbb..b8f1207 100644 --- a/app/controllers/component.php +++ b/app/controllers/component.php @@ -1,4 +1,5 @@ xpath("//{$entry['field']}"); @@ -107,8 +107,7 @@ public function show() } } } - } - else { + } else { $component_count = count($model->xpath('contents/c')); if ($component_count > 0) { $skip = false; @@ -199,8 +198,7 @@ public function show() } } $url = '/?' . $search_field . '=' . urlencode($raw_search); - } - else { + } else { $data = $model->xpath("//{$link['field']}"); $url = false; foreach ($data as $datum) { @@ -275,8 +273,7 @@ public function show() 'item_url' => '/catalog/' . $model->id() . '/', ] ); - } - else { + } else { $requests = ''; } @@ -331,8 +328,7 @@ public function show() ] ); set_cache($id, $page); - } - else { + } else { $layout = new Mustache_Engine([ 'partials_loader' => new Mustache_Loader_FilesystemLoader( implode( @@ -366,8 +362,7 @@ public function show() 'repository' => $meta['repository'], ] ); - } - else { + } else { $page = $layout->render( load_template('layouts/suggest_former_kdl'), [ @@ -377,8 +372,7 @@ public function show() ] ); } - } - else { + } else { # This is probably a deleted ExploreUK finding aid header("Location: /"); die(); @@ -436,8 +430,7 @@ public function render_component($renderer, $component_xml) 'body_id' => $body_id, ] ); - } - else { + } else { error_log("FA: attributes_id not set"); } return [ diff --git a/app/controllers/home.php b/app/controllers/home.php index 23cf688..e3ead46 100644 --- a/app/controllers/home.php +++ b/app/controllers/home.php @@ -1,4 +1,5 @@ url_params['suggest'] = 1; -} + if (isset($_GET['suggest']) and $_GET['suggest'] == 1) { + $this->url_params['suggest'] = 1; + } if (isset($_GET['invalidate_cache']) and $_GET['invalidate_cache'] == 1) { $this->url_params['invalidate_cache'] = 1; } if (preg_match('/^([0-9a-z]+)_([0-9a-z]+)$/', $this->url_params['id'], $matches)) { $this->url_controller = 'component'; - } - else { + } else { $this->url_controller = 'findingaid'; } if (isset($_GET['overview']) and $_GET['overview'] == 1) { $this->url_controller = 'overview'; } - } - else { + } else { $this->url_controller = 'home'; } - } - else { + } else { $this->url_controller = 'home'; } } diff --git a/app/core/brevity.php b/app/core/brevity.php index f314e74..1b714c5 100644 --- a/app/core/brevity.php +++ b/app/core/brevity.php @@ -16,16 +16,14 @@ function fa_brevity($message, $length = 0) if (($current_length == 0) || $current_length + strlen($word) <= $length) { $target_words[] = $word; $current_length += strlen($word); - } - else { + } else { break; } } $count = count($target_words); if ($count == 0) { $message = '…'; - } - else { + } else { $terminal = $target_words[$count - 1]; if (preg_match('/^\W+$/', $terminal)) { array_pop($target_words); diff --git a/app/core/controller.php b/app/core/controller.php index 75c2847..0e134e5 100644 --- a/app/core/controller.php +++ b/app/core/controller.php @@ -1,4 +1,5 @@ id; while (strlen($tree) >= 2) { - $prefix = substr($tree, 0, 2); - $tree = substr($tree, 2); - $array[] = $prefix; + $prefix = substr($tree, 0, 2); + $tree = substr($tree, 2); + $array[] = $prefix; } $array[] = $this->id; return implode(DIRECTORY_SEPARATOR, $array); diff --git a/app/core/render.php b/app/core/render.php index 697ffd3..a775231 100644 --- a/app/core/render.php +++ b/app/core/render.php @@ -35,11 +35,9 @@ function fa_render_extref($node) $render = ''; if ($node->hasAttribute('href')) { $render = fa_render_extref_ns($node, ""); - } - else if ($node->hasAttribute('xlink:href')) { + } elseif ($node->hasAttribute('xlink:href')) { $render = fa_render_extref_ns($node, "xlink"); - } - else { + } else { $render = $node->textContent; } return $render; diff --git a/app/init.php b/app/init.php index dc5fa42..363c49e 100644 --- a/app/init.php +++ b/app/init.php @@ -1,4 +1,5 @@ config = $g_config; $component_file = $this->ppath() . DIRECTORY_SEPARATOR . $this->basename; if (file_exists($component_file)) { - $this->xml = new SimpleXMLElement(file_get_contents($component_file)); + $this->xml = new SimpleXMLElement(file_get_contents($component_file)); } $this->links = $this->links(); $contents_config = $this->config->get('contents'); @@ -51,49 +52,47 @@ public function links() foreach ($link_raw['links'] as $use => $href) { $use = str_replace(' ', '_', $use); switch ($use) { - case 'thumbnail': - $thumb_count++; - if ($thumb_count <= $image_threshold) { - $field = 'image'; - } - else { - $field = 'image_overflow'; - } - if (empty($link[$field])) { - $link[$field] = []; - } - $link[$field]['thumb'] = $href; - break; - case 'reference_image': - $ref_count++; - if ($ref_count <= $image_threshold) { - $field = 'image'; - } - else { - $field = 'image_overflow'; - } - if (empty($link[$field])) { - $link[$field] = []; - } - $link[$field]['full'] = $href; - $link[$field]['href_id'] = $g_minter->mint(); - break; - case 'reference_audio': - if (empty($link['audio'])) { - $link['audio'] = []; - } - $link['audio']['href'] = $href; - $link['audio']['href_id'] = $g_minter->mint(); - break; - case 'reference_video': - if (empty($link['video'])) { - $link['video'] = []; - } - $link['video']['href'] = $href; - $link['video']['href_id'] = $g_minter->mint(); - break; - default: - break; + case 'thumbnail': + $thumb_count++; + if ($thumb_count <= $image_threshold) { + $field = 'image'; + } else { + $field = 'image_overflow'; + } + if (empty($link[$field])) { + $link[$field] = []; + } + $link[$field]['thumb'] = $href; + break; + case 'reference_image': + $ref_count++; + if ($ref_count <= $image_threshold) { + $field = 'image'; + } else { + $field = 'image_overflow'; + } + if (empty($link[$field])) { + $link[$field] = []; + } + $link[$field]['full'] = $href; + $link[$field]['href_id'] = $g_minter->mint(); + break; + case 'reference_audio': + if (empty($link['audio'])) { + $link['audio'] = []; + } + $link['audio']['href'] = $href; + $link['audio']['href_id'] = $g_minter->mint(); + break; + case 'reference_video': + if (empty($link['video'])) { + $link['video'] = []; + } + $link['video']['href'] = $href; + $link['video']['href_id'] = $g_minter->mint(); + break; + default: + break; } } $links[] = $link; @@ -113,8 +112,7 @@ public function title() $this->xpath('did/unittitle'), $this->xpath('did/unitdate') ); - } - else { + } else { $pieces = array_merge($pieces, $this->xpath('did/unittitle')); } $segments = []; @@ -148,8 +146,7 @@ public function container_lists() if (isset($attributes['id'])) { $id = trim($attributes['id']); - } - else { + } else { $id = md5((string) $container->asXML()); } $aspect['id'] = $id; @@ -159,8 +156,7 @@ public function container_lists() $ancestor = $section_id_for[$pid]; $section_id_for[$id] = $ancestor; $section[$ancestor][] = $aspect; - } - else { + } else { $section_id_for[$id] = $id; $section[$id] = [$aspect]; $section_ids[] = $id; @@ -194,7 +190,7 @@ public function container_lists() } $volume = $container_list_pieces[0]; $summary = implode(', ', $container_list_pieces); - $full_container_list = fa_brevity($summary . ': '. $this->title(), FA_AEON_MAX); + $full_container_list = fa_brevity($summary . ': ' . $this->title(), FA_AEON_MAX); array_shift($container_list_pieces); $rest = implode(', ', $container_list_pieces); $container_list = [ @@ -281,19 +277,15 @@ private function container_type($attributes) if ($type === 'othertype') { if (isset($attributes['label'])) { return trim($attributes['label']); - } - else { + } else { return 'container'; } - } - else { + } else { return $type; } - } - else if (isset($attributes['label'])) { + } elseif (isset($attributes['label'])) { return trim($attributes['label']); - } - else { + } else { return 'container'; } } diff --git a/app/models/findingaid_model.php b/app/models/findingaid_model.php index ab6c573..c4ee884 100644 --- a/app/models/findingaid_model.php +++ b/app/models/findingaid_model.php @@ -1,4 +1,5 @@ 0) { $repository = $repositories[0]; return trim(dom_import_simplexml($repository)->textContent); - } - else { + } else { return 'Unknown repository'; } } @@ -50,8 +50,7 @@ public function unitid() $unitid = $this->metadata('//archdesc/did/unitid'); if (count($unitid) > 0) { $unitid = $unitid[0]; - } - else { + } else { return "no unitid"; } return $unitid; diff --git a/app/models/overview_model.php b/app/models/overview_model.php index 4bb4658..80a20ee 100644 --- a/app/models/overview_model.php +++ b/app/models/overview_model.php @@ -1,4 +1,5 @@ xml->collection_overview->scopecontent->p as $p) { $result[] = ['text' => $p]; From 333899affdb4aeef8c9c0d2ea2794f3fc0477334 Mon Sep 17 00:00:00 2001 From: Neal Date: Fri, 23 Jan 2026 05:49:30 -0500 Subject: [PATCH 2/8] remove todo and allow linting to fail ci. Fixes #12 --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bf36c4..50fe92b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,9 +29,6 @@ jobs: lint: needs: build runs-on: ubuntu-latest - # TODO: Fix the linting errors - # Report the failure, but don't stop the job - continue-on-error: true env: COMPOSE_FILE: docker-compose.yml:docker-compose.ci.override.yml COMPOSE_PROJECT_NAME: ci-${{ github.job }}-${{ github.run_id }} From 5a47b51c4e57c2a60813d9820b3078d8e44d33b3 Mon Sep 17 00:00:00 2001 From: Neal Date: Fri, 23 Jan 2026 08:34:33 -0500 Subject: [PATCH 3/8] test that classes load properly --- tests/SmokeTest.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/SmokeTest.php diff --git a/tests/SmokeTest.php b/tests/SmokeTest.php new file mode 100644 index 0000000..2a84835 --- /dev/null +++ b/tests/SmokeTest.php @@ -0,0 +1,28 @@ +get('panels'); + + $this->assertIsArray($panels); + } + + public function testModelsLoadable(): void + { + $this->assertTrue(class_exists('FindingaidModel')); + $this->assertTrue(class_exists('ComponentModel')); + $this->assertTrue(class_exists('OverviewModel')); + } + + public function testBrevityFunction(): void + { + $this->assertSame('Hello world', fa_brevity('Hello world', 100)); + $this->assertSame('Hello…', fa_brevity('Hello world', 1)); + } +} From 8ab884ecba85abd54d447be931be54d0ce2da369 Mon Sep 17 00:00:00 2001 From: Neal Date: Fri, 23 Jan 2026 08:39:20 -0500 Subject: [PATCH 4/8] fix smoketest not pointing at init.php --- tests/SmokeTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/SmokeTest.php b/tests/SmokeTest.php index 2a84835..c109f87 100644 --- a/tests/SmokeTest.php +++ b/tests/SmokeTest.php @@ -1,7 +1,7 @@ Date: Tue, 21 Apr 2026 15:43:55 -0400 Subject: [PATCH 5/8] Restucturing/renaming for autoloading. Namespace additions. Extract bootstrap helpers. Symlink renaming. Tests now point to app entry instead of autoloader. --- .../css/bootstrap-theme.css | 0 .../css/bootstrap-theme.css.map | 0 .../css/bootstrap-theme.min.css | 0 app/{assets => Assets}/css/bootstrap.css | 0 app/{assets => Assets}/css/bootstrap.css.map | 0 app/{assets => Assets}/css/bootstrap.min.css | 0 app/{assets => Assets}/css/controls.png | Bin app/{assets => Assets}/css/controls.svg | 0 app/{assets => Assets}/css/extra.css | 0 app/{assets => Assets}/css/footer.css | 0 app/{assets => Assets}/css/images | 0 app/{assets => Assets}/css/jquery-ui.min.css | 0 app/{assets => Assets}/css/lity.min.css | 0 .../css/mediaelementplayer.min.css | 0 app/{assets => Assets}/js/bootstrap.min.js | 0 app/{assets => Assets}/js/jquery-ui.min.js | 0 app/{assets => Assets}/js/jquery.min.js | 0 app/{assets => Assets}/js/jquery.unveil.js | 0 app/{assets => Assets}/js/lity.min.js | 0 app/{assets => Assets}/js/manifest.txt | 0 .../js/mediaelementplayer.min.js | 0 app/{assets => Assets}/js/mousetrap.min.js | 0 app/{assets => Assets}/js/requests.js | 0 app/{assets => Assets}/js/reveal.js | 0 app/{assets => Assets}/js/ui.js | 0 app/{config/config.php => Config/Config.php} | 12 +- app/{config => Config}/config.json | 0 app/{config => Config}/nonuk-metadata.json | 0 app/{config => Config}/repo.json | 0 .../Component.php} | 17 ++- .../Findingaid.php} | 46 +++++--- app/Controllers/Home.php | 15 +++ .../overview.php => Controllers/Overview.php} | 13 +- .../application.php => Core/Application.php} | 15 ++- app/{core/brevity.php => Core/Brevity.php} | 0 .../controller.php => Core/Controller.php} | 2 + app/{core/minter.php => Core/Minter.php} | 2 + app/{core/model.php => Core/Model.php} | 2 + app/{core/render.php => Core/Render.php} | 0 .../Component.php} | 29 +++-- .../Findingaid.php} | 7 +- .../Overview.php} | 7 +- .../Findingaid}/advance_note.mustache | 0 .../Findingaid}/component.mustache | 0 .../Findingaid}/container_list.mustache | 0 .../harmful_language_statement.mustache | 0 .../Findingaid}/image_controls.mustache | 0 .../Findingaid}/media.mustache | 0 .../Findingaid}/panel.mustache | 0 .../Findingaid}/requests.mustache | 0 .../Findingaid}/show.mustache | 0 .../Findingaid}/toc.mustache | 0 app/{views/home => Views/Home}/index.mustache | 0 .../Layouts}/application.mustache | 0 .../layouts => Views/Layouts}/footer.mustache | 0 .../Layouts}/maintenance_notice.mustache | 0 .../layouts => Views/Layouts}/nav.mustache | 0 .../Layouts}/overview.mustache | 0 .../layouts => Views/Layouts}/repo.mustache | 0 .../layouts => Views/Layouts}/search.mustache | 0 .../Layouts}/suggest_former_kdl.mustache | 0 .../Layouts}/suggest_kdl.mustache | 0 .../layouts => Views/Layouts}/viewer.mustache | 0 app/controllers/home.php | 10 -- app/init.php | 111 +----------------- app/init_helpers.php | 97 +++++++++++++++ composer.json | 10 ++ docker-compose.dev.override.yml | 4 +- exe/build.sh | 2 +- phpunit.xml | 2 +- public/css | 2 +- public/index.php | 3 + tests/MinterTest.php | 5 +- tests/SmokeTest.php | 14 ++- 74 files changed, 249 insertions(+), 178 deletions(-) rename app/{assets => Assets}/css/bootstrap-theme.css (100%) rename app/{assets => Assets}/css/bootstrap-theme.css.map (100%) rename app/{assets => Assets}/css/bootstrap-theme.min.css (100%) rename app/{assets => Assets}/css/bootstrap.css (100%) rename app/{assets => Assets}/css/bootstrap.css.map (100%) rename app/{assets => Assets}/css/bootstrap.min.css (100%) rename app/{assets => Assets}/css/controls.png (100%) rename app/{assets => Assets}/css/controls.svg (100%) rename app/{assets => Assets}/css/extra.css (100%) rename app/{assets => Assets}/css/footer.css (100%) rename app/{assets => Assets}/css/images (100%) rename app/{assets => Assets}/css/jquery-ui.min.css (100%) rename app/{assets => Assets}/css/lity.min.css (100%) rename app/{assets => Assets}/css/mediaelementplayer.min.css (100%) rename app/{assets => Assets}/js/bootstrap.min.js (100%) rename app/{assets => Assets}/js/jquery-ui.min.js (100%) rename app/{assets => Assets}/js/jquery.min.js (100%) rename app/{assets => Assets}/js/jquery.unveil.js (100%) rename app/{assets => Assets}/js/lity.min.js (100%) rename app/{assets => Assets}/js/manifest.txt (100%) rename app/{assets => Assets}/js/mediaelementplayer.min.js (100%) rename app/{assets => Assets}/js/mousetrap.min.js (100%) rename app/{assets => Assets}/js/requests.js (100%) rename app/{assets => Assets}/js/reveal.js (100%) rename app/{assets => Assets}/js/ui.js (100%) rename app/{config/config.php => Config/Config.php} (90%) rename app/{config => Config}/config.json (100%) rename app/{config => Config}/nonuk-metadata.json (100%) rename app/{config => Config}/repo.json (100%) rename app/{controllers/component.php => Controllers/Component.php} (87%) rename app/{controllers/findingaid.php => Controllers/Findingaid.php} (93%) create mode 100644 app/Controllers/Home.php rename app/{controllers/overview.php => Controllers/Overview.php} (87%) rename app/{core/application.php => Core/Application.php} (81%) rename app/{core/brevity.php => Core/Brevity.php} (100%) rename app/{core/controller.php => Core/Controller.php} (89%) rename app/{core/minter.php => Core/Minter.php} (92%) rename app/{core/model.php => Core/Model.php} (96%) rename app/{core/render.php => Core/Render.php} (100%) rename app/{models/component_model.php => Models/Component.php} (91%) rename app/{models/findingaid_model.php => Models/Findingaid.php} (95%) rename app/{models/overview_model.php => Models/Overview.php} (91%) rename app/{views/findingaid => Views/Findingaid}/advance_note.mustache (100%) rename app/{views/findingaid => Views/Findingaid}/component.mustache (100%) rename app/{views/findingaid => Views/Findingaid}/container_list.mustache (100%) rename app/{views/findingaid => Views/Findingaid}/harmful_language_statement.mustache (100%) rename app/{views/findingaid => Views/Findingaid}/image_controls.mustache (100%) rename app/{views/findingaid => Views/Findingaid}/media.mustache (100%) rename app/{views/findingaid => Views/Findingaid}/panel.mustache (100%) rename app/{views/findingaid => Views/Findingaid}/requests.mustache (100%) rename app/{views/findingaid => Views/Findingaid}/show.mustache (100%) rename app/{views/findingaid => Views/Findingaid}/toc.mustache (100%) rename app/{views/home => Views/Home}/index.mustache (100%) rename app/{views/layouts => Views/Layouts}/application.mustache (100%) rename app/{views/layouts => Views/Layouts}/footer.mustache (100%) rename app/{views/layouts => Views/Layouts}/maintenance_notice.mustache (100%) rename app/{views/layouts => Views/Layouts}/nav.mustache (100%) rename app/{views/layouts => Views/Layouts}/overview.mustache (100%) rename app/{views/layouts => Views/Layouts}/repo.mustache (100%) rename app/{views/layouts => Views/Layouts}/search.mustache (100%) rename app/{views/layouts => Views/Layouts}/suggest_former_kdl.mustache (100%) rename app/{views/layouts => Views/Layouts}/suggest_kdl.mustache (100%) rename app/{views/layouts => Views/Layouts}/viewer.mustache (100%) delete mode 100644 app/controllers/home.php create mode 100644 app/init_helpers.php diff --git a/app/assets/css/bootstrap-theme.css b/app/Assets/css/bootstrap-theme.css similarity index 100% rename from app/assets/css/bootstrap-theme.css rename to app/Assets/css/bootstrap-theme.css diff --git a/app/assets/css/bootstrap-theme.css.map b/app/Assets/css/bootstrap-theme.css.map similarity index 100% rename from app/assets/css/bootstrap-theme.css.map rename to app/Assets/css/bootstrap-theme.css.map diff --git a/app/assets/css/bootstrap-theme.min.css b/app/Assets/css/bootstrap-theme.min.css similarity index 100% rename from app/assets/css/bootstrap-theme.min.css rename to app/Assets/css/bootstrap-theme.min.css diff --git a/app/assets/css/bootstrap.css b/app/Assets/css/bootstrap.css similarity index 100% rename from app/assets/css/bootstrap.css rename to app/Assets/css/bootstrap.css diff --git a/app/assets/css/bootstrap.css.map b/app/Assets/css/bootstrap.css.map similarity index 100% rename from app/assets/css/bootstrap.css.map rename to app/Assets/css/bootstrap.css.map diff --git a/app/assets/css/bootstrap.min.css b/app/Assets/css/bootstrap.min.css similarity index 100% rename from app/assets/css/bootstrap.min.css rename to app/Assets/css/bootstrap.min.css diff --git a/app/assets/css/controls.png b/app/Assets/css/controls.png similarity index 100% rename from app/assets/css/controls.png rename to app/Assets/css/controls.png diff --git a/app/assets/css/controls.svg b/app/Assets/css/controls.svg similarity index 100% rename from app/assets/css/controls.svg rename to app/Assets/css/controls.svg diff --git a/app/assets/css/extra.css b/app/Assets/css/extra.css similarity index 100% rename from app/assets/css/extra.css rename to app/Assets/css/extra.css diff --git a/app/assets/css/footer.css b/app/Assets/css/footer.css similarity index 100% rename from app/assets/css/footer.css rename to app/Assets/css/footer.css diff --git a/app/assets/css/images b/app/Assets/css/images similarity index 100% rename from app/assets/css/images rename to app/Assets/css/images diff --git a/app/assets/css/jquery-ui.min.css b/app/Assets/css/jquery-ui.min.css similarity index 100% rename from app/assets/css/jquery-ui.min.css rename to app/Assets/css/jquery-ui.min.css diff --git a/app/assets/css/lity.min.css b/app/Assets/css/lity.min.css similarity index 100% rename from app/assets/css/lity.min.css rename to app/Assets/css/lity.min.css diff --git a/app/assets/css/mediaelementplayer.min.css b/app/Assets/css/mediaelementplayer.min.css similarity index 100% rename from app/assets/css/mediaelementplayer.min.css rename to app/Assets/css/mediaelementplayer.min.css diff --git a/app/assets/js/bootstrap.min.js b/app/Assets/js/bootstrap.min.js similarity index 100% rename from app/assets/js/bootstrap.min.js rename to app/Assets/js/bootstrap.min.js diff --git a/app/assets/js/jquery-ui.min.js b/app/Assets/js/jquery-ui.min.js similarity index 100% rename from app/assets/js/jquery-ui.min.js rename to app/Assets/js/jquery-ui.min.js diff --git a/app/assets/js/jquery.min.js b/app/Assets/js/jquery.min.js similarity index 100% rename from app/assets/js/jquery.min.js rename to app/Assets/js/jquery.min.js diff --git a/app/assets/js/jquery.unveil.js b/app/Assets/js/jquery.unveil.js similarity index 100% rename from app/assets/js/jquery.unveil.js rename to app/Assets/js/jquery.unveil.js diff --git a/app/assets/js/lity.min.js b/app/Assets/js/lity.min.js similarity index 100% rename from app/assets/js/lity.min.js rename to app/Assets/js/lity.min.js diff --git a/app/assets/js/manifest.txt b/app/Assets/js/manifest.txt similarity index 100% rename from app/assets/js/manifest.txt rename to app/Assets/js/manifest.txt diff --git a/app/assets/js/mediaelementplayer.min.js b/app/Assets/js/mediaelementplayer.min.js similarity index 100% rename from app/assets/js/mediaelementplayer.min.js rename to app/Assets/js/mediaelementplayer.min.js diff --git a/app/assets/js/mousetrap.min.js b/app/Assets/js/mousetrap.min.js similarity index 100% rename from app/assets/js/mousetrap.min.js rename to app/Assets/js/mousetrap.min.js diff --git a/app/assets/js/requests.js b/app/Assets/js/requests.js similarity index 100% rename from app/assets/js/requests.js rename to app/Assets/js/requests.js diff --git a/app/assets/js/reveal.js b/app/Assets/js/reveal.js similarity index 100% rename from app/assets/js/reveal.js rename to app/Assets/js/reveal.js diff --git a/app/assets/js/ui.js b/app/Assets/js/ui.js similarity index 100% rename from app/assets/js/ui.js rename to app/Assets/js/ui.js diff --git a/app/config/config.php b/app/Config/Config.php similarity index 90% rename from app/config/config.php rename to app/Config/Config.php index e5dde7c..013163f 100644 --- a/app/config/config.php +++ b/app/Config/Config.php @@ -1,5 +1,7 @@ repo)) { return $this->repo[$key]; @@ -44,12 +46,12 @@ public function get_repo($key) } } - public function get_nonuk($key) + public function getNonUK($key) { if (!isset($this->nonuk)) { $nonuk_config_file = implode(DIRECTORY_SEPARATOR, [ APP, - 'config', + 'Config', 'nonuk-metadata.json', ]); if (file_exists($nonuk_config_file)) { diff --git a/app/config/config.json b/app/Config/config.json similarity index 100% rename from app/config/config.json rename to app/Config/config.json diff --git a/app/config/nonuk-metadata.json b/app/Config/nonuk-metadata.json similarity index 100% rename from app/config/nonuk-metadata.json rename to app/Config/nonuk-metadata.json diff --git a/app/config/repo.json b/app/Config/repo.json similarity index 100% rename from app/config/repo.json rename to app/Config/repo.json diff --git a/app/controllers/component.php b/app/Controllers/Component.php similarity index 87% rename from app/controllers/component.php rename to app/Controllers/Component.php index b8f1207..b8e6d9e 100644 --- a/app/controllers/component.php +++ b/app/Controllers/Component.php @@ -1,5 +1,12 @@ container_lists() as $container_list) { + foreach ($model->containerLists() as $container_list) { $container_list_content = $m->render( $container_list_template, $container_list diff --git a/app/controllers/findingaid.php b/app/Controllers/Findingaid.php similarity index 93% rename from app/controllers/findingaid.php rename to app/Controllers/Findingaid.php index 96cd991..a919053 100644 --- a/app/controllers/findingaid.php +++ b/app/Controllers/Findingaid.php @@ -1,5 +1,13 @@ templates[$template] = load_template("findingaid/$template"); + $this->templates[$template] = load_template("Findingaid/$template"); } foreach ($model->xpath('contents/c') as $c) { - $details = $this->render_component($m, $c); + $details = $this->renderComponent($m, $c); $panel['components'][] = [ 'component' => $details[0], ]; @@ -249,19 +257,19 @@ public function show() ]; $toc = $m->render( - load_template('findingaid/toc'), + load_template('Findingaid/toc'), $toc_options ); $content = $m->render( - load_template('findingaid/show'), + load_template('Findingaid/show'), $options ); if ($requestable) { $requests_config = $this->config->get('requests'); $requests = $m->render( - load_template('findingaid/requests'), + load_template('Findingaid/requests'), [ 'id' => $requests_config['summary']['id'], 'label' => fa_brevity($requests_config['summary']['label']), @@ -297,14 +305,14 @@ public function show() DIRECTORY_SEPARATOR, [ APP, - 'views', - 'layouts', + 'Views', + 'Layouts', ] ) ), ]); $page = $layout->render( - load_template('layouts/application'), + load_template('Layouts/application'), [ 'content' => $content, 'toc' => $toc, @@ -324,7 +332,7 @@ public function show() ]], 'title' => $model->title(), 'requestable' => $requestable, - 'repository' => $this->config->get_repo($repository), + 'repository' => $this->config->getRepo($repository), ] ); set_cache($id, $page); @@ -335,13 +343,13 @@ public function show() DIRECTORY_SEPARATOR, [ APP, - 'views', - 'layouts', + 'Views', + 'Layouts', ] ) ), ]); - $meta = $this->config->get_nonuk($id); + $meta = $this->config->getNonUK($id); if ($meta) { $repo = $meta['repository']; $former_kdl_partners = $this->config->get('partners'); @@ -356,7 +364,7 @@ public function show() if ($is_kdl_partner) { $page = $layout->render( - load_template('layouts/suggest_kdl'), + load_template('Layouts/suggest_kdl'), [ 'title' => $meta['title'], 'repository' => $meta['repository'], @@ -364,7 +372,7 @@ public function show() ); } else { $page = $layout->render( - load_template('layouts/suggest_former_kdl'), + load_template('Layouts/suggest_former_kdl'), [ 'title' => $meta['title'], 'repository' => $meta['repository'], @@ -385,7 +393,7 @@ public function show() echo $page; } - public function render_component($renderer, $component_xml) + public function renderComponent($renderer, $component_xml) { $component_content = ''; $attributes = $component_xml->attributes(); @@ -395,14 +403,14 @@ public function render_component($renderer, $component_xml) $component = new ComponentModel($this->params['id'], $attributes['id']); $subcomponent_content = []; foreach ($component->subcomponents() as $subcomponent) { - $subcomponent_details = $this->render_component($renderer, $subcomponent->xml()); + $subcomponent_details = $this->renderComponent($renderer, $subcomponent->xml()); $subcomponent_content[] = [ 'subcomponent' => $subcomponent_details[0], ]; } $container_lists = []; - foreach ($component->container_lists() as $container_list) { + foreach ($component->containerLists() as $container_list) { $container_list_content = $renderer->render( $this->templates['container_list'], $container_list diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php new file mode 100644 index 0000000..4d5e0c5 --- /dev/null +++ b/app/Controllers/Home.php @@ -0,0 +1,15 @@ +render(load_template('Home/index')); + } +} diff --git a/app/controllers/overview.php b/app/Controllers/Overview.php similarity index 87% rename from app/controllers/overview.php rename to app/Controllers/Overview.php index 09ad7b6..6662487 100644 --- a/app/controllers/overview.php +++ b/app/Controllers/Overview.php @@ -1,5 +1,12 @@ render( - load_template('layouts/overview'), + load_template('Layouts/overview'), [ 'title' => $model->title(), 'bioghist' => $model->bioghist(), diff --git a/app/core/application.php b/app/Core/Application.php similarity index 81% rename from app/core/application.php rename to app/Core/Application.php index 4a8964e..a8e56f7 100644 --- a/app/core/application.php +++ b/app/Core/Application.php @@ -1,17 +1,26 @@ \App\Controllers\Home::class, + 'findingaid' => \App\Controllers\Findingaid::class, + 'component' => \App\Controllers\Component::class, + 'overview' => \App\Controllers\Overview::class + ]; public function __construct() { $this->splitUrl(); - load_path(APP, 'controllers/' . $this->url_controller); - $this->url_controller = new $this->url_controller($this->url_params); - $this->url_controller->show(); + $route = $this->url_controller; + $controllerClass = $this->controllers[$route]; + $controller = new $controllerClass($this->url_params); + $controller->show(); } private function splitUrl() diff --git a/app/core/brevity.php b/app/Core/Brevity.php similarity index 100% rename from app/core/brevity.php rename to app/Core/Brevity.php diff --git a/app/core/controller.php b/app/Core/Controller.php similarity index 89% rename from app/core/controller.php rename to app/Core/Controller.php index 0e134e5..4373916 100644 --- a/app/core/controller.php +++ b/app/Core/Controller.php @@ -1,5 +1,7 @@ xpath($contents_config['component']) as $c) { $cattrs = $c->attributes(); $cid = $cattrs['id']; - $this->subcomponents[] = new ComponentModel($this->id, $cid); + $this->subcomponents[] = new Component($this->id, $cid); } } @@ -122,7 +127,7 @@ public function title() return implode(', ', $segments); } - public function container_lists() + public function containerLists() { $container_lists = []; $order = []; @@ -140,7 +145,7 @@ public function container_lists() foreach ($this->xpath($contents_config['container']) as $container) { $attributes = $container->attributes(); $aspect = [ - 'type' => $this->container_type($attributes), + 'type' => $this->containerType($attributes), 'content' => (string)$container, ]; @@ -212,40 +217,40 @@ public function container_lists() public function bioghistHead() { $contents_config = $this->config->get('contents'); - return $this->render_paragraphs($this->xpath($contents_config['bioghist_head'])); + return $this->renderParagraphs($this->xpath($contents_config['bioghist_head'])); } public function scopecontentHead() { $contents_config = $this->config->get('contents'); - return $this->render_paragraphs($this->xpath($contents_config['scopecontent_head'])); + return $this->renderParagraphs($this->xpath($contents_config['scopecontent_head'])); } public function processinfoHead() { $contents_config = $this->config->get('contents'); - return $this->render_paragraphs($this->xpath($contents_config['processinfo_head'])); + return $this->renderParagraphs($this->xpath($contents_config['processinfo_head'])); } public function bioghist() { $contents_config = $this->config->get('contents'); - return $this->render_paragraphs($this->xpath($contents_config['bioghist'])); + return $this->renderParagraphs($this->xpath($contents_config['bioghist'])); } public function scopecontent() { $contents_config = $this->config->get('contents'); - return $this->render_paragraphs($this->xpath($contents_config['scopecontent'])); + return $this->renderParagraphs($this->xpath($contents_config['scopecontent'])); } public function processinfo() { $contents_config = $this->config->get('contents'); - return $this->render_paragraphs($this->xpath($contents_config['processinfo'])); + return $this->renderParagraphs($this->xpath($contents_config['processinfo'])); } - public function render_paragraphs($p_list) + public function renderParagraphs($p_list) { $render = []; foreach ($p_list as $p) { @@ -270,7 +275,7 @@ public function level() return $attributes['level']; } - private function container_type($attributes) + private function containerType($attributes) { if (isset($attributes['type'])) { $type = trim($attributes['type']); diff --git a/app/models/findingaid_model.php b/app/Models/Findingaid.php similarity index 95% rename from app/models/findingaid_model.php rename to app/Models/Findingaid.php index c4ee884..ec1c1a9 100644 --- a/app/models/findingaid_model.php +++ b/app/Models/Findingaid.php @@ -1,6 +1,11 @@ render(load_template('home/index')); - } -} diff --git a/app/init.php b/app/init.php index 363c49e..b61c985 100644 --- a/app/init.php +++ b/app/init.php @@ -1,113 +1,12 @@ - diff --git a/public/css b/public/css index 475a62d..2019512 120000 --- a/public/css +++ b/public/css @@ -1 +1 @@ -../app/assets/css \ No newline at end of file +../app/Assets/css \ No newline at end of file diff --git a/public/index.php b/public/index.php index 031e120..8b53d36 100644 --- a/public/index.php +++ b/public/index.php @@ -1,4 +1,7 @@ assertTrue(class_exists('FindingaidModel')); - $this->assertTrue(class_exists('ComponentModel')); - $this->assertTrue(class_exists('OverviewModel')); + $this->assertTrue(class_exists('App\Models\Findingaid')); + $this->assertTrue(class_exists('App\Models\Component')); + $this->assertTrue(class_exists('App\Models\Overview')); } public function testBrevityFunction(): void From 2f93305046e2f96735599f9668a3101b278fb260 Mon Sep 17 00:00:00 2001 From: Neal Date: Tue, 21 Apr 2026 15:45:03 -0400 Subject: [PATCH 6/8] add previous memory limit as an ini override --- Dockerfile | 3 +++ php-fpm/99-findingaid.ini | 1 + 2 files changed, 4 insertions(+) create mode 100644 php-fpm/99-findingaid.ini diff --git a/Dockerfile b/Dockerfile index dddc516..180eac4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,7 @@ RUN apk add --no-cache \ COPY --from=composer:2.8 /usr/bin/composer /usr/bin/composer COPY --from=jsmin /usr/bin/jsmin /usr/bin/jsmin RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" +COPY php-fpm/99-findingaid.ini $PHP_INI_DIR/conf.d/ WORKDIR /opt/findingaid @@ -60,6 +61,7 @@ WORKDIR /app COPY --from=jsmin /usr/bin/jsmin /usr/bin/jsmin COPY --from=development /opt/findingaid/vendor /opt/findingaid/vendor +COPY php-fpm/99-findingaid.ini $PHP_INI_DIR/conf.d/ COPY ./phpunit.xml /opt/findingaid/phpunit.xml COPY /app . @@ -82,6 +84,7 @@ RUN apk add --no-cache \ COPY --from=jsmin /usr/bin/jsmin /usr/bin/jsmin COPY --from=prod-builder /composer/vendor /opt/findingaid/vendor RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" +COPY php-fpm/99-findingaid.ini $PHP_INI_DIR/conf.d/ WORKDIR /opt/findingaid diff --git a/php-fpm/99-findingaid.ini b/php-fpm/99-findingaid.ini new file mode 100644 index 0000000..92a5ffd --- /dev/null +++ b/php-fpm/99-findingaid.ini @@ -0,0 +1 @@ +memory_limit = 2048M From 59650947df20d69ae27a0f9a099f0abef2c347ea Mon Sep 17 00:00:00 2001 From: Neal Date: Tue, 21 Apr 2026 15:45:15 -0400 Subject: [PATCH 7/8] add lint-watch --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c4a6a30..94c7032 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ COMPOSE_DEV = docker compose -f docker-compose.yml -f docker-compose.dev.override.yml -.PHONY: help dev build down test lint lint-fix check logs test-watch findingaid-sh web-sh sample +.PHONY: help dev build down test lint lint-fix check logs test-watch lint-watch findingaid-sh web-sh sample help: ## Show this help @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' @@ -33,6 +33,9 @@ logs: ## Tail container logs test-watch: ## Run tests on each file change (requires: watchexec) watchexec -w app -w public -w tests --no-process-group 'make test' +lint-watch: ## Run linter on each file change (requires: watchexec) + watchexec -w app -w tests --no-process-group 'make lint' + sample: ## Download and extract sample finding aid data (~1GB) wget -O xml.tar.gz https://solrindex.uky.edu/fa/findingaid/xml.tar.gz tar zxf xml.tar.gz From e6615067caa037e82b457ed5f22498638f505bc1 Mon Sep 17 00:00:00 2001 From: Neal Date: Tue, 21 Apr 2026 15:45:57 -0400 Subject: [PATCH 8/8] lint fix --- app/init.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/init.php b/app/init.php index b61c985..de3c532 100644 --- a/app/init.php +++ b/app/init.php @@ -1,4 +1,5 @@