Jump to content

Is there a right (or wrong!) way to fork a module that's already in use?


Recommended Posts

I've been using `FieldtypeMapMarker`.

I'd like to fork it.

Is there a right way to fork a module that's already in use?

Is there a wrong way? ?

If I just modify the files in place without doing anything else they could get overwritten by the `ProcessWireUpgrade` module if the upstream module ever changes.

If there's no right way, I presume I have to: copy the directory, change some names, install the new module manually, copy all of the old module fields to the new module fields, uninstall the old module... something like that?

Link to comment
Share on other sites

Yes, thanks, I knew about that.

It works in one sense:

image.png.245dcc6e6b9dd91a130a7136489867c1.png

but not in another:

image.thumb.png.2bbc86900efdad8404ac826048deebd2.png

It lets you choose one version of the files or another, but it knows they're both actually `TextformatterHannaCode`. So if `TextformatterHannaCode` were ever updated, and if I or someone else clicked the "upgrade" link, maybe the update would overwrite my changes.***

That seems kind of obvious, so just to clarify: what I was hoping was that I could break the link between the name and the repository. You could imagine that might work if, for example, there was a GitHub URL stored in the module config; I'd change the URL to point to, say, a fork of the original repository. 

But in fact I think the name is used to look up the module in the module directory — and *that* is where the GitHub URL is; for example:

So: I think that to *actually* fork a module you have to change its name everywhere.

===

***I'll see if I can figure out if that's true. Maybe, for example, the upgrade link uses the *original* module directory name?

Link to comment
Share on other sites

Quote

Maybe, for example, the upgrade link uses the *original* module directory name?

It does.

To test I:

  • Renamed the module directory
  • Changed the version number in the module files to force an update
  • Updated the module

The update used the original module directory name, and didn't overwrite my changes in the renamed directory.

So: renaming the module directory might work. It's slightly wonky — there were some issues — but it might work.

Thanks, @adrian, for nudging me in the right direction; I knew about the mechanism, but thought it was only for forking core modules!

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...