News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Admin.php: // Mod Authors for a "ADD AFTER" on this line.

Started by Deprecated, March 07, 2016, 06:28:50 PM

Previous topic - Next topic

Deprecated

I'm debugging some other mod authors' mods since they are interfering with my mods.

In Admin.php do the words "Mod Authors for a "ADD AFTER" on this line" mean add your mod code after that line or do they mean use the "after" search term position in your modification.xml file? The latter of course places your code above (before) the tag line.

It's been years since I learned that in writing mod searches "after" means "before" and "before" means "after." However, my mind reading skills are somewhat lacking and anyway I don't know whose mind to read in interpreting that line.

It should have been stated as:

(1) "Mod authors, please insert your code BEFORE this line."

or

(2) "Mod authors, please insert your code AFTER this line."

The words for a "ADD AFTER" not only are subject to massive misinterpretation, or at least 50% mod authors placing their code after the line and placing the code before the line, but it's also bad grammar. It should say "Mod Authors for an "ADD AFTER" on this line." The rules of grammar state that when the noun (adjective, etc.) following the use of the indefinite article "a" starts with a vowel (actually it's more the sound of the word than the actual letter) you should use the "an" indefinite article.

Unfortunately, the rules of programming state that "if u cn read this u r well suited 2 b a gud coder." :P

SRSLY, is taking a class in anti-gramar required to get a CS degree these days? :P :P :P


Extra credit: (1) I'll give you a dollar if you tell me who wrote that line. (2) Is he alive or dead? and (3) Give me his address and I'll guarantee the answer for #2. ;) ;) ;) (just kidding!!!)

By the way, "the" is a definite article. Also, "toe tapping sucks!"

JBlaze

It's meant to say "Add your code AFTER this line", and I agree that it's poorly worded. That said, however, if you can avoid editing any files for your modifications in favor of integration hooks, please do so :)
Jason Clemons
Former Team Member 2009 - 2012

Suki

It doesn't really matter, that line is there for one purpose only, for mod authors to use it as a reference to add their own lines.

You can add your code before or after that line, doesn't matter.

Whats really important is that you add your code properly.  Anyway, a few lines below there is a hook for adding your code so no need to edit that file.

Keep in mind that no every dev is a native English speaker person. I'm glad you have such impeccable grammar.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Deprecated

Just exactly how does the package manager know what code to remove after additional lines have been inserted after the tag and before the lines you inserted which used to be after the tag?

And I'm not writing a mod. I'm trying to figure out why a mod somebody else wrote won't uninstall.

And also, everybody should do it the same way. Either before or after. Not half before and half after. That produces disorderly code.

JBlaze

Quote from: Deprecated on March 07, 2016, 06:51:59 PM
Just exactly how does the package manager know what code to remove after additional lines have been inserted after the tag and before the lines you inserted which used to be after the tag?

It doesn't unless the mod author correctly tells the package manager what code to remove. As a rule of thumb, all mods that add code should not just use the "reverse" method. They should actively set it so that the uninstaller removes any added lines specifically, and/or restores any modified vanilla code. This prevents many uninstallations from failing.
Jason Clemons
Former Team Member 2009 - 2012

Deprecated

Just noting, I uninstalled the mod installed after the problem mod that wouldn't uninstall, and then the problem uninstall worked just fine. All the mods in question were installed after the tag line.

You should not have to uninstall one mod before uninstalling a mod that was installed before that. You should be able to install/uninstall mods in any order.

Deprecated

You mean have separate modification.xml and unmodification.xml files? I've never seen anybody do that.

live627

QuoteYou should not have to uninstall one mod before uninstalling a mod that was installed before that
thats how automated file edits work. Yes, it sucks.

QuoteYou should be able to install/uninstall mods in any order
use hook-only mods then.

Deprecated

Quote from: live627 on March 07, 2016, 07:40:26 PM
that's how automated file edits work. Yes, it sucks.

That's not how it should work. And I respect the inventor of the concept of the Package Manager. In ... 8 years of my tenure at SMF? ... I have rarely run into "goota uninstall this one before you uninstall that one" issues. During my short reign on the Mod Squad this is one of the things I intended to address: mod packages not destroying the tag line or otherwise obfuscating matters by sloppy mods.

The very worst example (and I've seen many) is when a package ****s up and inadvertently destroys the tag line. This can be done as easily as adding your mod before the tag line and ****ing it up and adding a tab to the tag line. Thereafter any mod author who searches for the ENTIRE tag line (newlines included) is destined for failure because the schmuck who wrote the previously installed mod hosed the tag line.

When I was on the Mod Squad my mission was to require both mod authors and squad members to look at the modified files and ensure that formatting remained intact. I presume the latter has happened: I hope examining all modified files for proper formatting and neatness and consistency to SMF coding styles has become a requirement.

But I digress. In my current role not as a mod author but simply as a forum operator, it is much to my chagrin to discover that installing and removing mod packages is hap hazard and good luck discovering which one you have to uninstall first as you peel back the layers to reach the point where that pivotal mod that is the roadblock can be uninstalled, and allow you to proceed.

I'm going to mark this topic solved only because I have accepted with a grudge that you can't fix old mods written by mod authors other than yourself.

Actually if the package manager was smart enough it would be able to figure this <ahem> out.

Deprecated

Has the hook method been in since 2.0? If so that's news to me. I was on the Mod Squad then and it was never mentioned to me in the context of approving mods. If only it had been a requirement since its inception.

Of course it's impractical to demand all updated mods should use the hooks. Too many mods, too little mod squad. The end result would be that most mods would go dead.

Suki

Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

JBlaze

Quote from: Deprecated on March 07, 2016, 07:04:12 PM
You mean have separate modification.xml and unmodification.xml files? I've never seen anybody do that.
I do it for all my mods that require file edits. Saves on support requests when the uninstall fails.
Jason Clemons
Former Team Member 2009 - 2012

live627

Another, more widespread example of this phenomenon is code conflicts on github. If someone modifies code that a pending pull request looks for, it can't be merged unless the author fixes it.

Patch files are highly annoying necessary evil.

QuoteI have accepted with a grudge that you can't fix old mods written by mod authors other than yourself
ah, the paradox of all drivers on the road but you are bad.

QuoteActually if the package manager was smart enough it would be able to figure this <ahem> out.
if the package manager were smart enough, it would be unable to edit files. Nyeh heh heh.

Deprecated

Well I will appreciate any advice on how I can correct the sins of mods written by persons other than myself.

I'm marking the topic solved but in truth there is no solution except for new mods not being approved by the Mod Squad unless they meet the guidelines we discussed above.

Unless you care to supply me with the passwords for those modders who wrote hosed mods.

And yes I understand the SMF password/hash system and that it is nearly impossible to recover passes from the database, although easy for an admin to just change them.

live627

QuoteUnless you care to supply me with the passwords for those modders who wrote hosed mods.
Sure, look in the pizza :P

Oh ho, is trolling a sin?


Advertisement: