Skip to content

Commit

Permalink
PHP8, 1.5.8 and related
Browse files Browse the repository at this point in the history
  • Loading branch information
scottcwilson committed May 29, 2022
1 parent 4c66fb4 commit c925025
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 0 deletions.
25 changes: 25 additions & 0 deletions content/dev/languages/158_language_files.md
Expand Up @@ -65,3 +65,28 @@ grep "'[A-Z0-9_]*'[\s]*," *.php | grep -v "=>"

Please see [User information on Array based Language files](/user/localization/158_language_files/).

## Code Conversion

If you need to include a language file, the old style of doing so

```
$langfile = DIR_WS_LANGUAGES . $_SESSION['language'] . "/modules/order_total/" . "ot_group_pricing.php";
include_once ($langfile);
```

will no longer work for 1.5.8 and above. However, plugin authors may want to make their code compatible with both 1.5.7 and 1.5.8. Here's one approach:

```
$filename = "ot_group_pricing.php";
$old_langfile = DIR_WS_LANGUAGES . $_SESSION['language'] . "/modules/order_total/" . $filename;
$new_langfile = DIR_WS_LANGUAGES . $_SESSION['language'] . "/modules/order_total/" . "lang." . $filename;
if (file_exists($old_langfile)) {
include_once ($old_langfile);
} else if (file_exists($new_langfile)) {
global $languageLoader;
$folder = "/modules/order_total/";
$languageLoader->loadExtraLanguageFiles(DIR_FS_CATALOG . DIR_WS_LANGUAGES, $_SESSION['language'], $filename, $folder);
}
```


21 changes: 21 additions & 0 deletions content/dev/plugins/adoption.md
@@ -0,0 +1,21 @@
---
title: Adopting an orphan plugin
description: Stepping forward to take care of an abandoned plugin
category: plugins
weight: 10
---

For a variety of reasons, plugins sometimes get abandoned by their creators.
It could be that the original author has retired, moved on to other work,
or sometimes even passed away.

Community members with development and debugging skills are urged to consider picking up support for plugins that have been abandoned.

## Do's and Don'ts

- Do not remove anyone else's copyright or authorship claims. You are welcome to add yourself, but don't take anything away.
- Do not claim original authorship if you aren't the original author. Make it clear that you're building on someone else's work.
- Make an effort to reach out to the original author to be sure the work has been abandoned. It could be that the author just doesn't think more work is needed.
- Follow the [migration guides](/dev/plugins/php_updating/) to bring the plugin up to the current level of PHP.


22 changes: 22 additions & 0 deletions content/dev/plugins/php_updating.md
@@ -0,0 +1,22 @@
---
title: Updating plugins for higher levels of PHP
description: Migration guides for newer PHP versions
category: plugins
---

The Zen Cart core is updated for the current release of PHP as each release is done. You can see the mapping from Zen Cart version to PHP version in the [server requirements](/user/first_steps/server_requirements/#php-version) document.

But what about plugins?

Well, updating plugins needs to be done by the community. The first person to check with, of course, would be the plugin author, but they may not be able to do the work (for whatever reason). In this case, it could be an [orphan plugin that needs adoption](/dev/plugins/adoption/).

The following guidance is available for upgraders:

- [Migrating from PHP 8.0.x to PHP 8.1.x](https://www.php.net/manual/en/migration81.php)
- [Migrating from PHP 7.4.x to PHP 8.0.x](https://www.php.net/manual/en/migration80.php)
- [Migrating from PHP 7.3.x to PHP 7.4.x](https://www.php.net/manual/en/migration74.php)
- [Migrating from PHP 7.2.x to PHP 7.3.x](https://www.php.net/manual/en/migration73.php)
- [Migrating from PHP 7.1.x to PHP 7.2.x](https://www.php.net/manual/en/migration72.php)
- [Migrating from PHP 7.0.x to PHP 7.1.x](https://www.php.net/manual/en/migration71.php)
- [Migrating from PHP 5.6.x to PHP 7.0.x](https://www.php.net/manual/en/migration70.php)

3 changes: 3 additions & 0 deletions content/user/upgrading/php_warnings.md
Expand Up @@ -218,3 +218,6 @@ To avoid this, check the value using `empty`
if (!empty($array)) {
```

More suggestions and recommendations are available in the [PHP migration guides](/dev/plugins/php_updating/) in the Developer Docs.


Expand Up @@ -26,6 +26,8 @@ This document lists things you may wish to take into account as you upgrade. Th

- Most "functions" (both admin and non-admin) have been consolidated into files located in `/includes/functions/`. Some have been merged together. Some changes are listed below.

- Language file inclusions must be changed to comply with the new language file format. See [Developer Information on Array based Language files](/dev//languages/158_language_files/) for more details.

- The function `zen_parse_search_string` input parameters have been reversed. Plugins that use this function will require modification.

- The function `zen_get_countries` returns different array keys than previously. Admin plugins that use this function may use the new admin function `zen_get_countries_for_admin_pulldown`.
Expand Down

0 comments on commit c925025

Please sign in to comment.