Jump to content

WHMCS checksums - Essential pre-upgrade tool


Nick

Recommended Posts

My second contribution in three days, I'm on a roll!

 

Hi all,

 

Hate having to keep a record of which files you've modified, or keep forgetting? Fear no longer!

 

In short: It'll give you a list of WHMCS' files which you've customised, so that before an upgrade, you'll know what you need to stop being overwritten.

 

In long: This module queries WHMCS' database for the installation's version number, then compares a list of checksums for that version against the files actually in place on the server. It then presents you with a list of the files which aren't exactly the same as a freshly downloaded copy of the same version. When you're next updating WHMCS you know exactly which files you've made modifications to, safe in the knowledge that you've not forgotten about something.

 

(It also displays a list of missing files, unchanged files, and the checksum file)

 

The module will first check the WHMCS root directory for a checksums file (sums.<version>.md5). If found, this will be used as a reference. If not, the module will instead attempt to download a copy (using cURL).

 

A list of checksum file downloads is available in the forum thread you downloaded this module from.

New checksum files will be released following as close as possible to WHMCS releases.

 

-------------------------------

Screenshot: link

-------------------------------

Downloads:

 

Installation archive (zip)

Installation archive (tar.gz)

Installation instructions included in the README.txt file inside the archive.

 

v3.5.1 Checksum File

v3.5.0 Checksum File

-------------------------------

 

Hope you find it useful :)

Link to comment
Share on other sites

  • Replies 125
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

If you're only running a patched version it should detect the fact you've got lots of files not matching, and give you a message accordingly. Theoretically a patched checksums file is possible - installing a blank 3.5.0, patching it to 3.5.1 and then generating checksums. I didn't actually get this to work, however - my checksums were wildly different.

 

After doing a full upgrade to 3.5.1, however, it worked fine.

 

I'll regenerate a patched checksums file for you and see if you have better luck.

Link to comment
Share on other sites

Thanks Nick, renamed and uploaded and it gives me this..

 

You appear to have a large number of files not matching their original checksums.

Either you've got a LOT of files customised, the wrong checksum file is being used, or you are using a patched (incremental) update.

 

Dan

Link to comment
Share on other sites

Was it not saying this before?

 

I'm not entirely sure why this is occurring - I generated that checksum file by extracting an unmodified 3.5.0 release, then overwriting the appropriate files from the 3.5.1 incremental release. The only explanation I can think of would be Matt having changed things after the original download release, IE version numbers in file headers - but I doubt it.

Link to comment
Share on other sites

That may be the case, yes.

 

If you can get hold of a copy of the 3.2 zip file, extract it to a directory then extract 3.5.1 on top of it, run this command in the directory to generate a new checksums file:

 

find -type f -exec md5sum '{}' \; > /path/to/whmcs/root/sums.3.5.1.md5

 

The semicolon is part of the 'find' command, and obviously replace /path/to/whmcs/root/ with your WHMCS installation path.

Link to comment
Share on other sites

Love this tool, anything that can help you find out in only a few minutes what files have changed is a big boon.

 

What would be REALLY cool would be if you could get WHMCS to host these checksum files on their server. If you/they want something to automatically derive the checksum files from their publicly(*) available downloads yell, I'd be happy to put something together and have years of shell scripting experience.

 

(*) by publicly available, I mean the client download area, although obviously these checksum files would probably need to be unrestricted. Not sure if that's a problem or not.

Link to comment
Share on other sites

Doesn't really make much difference who hosts the files, and seeing as WHMCS withdraws old versions then a script which can get checksums from the online zip files would only work for the most recent releases.

 

People are of course free to generate their own checksum files if they're not happy with sourcing them from our server - the module accepts files generated with the md5sum command (I used the command I gave in a post above to generate the ones I published).

Link to comment
Share on other sites

I'm not entirely sure why this is occurring - I generated that checksum file by extracting an unmodified 3.5.0 release, then overwriting the appropriate files from the 3.5.1 incremental release. The only explanation I can think of would be Matt having changed things after the original download release, IE version numbers in file headers - but I doubt it.

 

First off, very clever contribution! Thank you, this is a nice little Christmas gift for us all. :)

 

As for Dan's issue, I had the same thing happen at first (hundreds of files showing as changed), so I generated a new checksum file based on unzipping the 3.5.1 incremental update on top of a set of new 3.5.0 files. This worked. My results are now perfect:

 

Total files changed: 25/1035

1. announcements.xml

2. images/clientarea/index.php

3. images/loading.gif

4. images/status/index.php

5. images/index.php

6. images/gateways/index.php

7. images/support/contact.gif

8. images/support/submitticket.gif

9. images/support/folder.gif

10. images/support/announcements.gif

11. images/support/supporttickets.gif

12. images/support/tutorials.gif

13. images/support/status.gif

14. images/support/order.gif

15. images/support/print.gif

