Code Monkey home page Code Monkey logo

Comments (12)

lairdshaw avatar lairdshaw commented on July 20, 2024

Argh. Confirmed. Sorry about that. I do not understand template versioning all that well, so a fix could take some time - I will have to do some research on how to Get It Right. Alternatively, if you know of a fix (or simply a clear explanation of MyBB template versioning), I would very much welcome it.

from active-threads.

Eldenroot avatar Eldenroot commented on July 20, 2024

IIRC - TYL system works fine (you added template versioning as well, am I right?) Maybe just some typo in your code here?

from active-threads.

lairdshaw avatar lairdshaw commented on July 20, 2024

Well, I hope it's just a typo, because, yes, I copied from the TYL system for which - you're correct - I also authored template versioning... am having nightmares now of TYL versioning not working either and being responsible for that.

from active-threads.

lairdshaw avatar lairdshaw commented on July 20, 2024

Hmm. Looks like the same problem for TYL system. Can you confirm?

from active-threads.

Eldenroot avatar Eldenroot commented on July 20, 2024

Are you sure? It has been ages when I performed an update, but last time it was fine. I will try to create a test board.

from active-threads.

lairdshaw avatar lairdshaw commented on July 20, 2024

Not 100% sure. My testing was only this:

  1. Modify a TYL template.
  2. Check "Find Updated Templates". The template appears there.
  3. Edit the template again.
  4. Check "Find Updated Templates". The template still appears there.

from active-threads.

lairdshaw avatar lairdshaw commented on July 20, 2024

Looking at the way PluginLibrary handles templates, I think I see what I've done wrong. I think that the following explains the problem and how to solve it, but I'm open to corrections.

I was concerned - as you can see in the comments re template versioning in the TYL plugin - to ensure that the test m.version > t.version was true so that updated templates are detected by core code, however, the way I've set the version for plugin tempates (to MyBB version number appended with plugin version number), that test is also true after the updated template is saved. Why? Because MyBB simply sets the saved template's version to MyBB version, which is still less than the number I've given the comparison plugin templates with sid -2 (again: MyBB version number appended with plugin version number).

It looks like the way to do things is to set a small value for the version of the plugin's templates with sid -2 (at least, anything smaller than the MyBB version number but greater than zero - e.g., simply 1), and then when upgrading the plugin, set the version number of modified templates to zero. That way the test m.version > t.version is also true, but when the template is saved, the comparison is no longer true, because the zero becomes MyBB version number and this is not smaller than the small version number we've set for the plugin's templates with sid -2.

I hope that's not either mistaken or too confusing, but it's my current attempt to understand what the problem is and how to solve it.

from active-threads.

lairdshaw avatar lairdshaw commented on July 20, 2024

I believe that the above commit fixes this problem - could you please test and let me know. It bumps the version number, so auto-upgrade using deactivate-copyfiles-reactivate should work. Then, to test, go to Find Updated Templates, confirm that you see your modified templates for this plugin, edit and save them, and go back to Find Updated Templates to confirm that you no longer see them.

from active-threads.

lairdshaw avatar lairdshaw commented on July 20, 2024

If this works for you, I'll provide a similar fix for the TYL system.

from active-threads.

Eldenroot avatar Eldenroot commented on July 20, 2024

It looks fine, I havent tested the code yet because I am not able to get to my PC today.

from active-threads.

Eldenroot avatar Eldenroot commented on July 20, 2024

@lairdshaw - OK, tested and works fine! I would be really grateful if you can push a PR with fix to TYL repo too :) thx!

from active-threads.

lairdshaw avatar lairdshaw commented on July 20, 2024

I have direct commit access to the TYL plugin's repo, so I skipped the PR and just committed the fix. I didn't change the plugin's version number though, so if you want to test the fix, you will need to bump that first.

from active-threads.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.