Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: dougiefresh on March 01, 2016, 06:58:02 PM

Title: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on March 01, 2016, 06:58:02 PM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=4086)



AUTOMATIC PACKAGE VERSION EMULATION v1.6
By Dougiefresh (http://www.simplemachines.org/community/index.php?action=profile;u=253913) -> Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=4086)



Introduction
This mod just makes it a little easier to install mods that were written exclusively for earlier versions of SMF!!!  How?  Well, continue reading!

This mod determines what version of Simple Machines Forum software (SMF) is needed to be emulated in order to install the mod and alters the install/upgrade/uninstall link so that the necessary forum version is included automatically, making mod installation a bit easier.  It also displays what version is going to be emulated in the install/upgrade/uninstall link.

Inspiration
This feature was backported from the SMF 2.1 Beta 2 software, which has similar functionality built in.  However, no code from SMF 2.1 Beta 2 was used in the making of this mod.

Compatibility Notes
This mod was tested on SMF 2.0.11, but should work on SMF 2.0 and up.  SMF 1.x is not and will not be supported. 

Furthermore, SMF 2.1 will not be supported, as it already has this functionality built in.

Changelog
The changelog can be viewed at XPtsp.com (http://www.xptsp.com/board/free-modifications/automatic-package-version-emulation/).

License
QuoteCopyright (c) 2016 - 2017, Douglas Orend
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: live627 on March 01, 2016, 07:01:33 PM
This is going straight into my arsenal. 
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: margarett on March 01, 2016, 07:02:54 PM
Ditto! :)
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: Colin on March 01, 2016, 07:50:53 PM
Great mod, Dougie. Thanks for your work on this.
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on March 01, 2016, 10:20:08 PM
Thanks, guys!
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: lurkalot on March 02, 2016, 03:09:10 AM
Nice mod.  8) Haven't tried it yet, so a quick question.

Does it work in reverse, I mean when uninstalling mods will the uninstall links also show without having to set emulation manually? 

Edit: I mean mods installed prior to installing this one.
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on March 02, 2016, 08:51:16 AM
They should be able to uninstall without setting the emulation beforehand.  In my tests, I was able to do so effortlessly....  And I tested with 10 mods....
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: Steve on March 02, 2016, 09:04:26 AM
Quote from: live627 on March 01, 2016, 07:01:33 PM
This is going straight into my arsenal. 
Quote from: margarett on March 01, 2016, 07:02:54 PM
Ditto! :)

Make it three! Thanks for all the work you do dougie. ;D
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: aegersz on July 13, 2017, 06:39:52 AM
I love this one too ... you're one hell of a programmer !!
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on August 12, 2017, 01:28:43 PM
UPDATE:  I've discovered an issue with this mod.  When you set a specific version to emulate, the mod completely ignores the version that was set....
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: Steve on August 12, 2017, 05:40:59 PM
Is that an FYI for us so we know you're aware of it and are working on a fix?
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on August 12, 2017, 06:09:31 PM
Quote from: Steve on August 12, 2017, 05:40:59 PM
Is that an FYI for us so we know you're aware of it and are working on a fix?
Yep.
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on August 14, 2017, 11:12:42 AM
Uploaded v1.1 - August 14th, 2017
o Fixed issue where user-selected version emulation was ignored.
o Fixed issue where text was displayed before templates started.
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: 4Kstore on August 14, 2017, 12:02:21 PM
Great mod, thanks!
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: TiPsY on August 15, 2017, 01:15:00 PM
I've gotten this error on the upper left side after trying to uninstall: http://i.imgur.com/ZXxo1vN.png

Now, I couldn't find the origin but I reversed that from the package backups, any info on how to install the new version without getting this for uninstalling the previous one?
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on August 16, 2017, 10:15:39 AM
Quote from: TiPsY on August 15, 2017, 01:15:00 PM
I've gotten this error on the upper left side after trying to uninstall: http://i.imgur.com/ZXxo1vN.png