16. images/support/addtofavouritesicon.gif

17. images/support/clientarea.gif

18. images/support/domains.gif

19. images/support/index.php

20. images/support/affiliate.gif

21. images/support/knowledgebase.gif

22. images/support/article.gif

23. images/support/faq.gif

24. images/support/downloads.gif

25. lang/English.txt

 

One other note is that my admin directory is renamed for security, so I temporarily named it back to "admin" while I ran Whmcs Checksums. This worked just fine.

 

Once again, awesome job.

 

Rick

Link to comment
Share on other sites

I whish I had paid more attention to this forum long ago. Today I'm getting tons of improvements to WHMCS!!

 

This is a great addition. I just want to thank you for it.

 

I want to suggest one modification: on line 27th of the file WHMCS_checksums.php, add the line

@file_put_contents ( "../" . $expfname , $sums );

That will make the script save the file for future requests and avoid unneeded downloads the second time someone visits the addon. For sure your server will appreciate it! ;)

 

Note that I have used a php5 function. But since php4 its going to be deprecated soon...

 

Q

Link to comment
Share on other sites

I'll consider making that (or an adaption, so it'll work in php4 and 5) part of the module next time I release an update. The only problem is that the WHMCS root directory would need to be world-writeable for this to work, which is something I wouldn't advise.

 

My server struggling won't be a problem, the checksum files are small, and it's not something that's in too great a demand.

Link to comment
Share on other sites

Hi Nick,

 

I do not think saving will be a problem, since saving is done under the folder owner's name. Which it is likely to have rights to do so. Anyway, the add sign in front it won't return any error and hence have no effect.

 

I do have another addition. I have added one Tab to your script to show a complete list of files that are under the WHMCS folder but not included into the test. That will report addons or any files that do not come with the standard installation (I have excluded templates_c, ioncube and attachments folders from the scan).

 

To my surprise, there is a bunch of language files in the Admin/editor, and into the templates, that are not considered into the checksums file. Or some like the admin/config.php one (which, I did verify, it does not come with 3.5.1 release). A sample listing below:

Files under /home/comfort/public_html/billing/ that are not from WHMCS 3.5.1 Release. Total found: 601

 

admin/config.php

admin/editor/langs/ar.js

admin/editor/langs/ca.js

admin/editor/langs/cs.js

admin/editor/langs/cy.js

admin/editor/langs/da.js

admin/editor/langs/de.js

admin/editor/langs/el.js

admin/editor/langs/es.js

admin/editor/langs/fa.js

 

I do wonder what does it mean? Where those files delivered on past versions of WHMCS and now Matt has taken them out? Are they needed anymore?

 

If you want to test that modification, I have left the full files here:

http://www.comforthost.net/billing/modules/admin/WHMCS_checksums.tar.gz

 

Please let me know on what you think about the files list. Oh... and you will need php5.

 

Regards

 

Q

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

Thanks :)

 

Just a heads up to people, if you upgraded your WHMCS straightaway you'll find WHMCSchecksums lists almost all files changed. This is because the download file changed after the original release (when Matt released updated files to fix the // : bug viewing tickets) resulting in different checksums for most files. I created the checksums file on the updated WHMCS release, meaning your checksums don't match the release checksums.

 

I don't still have a copy of the original 3.6.0 download, so you'll need to reupload WHMCS 3.6.0 (except files you've changed) for this to work. That is, unless someone still has the original zipfile so I can generate the correct checksums for your installation.

Link to comment
Share on other sites

ecwNick,

 

Do you know which file/s were updated? Also I have an original checksum for 3.6.0 if you want me to email it to you, just send me a pm. Also agreeing with uberhost... Yes this did make for a nice upgrade, very smooth, thanks again!

Link to comment
Share on other sites

As far as I can tell, each change to any part of WHMCS causes almost all the file checksums to change. I can only assume that Matt re-encodes the entire installation with each small change.

 

I only know of three changes to 3.6.0 since it's release, but there may be more - with each of these Matt has silently changed the download file (I'm assuming each change was made separately).

Link to comment
Share on other sites

  • 2 weeks later...

Nick

This is a great contrib and as such have installed it.

But it's not working correctly on V6.0

It's telling me I have 399 Changed files.

Naturally this is not correct. I have tried re-uploading some files from a fresh unzipped copy of 3.6, and then ran the script again.

But again it says even those same files are changed.

1. Does this file look at date/time stamps? Could that be an issue?

2. Is there a cached file of the data collected once the script has been run, like per version?

 

Any help would be appreciated.

Thanks

Link to comment
Share on other sites

Matt has probably released a new silent update since the checksums file. You'll need to generate a new checksums file for this release.

 

Extract a copy of the zip file onto your server and run this command inside the whmcs directory:

find -type f -exec md5sum '{}' \; > /path/to/whmcs/root/sums.3.6.0.md5

Change /path/to/whmcs/root to your actual path.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated