Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add PHP 8.2 support to main branch, drop 8.0 support #8264

Merged
merged 5 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/loristest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- static
- unit
- integration
php: ['8.0','8.1']
php: ['8.1','8.2']

steps:
- uses: actions/checkout@v2
Expand Down
261 changes: 133 additions & 128 deletions composer.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ For further details on the install process, please see the LORIS GitHub Wiki Cen
# System Requirements - Install dependencies

Default dependencies installed by CentOS 7.x may not meet the version requirements for LORIS deployment or development:
* MariaDB 10.3 is supported for LORIS 24.
* MariaDB 10.3 is supported for LORIS 25.

* PHP 8.0 (or higher) is supported for LORIS 24.
* PHP 8.1 (or higher) is supported for LORIS 25.

In addition to the above, the following packages should be installed with `yum` and may also differ from the packages referenced in the main (Ubuntu) [LORIS Readme](../../../../../README.md). Detailed command examples are provided below (`sudo` privilege may be required depending on your system).
* Apache 2.4 or higher
Expand All @@ -31,7 +31,9 @@ sudo yum install httpd
sudo systemctl enable httpd
sudo systemctl start httpd
```
## PHP 8.0

## PHP

```bash
sudo yum install epel-release
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
Expand All @@ -41,7 +43,7 @@ sudo yum update
# By default, the repository for PHP 5.4 is enabled
# Make sure to have only one repository for PHP enabled
sudo yum-config-manager --disable remi-php54
sudo yum-config-manager --enable remi-php80
sudo yum-config-manager --enable remi-php82
sudo yum install php php-pdo php-pdo_mysql php-fpm php-gd php-json php-mbstring php-mysqlnd php-xml php-xmlrpc php-opcache
```
## MariaDB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ When you've completed this guide, you should be able to load and log into LORIS

LORIS requires a LAMP stack in order to run, specifically:

* Apache 2.4
* Apache 2.4

* MySQL 5.7 (or MariaDB 10.3) (or higher)
* MySQL 5.7 (or MariaDB 10.3) (or higher)

* PHP 8.0 (or higher)
* PHP 8.1 (or higher)

Additionally, the following package manager are required to build LORIS:

Expand All @@ -36,30 +36,29 @@ The following Ubuntu packages are required and should be installed using

* curl

* zip
* zip

* unzip
* unzip

* php-json
* php-json

* make
* make

* software-properties-common
* software-properties-common

* php8.0-mysql
* php8.2-mysql

* php8.0-xml
* php8.2-xml

* php8.0-mbstring
* php8.2-mbstring

* php8.0-gd
* php8.2-gd

* php8.0-zip
* php8.2-zip

* php8.0-curl (for development instances only)

* libapache2-mod-php8.0
* php8.2-curl (for development instances only)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is now a requirement for prod I think.
Http\Client needs that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It wasn't changed in this PR, just the version.. can you send a PR to fix if that's wrong now?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thinking about it, it would be part of Guzzle dependencies.


* libapache2-mod-php8.2

## Creating the lorisadmin user
Create the _lorisadmin_ user and group and give _lorisadmin_ `sudo` permission.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ class Raw extends Endpoint implements \LORIS\Middleware\ETagCalculator

$callback = function () use ($mincpath, $fullpath) {
return shell_exec(
"${mincpath}/bin/minctoraw -byte -unsigned -normalize $fullpath"
"{$mincpath}/bin/minctoraw -byte -unsigned -normalize $fullpath"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why switch from simple to complex syntax?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure what's simple or complex about ${foo} vs {$foo} but phan was complaining that the former was deprecated and saying the latter should be used instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

For information:

https://www.php.net/manual/en/language.types.string.php

Simple syntax
If a dollar sign ($) is encountered, the parser will greedily take as many tokens as possible to form a valid variable name. Enclose the variable name in curly braces to explicitly specify the end of the name.

Complex (curly) syntax
Any scalar variable, array element or object property with a string representation can be included via this syntax. The expression is written the same way as it would appear outside the string, and then wrapped in { and }. Since { can not be escaped, this syntax will only be recognized when the $ immediately follows the {.

So, both worked in this context but the former is deprecated in 8.2. Probably because it can be achieved with the latter.

);
};

return (new \LORIS\Http\Response())
->withHeader('Content-Type', 'application/x.raw')
->withHeader('Content-Disposition', "attachment; filename=${filename}")
->withHeader('Content-Disposition', "attachment; filename={$filename}")
->withBody(new \Laminas\Diactoros\CallbackStream($callback));
}

Expand Down
2 changes: 1 addition & 1 deletion modules/help_editor/php/edit_help_content.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Edit_Help_Content extends \NDB_Form
$help_file = HelpFile::factory($helpID);
$data = $help_file->toArray();
$defaults['title'] = $data['topic'];
$defaults['content'] = utf8_encode(trim($data['content']));
$defaults['content'] = trim($data['content']);
if (isset($_REQUEST['helpID'])) {
$this->tpl_data['module_name'] = "Help Editor";
} else {
Expand Down
4 changes: 2 additions & 2 deletions php/installer/Database.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class Database
if ($table == '*') {
$table = '\*';
}
$pattern = "/GRANT .*(ALL|${privilege}).* ON" .
" `?([*]|${database})`?[.]`?([*]|${table})`?/";
$pattern = "/GRANT .*(ALL|{$privilege}).* ON" .
" `?([*]|{$database})`?[.]`?([*]|{$table})`?/";

// Test all privileges return from SHOW GRANTS against the pattern
return array_reduce(
Expand Down
4 changes: 3 additions & 1 deletion php/libraries/Module.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ abstract class Module extends \LORIS\Router\PrefixRouter

// Hacks so that existing display() functions load the right template
// for different page types.
$cls->menu = $page;
if (property_exists($cls, 'menu')) {
$cls->menu = $page;
}

return $cls;
}
Expand Down
4 changes: 2 additions & 2 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{ pkgs ? import <nixpkgs> {} }:
let
php = pkgs.php80.withExtensions ({ enabled, all }:
php = pkgs.php82.withExtensions ({ enabled, all }:
enabled ++ [ all.ast ]);
in
pkgs.mkShell {
buildInputs = with pkgs; [ php git nodejs php80Packages.composer ];
buildInputs = with pkgs; [ php git nodejs php82Packages.composer ];
shellHook =
''
php -v;
Expand Down