You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: development/extensions/tutorial_advanced.rst
+169
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ This tutorial explains:
16
16
* `Using service decoration`_
17
17
* `Replacing the phpBB Datetime class`_
18
18
* `Extension version checking`_
19
+
* `Implementing Filesystem changes to phpBB`_
19
20
20
21
Adding a PHP event to your extension
21
22
====================================
@@ -526,3 +527,171 @@ branch can be used to provide links to versions in development.
526
527
``download`` | "(Optional) A URL to download this version of the extension."
527
528
``eol`` | "This is currently not being used yet. Use ``null``"
528
529
``security`` | "This is currently not being used yet. Use ``false``"
530
+
531
+
Implementing Filesystem changes to phpBB
532
+
========================================
533
+
In certain scenarios, an extension may need to implement filesystem changes within phpBB beyond the extension's
534
+
self-contained structure. While this approach is generally discouraged, there are specific conditions where it
535
+
may be appropriate. Extensions can safely add or remove files and folders within phpBB’s ``files``, ``images``,
536
+
and ``store`` directories, as these are designed to hold user-generated content and are typically not replaced
537
+
during phpBB or extension updates.
538
+
539
+
There are two primary methods for implementing filesystem changes in phpBB through an extension:
540
+
541
+
1. Using Migrations
542
+
2. Using the Extension Enabling Process (ext.php)
543
+
544
+
Below are examples of how to create a directory named ``my_extension_dir`` in the ``store`` directory for storing additional extension-related files.
545
+
546
+
Using Migrations
547
+
----------------
548
+
While migrations are generally designed for database changes, they offer specific advantages when managing filesystem changes:
549
+
550
+
- Existence Check: Use the ``effectively_installed`` method to check if the files or directories exist already.
551
+
- Installation Order: Use the ``depends_on`` method to ensure the directory is created at the correct stage during the extension’s installation process.
552
+
- Run separate (optional) filesystem processes during installation and uninstallation.
553
+
554
+
.. code-block:: php
555
+
556
+
<?php
557
+
558
+
namespace acme\demo\migrations;
559
+
560
+
class add_my_extension_dir extends \phpbb\db\migration\container_aware_migration
0 commit comments