Skip to content

5. Tips for XOOPS module developers

Michael Beck edited this page Jun 8, 2026 · 2 revisions

5. Tips for XOOPS module developers

  • Run the PHP pass (this tool) first, the template pass second. Smarty .tpl changes are a separate XOOPS upgrade step.
  • Make your module's rector.php path-tolerant. A module may have class/ but no src/ (or vice-versa). Filter your paths with is_dir so a missing directory never errors (the bundled standalone rector-xoops.php does exactly this; this package's own rector.php is just QA config): ->withPaths(array_filter([__DIR__.'/class', __DIR__.'/src', __DIR__.'/admin'], 'is_dir')). Add ->withRootFiles() to also include top-level *.php.
  • Profiles / PHP level. The XOOPS set is PHP-level-agnostic; set withPhpSets() to your target (php82 for XoopsCore27, php74 for XoopsCore25 — run the tool on PHP 8.2+ either way; Rector can target older output).
  • The DB read/write split is keyword-based. It classifies literal SQL. Dynamic SQL ($db->queryF($sql) where $sql is a variable) defaults to query() — review those by hand.
  • Skip what you can't safely change. vendor/, language/, templates/, generated files — exclude them via withSkip().
  • Commit the reformat separately. Adopting the tool may reformat a module; keep that in its own commit and add the SHA to .git-blame-ignore-revs so git blame stays useful.

Clone this wiki locally