Now, I couldn't find the origin but I reversed that from the package backups, any info on how to install the new version without getting this for uninstalling the previous one?
You will have to edit Themes/default/Packages.template.php and remove everything before <?php.  The new version should solve that particular issue with the Package Manager template....
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: mysimplesite on August 16, 2017, 11:50:06 AM
Thanks for the great mod. Can't wait to try it out. Installed flawlessly.
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on August 19, 2017, 10:27:28 PM
Uploaded v1.2 - August 19th, 2017
o Fixed undefined element error in Sources/Sub-Packages.php.
o Fixed undefined element error in Themes/default/Packages.template.php.
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on August 27, 2017, 01:06:11 PM
UPDATE:  I'm aware that version 1.2 is still screwed up....  Packages that require emulation are not being caught by the mod.  I'm working on a solution....
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: efk on August 28, 2017, 02:30:43 PM
Expecting to try stable version. About copyrights, is this mod free for use?
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: Arantor on August 28, 2017, 03:31:44 PM
The licence is given in the opening post, including the copyright and rules about whether you can use it.
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: aegersz on September 13, 2017, 09:00:37 AM
i went to install the new version of a few mods from dougiefresh because i love the extra functionality they offer BUT I got an error that I can see ((it's very vague message/line of code) and it looks like "uninstall emulation":

This was the error presented at the very top of the screen:

'empty($package['emulate_version']) ? $txt['uninstall_mod'] : $txt['uninstall_emulating'] . ': ' . strtoupper($package['emulate_version']), ' ]';

I think this is related to dougie's Automatic Version Emulation BUT EVEN after i uninstalled it, i still have this code fragment at the very top of my screen:

[ ', $txt['uninstall'], ' ]';

Please move this thread to the appropriate area, i'm sorry for dumping this here.
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: aegersz on September 13, 2017, 09:02:33 AM
This mod has caused me some grief, even after uninstalling it.

The problem only presents in the Package Manager.

Please see https://www.simplemachines.org/community/index.php?topic=556174

Topic merged with this one, see post just before this one ~ Steve


What i would like to know (and fix) is why i am still seeing residual code (that i assume wasn't carefully undone upon uninstall (?))

I want to get my systems back to being stable. Don't get me wrong, I love your mods but they need some more love and attention as they are impacting on core SMF functions. I can only assume that you are over-delivering at a rapid rate ... but you can fix anything. Slow down brother !

dougie, i have made you an Admin again so log into my site and head for the Package Manager and look at the very top of the screen - try to mark it (it highlights) to catch the residual code fragment.

or take this link now: https://forum.drugs-and-users.org/index.php?action=admin;area=packages
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: Steve on September 14, 2017, 10:13:02 AM
Quote from: aegersz on September 13, 2017, 09:02:33 AMI can only assume that you are over-delivering at a rapid rate ... but you can fix anything. Slow down brother !

As you seem to be the only one having all these problems maybe you should consider the possibility that it's your system causing issues, not the other way around.

(I'm a fan of dougie and his mods so I'm quick to jump to his defense. :) )
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: Arantor on September 14, 2017, 10:30:59 AM
Yeah, I'd generally assume that having 100+ mods is automatically part of the problem, not part of the solution.
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on September 14, 2017, 11:03:48 AM
@aegersz: I would guess you are running version 1.0 of the mod, which does have the "residual code leftover after uninstall" issue.  It appears to install just fine, so I don't understand what I messed up on in version 1.0...  But I fixed that with version 1.1...  I'm working on a version 1.3, which solves the issues that I've seen on my test forum....

Anyways, edit Themes/default/Packages.template.php and remove everything up to <?php.  That will take care of this issue.




@Steve and @Arantor:  No, he has a point.  I've delivered a few versions of mods with typos.  I really do need to slow down and verify the code/mod works before I release it.....  (Sigh)

But aegersz has been pointing out issues with my mods, and I'll happily fix whatever issues anybody finds if it is within my capability to fix them.
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: aegersz on September 14, 2017, 01:56:26 PM
guys, there is no bigger fan of dougie's mods than me.

I did install and uninstall the first release so I will follow his advice.

then I will reinstall the mod. I just got a bit worried for a moment.

I always take any new mod or most existing mods and see how they coexist with others for the sake of adding functionality and helping out existing and future users of his mods - for everyone's benefit.

I only want to help him to build the best possible code so don't take me the wrong way. he takes pride in his work and always tries to add suggested functionality, if possible.

without doubt, the best overall mod contributer here (and possibly on the planet), IMO.

I am just in a good position to do so as I have so many mods (of his and others) so I might as well be useful.

he always fixes all his issues so it's a win-win situation for SMF, myself, dougie and all current/new/future users of his code.

it's the mods that make SMF the best forum software, as I see it, not to mention the fact that it's open source.

everyone involved playing their role, selflessly devoting time and energy and resources into this, does so for the pure satisfaction that it brings for themselves and others- it's a beautiful thing.
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: aegersz on September 14, 2017, 08:36:48 PM
@dougie, thanks - i did it and it's all good now.

I hope you didn't take my comments the wrong way ... you're a coding machine !

BTW, i tried to register on your site but got an error so i couldn't complete the registration.

Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on September 15, 2017, 01:23:52 PM
I fixed the error on my website.  What do ya know, another syntax typo on the No Log Certain User Errors (http://custom.simplemachines.org/mods/index.php?mod=4041) mod....  This one about one year old....
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: Gwenwyfar on September 15, 2017, 01:26:15 PM
Quote from: dougiefresh on September 15, 2017, 01:23:52 PM
I fixed the error on my website.  What do ya know, another syntax typo on the No Log Certain User Errors (http://custom.simplemachines.org/mods/index.php?mod=4041) mod....  This one about one year old....
Time for a new keyboard or just typing too fast for good accuracy levels?  ;D
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on September 15, 2017, 01:30:52 PM
Hell, I dunno.....  I've done replaced my keyboard within the 9 months year....  Maybe a brain replacement is necessary, too...
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on November 20, 2017, 11:06:41 AM
Uploaded v1.3 - November 20th, 2017
o Fixed code so that user-selected version emulation is taken into account.
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: -Rock Lee- on November 21, 2017, 10:22:55 AM
Recently I have seen this modification seems very curious, we will "break it a little" :laugh: in local to see how it goes lol. And in passing we leave the translation to Latin Spanish :), anything you tell me!


Regards!
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on November 22, 2017, 09:58:29 AM
Uploaded v1.5 - November 22th, 2017
o Added Spanish Latin translation, courtsey of Rock Lee (https://www.simplemachines.org/community/index.php?action=profile;u=322597)!




@Rock Lee:  Thank you for the translation!  It's been included in this version!

@Everybody:  I noticed some version confusion with version 1.3, in that it will show up in Package Manager as version 1.4.  I decided to put this version at version 1.5, in order to reduce confusion.  I apologize for any confusion that mistake caused.....
Title: Re: Automatic Package Version Emulation (SMF 2.0.x Only)
Post by: dougiefresh on October 10, 2018, 11:54:10 AM
Uploaded v1.6 - October 10th, 2018
o No functionality change.
o Updated documentation to point to new website.