Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,110 of 9,110 pages
About the help in other languages
All help pages

Taking inventory of an old extension

Find out what an old extension contains and what will need work before you change a line: files, settings, PHP entry points, JavaScript, inline code, database tables, with the commands to list each.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/extension-development/part-4-upgrading/inventory-an-old-extension.md

On this page

Taking inventory of an old extension

Part 4, chapter 3. Before you fix anything, find out what you have. This chapter gives you a set of commands that each answer one question about an extension, and a table to write the answers into. Run them from the root of your development installation, with the extension in extension/<name>/. In the examples the extension is called myoldext; use your own name.

1. What is in it?

cd extension/myoldext
find . -type f -not -path './.git/*' | sed 's|/[^/]*$||' | sort | uniq -c

This prints each folder and how many files it holds. Compare the folder names with The extension directory layout. Folders the kernel does not know (lib/, src/, vendor/) belong to the extension's own code; folders such as kernel/ or lib/ezutils/ inside an extension usually mean it replaces kernel files, which is the hardest kind of upgrade (Kernel overrides: the last resort).

2. Who made it, which version, which license?

cat ezinfo.php extension.xml composer.json LICENSE* COPYING* 2>/dev/null | head -80
git log --format='%h %ad %an %s' --date=short | tail -5
git log --format='%h %ad %an %s' --date=short | head -5

Write down the license and the authors before anything else. If there is no license file and no license line, you may not publish your changes; ask the author first (Reading licenses before you reuse anything).

3. Where does it plug into the kernel?

Every extension point is registered by a setting. Listing the settings files and their sections tells you which mechanisms it uses:

ls settings/
grep -h '^\[' settings/*.ini* | sort | uniq -c
grep -rhn 'ExtensionDirectories\|DesignExtensions\|ModuleList\|ExtensionRepositories\|AvailableDataTypes\|AvailableEventTypes' settings/

Then the files with fixed names:

ls modules/*/module.php autoloads/eztemplateautoload.php cronjobs/*.php bin/php/*.php 2>/dev/null

Fill in this table:

MechanismFound whereCount
Modules and viewsmodules/*/module.php
Template operatorsautoloads/eztemplateautoload.php
Fetch functionsmodules/*/function_definition.php
Datatypessettings/content.ini.append.php [DataTypeSettings]
Workflow event typessettings/workflow.ini.append.php [EventSettings]
Cronjob partscronjobs/*.php and settings/cronjob.ini.append.php
CLI scriptsbin/php/*.php
Designsdesign/*/ and settings/design.ini.append.php
Translationstranslations/*/translation.ts
Own database tablessql/*/ or share/db_schema.dba

Each row has a chapter in Part 3, and you will check each of them when it runs.

4. Does the PHP parse?

find . -name '*.php' -not -path './vendor/*' -print0 | xargs -0 -n1 php -l | grep -v '^No syntax errors'

No output means every file parses with the PHP on your path. Run it again with each PHP version you support; on a server with several PHP builds the binary has its own path (for example /usr/bin/php8.0 or /opt/<vendor>/php/8.0/bin/php, depending on how PHP was installed).

Note

php -l only checks syntax. A file can parse and still stop at run time, for example when it calls a removed function. Steps 5 and 6 find those.

5. Which old PHP does it use?

These searches find the patterns PHP 8 removed or changed. Each hit is a line to look at, not always a line to change.

# removed functions
grep -rnE '\b(each|create_function|split|spliti|ereg|eregi|ereg_replace|eregi_replace|mysql_[a-z_]+|money_format|get_magic_quotes_gpc|get_magic_quotes_runtime)\s*\(' --include='*.php' .

# deprecated in 8.1 to 8.5
grep -rnE '\b(utf8_encode|utf8_decode|strftime|gmstrftime|curl_close|imagedestroy|finfo_close|xml_parser_free)\s*\(' --include='*.php' .
grep -rn 'FILTER_SANITIZE_STRING\|\$http_response_header' --include='*.php' .

# parameters typed with a class and defaulting to null, without a question mark
grep -rnE '\(\s*[A-Z][A-Za-z0-9_]+\s+\$[A-Za-z0-9_]+\s*=\s*null|,\s*[A-Z][A-Za-z0-9_]+\s+\$[A-Za-z0-9_]+\s*=\s*null' --include='*.php' .

# ezinfo.php with bare keys
grep -nE '^\s*(return array\(\s*)?(Name|Version|Copyright|License|Info_url|info_url)\s*=>' ezinfo.php

For old-style constructors, list each class and look for a method with the same name:

grep -rhoE '^\s*(abstract\s+|final\s+)?class\s+[A-Za-z0-9_]+' --include='*.php' . | awk '{print $NF}' | while read c; do
  grep -rlnE "function\s+$c\s*\(" --include='*.php' . | sed "s|^|$c: |"
done

Every line it prints is a class whose constructor PHP 8 no longer calls (Old-style constructors and static calls).

6. What does it do in the browser?

# inline scripts and event handler attributes in templates
grep -rnE '<script[^>]*>[^<]|\son[a-z]+\s*=|javascript:' --include='*.tpl' design/

# inline styles
grep -rnE '<style|\sstyle\s*=' --include='*.tpl' design/

# old libraries
grep -rnE 'ezjsc::yui|YUI\(|YAHOO\.|jQuery\.browser|\.live\(|\.size\(\)|\.andSelf\(|jQuery\.camelCase' design/ settings/

# copies of libraries shipped with the extension
find design -name '*.js' | xargs -r grep -lE 'jQuery JavaScript Library v|YUI [0-9]' 2>/dev/null

The first two searches find most of what a Content Security Policy without 'unsafe-inline' blocks; the browser console finds the rest. Write down the count per template.

7. Does it have its own tables?

ls sql/*/ share/*.dba 2>/dev/null
grep -rhoE "'name'\s*=>\s*'[a-z0-9_]+'" classes/ | sort -u | head

The second line finds the table names in definition() methods of eZPersistentObject classes. Old extensions often ship only a sql/mysql/schema.sql; Exponential 6 supports several database engines, so plan for a .dba file (Database schema and .dba files).

8. Write it down

An inventory is only useful if you keep it. Copy this into an issue of your repository:

Extension: myoldext            License: GPL-2.0-or-later      Authors: (from ezinfo.php and git log)
Last release: 1.2 (2012)       PHP files: 41                  Templates: 23

Loads on PHP 8.0: no (2 parse errors)
Old constructors: 4 classes     Removed functions: each() x2, split() x1
Implicitly nullable parameters: 7
Inline scripts: 5 templates     Event attributes: 12           Inline styles: 9
Libraries: YUI 2 (calendar)     Own tables: 2 (MySQL only)
Kernel overrides: none

Estimate: steps 1-4 one day, steps 5-6 two days

What can go wrong

SymptomCauseWhat to do
grep finds hundreds of hits in vendor/ or a bundled libraryyou searched third-party codeexclude it; upgrade the library as a whole instead of patching it
php -l passes but the admin shows a blank pagea fatal error at run timelook at var/log/error.log and the PHP error log
The constructor search prints a method that is not a constructora method happens to share the class name in another classcheck by hand; only a method in the same class counts

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x