Skip to content

Ett 1328 smarty4to5 migration#129

Draft
liseli wants to merge 2 commits intomainfrom
ETT-1328_Smarty4to5_migration
Draft

Ett 1328 smarty4to5 migration#129
liseli wants to merge 2 commits intomainfrom
ETT-1328_Smarty4to5_migration

Conversation

@liseli
Copy link
Contributor

@liseli liseli commented Mar 2, 2026

This PR focuses on migrating the Catalog template from Smarty 4 to Smarty 5.

  • Changing composer.json to require Smarty": "^5.0"
  • Adopting the new namespace/class in Interface.php, Volume.php, SmartyTemplateTest.php
  • Creating a function to register the legacy plugging.
  • Removing @var_dump inside the templates. It is used inside the template for debugging purposes
  • Solving PHP deprecated issues
  • Registering @json_encode and @count as modifiers.

As part of this PR, I've updated the template documentation

@aelkiss
Copy link
Member

aelkiss commented Mar 2, 2026

@liseli Let's set this to draft since we won't be able to deploy it until production is all php 8. I would expect that will be in the next few weeks, so we shouldn't have to sit on this a very long time.

@liseli liseli marked this pull request as draft March 2, 2026 21:50
@liseli
Copy link
Contributor Author

liseli commented Mar 2, 2026

@liseli Let's set this to draft since we won't be able to deploy it until production is all php 8. I would expect that will be in the next few weeks, so we shouldn't have to sit on this a very long time.

It is done!

@liseli liseli requested review from aelkiss and moseshll March 3, 2026 16:18
Copy link
Contributor

@moseshll moseshll left a comment

Choose a reason for hiding this comment

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

Everything looks as I would expect, and I had no issues running this locally.

There is one thing that I have been finding helpful, that may make sense to do here, is quiet down the overly chatty nginx rewrite messages that show up in the log. Each request results in a page of "did not match" messages for each line in the rewrite rules. We rarely need to debug these, so I do not think they are helpful to enable by default. This is what I changed in docker/nginx-default.conf:

  • rewrite_log on; -> rewrite_log off;
  • error_log /dev/stdout debug; -> error_log /dev/stdout notice;

... and restart nginx service, see if navigating the site produces less "junk" in the log.

This is just a casual recommendation!

APPROVE

Copy link
Member

@aelkiss aelkiss left a comment

Choose a reason for hiding this comment

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

Generally this all looks good and works as I expect locally in development. A couple things to consider mentioned in the comments.

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<title>{$doc.titles[0]} (OCLC {', '|implode:$doc.oclcs })</title>
<title>{$doc.titles[0]} (OCLC {$doc.oclcs|join:', '})</title>
Copy link
Member

Choose a reason for hiding this comment

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

This line gives a complaint about empty array if nothing matches (i.e. $doc.titles is empty). Not a new issue but probably worth fixing.

return;
}

foreach (glob(rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*.php') as $file) {
Copy link
Member

Choose a reason for hiding this comment

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

Might be worth specifically enumerating what we're actually using rather than using the glob here, especially as it's not terribly likely to change in the future

@aelkiss
Copy link
Member

aelkiss commented Mar 4, 2026

re: turning off nginx rewrite rule debugging - agreed, this might have been an accidental commit at some point.

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