How to fix File health check - Unexpected contents - Xenforo 2

How to fix File health check - Unexpected contents - Xenforo 2

When you run the File health check function of Xenforo 2, you may get error messages about the Unexpected contents of some files.
For example:


How to fix File health check - Unexpected contents - Xenforo 2.webp


This error will appear when you edit files in the source code (XenForo, add-on, style,..).
To fix this, you need to update the SHA256 code of the modified file declared in the hashes.json files.

If it's Xenforo files, the SHA256 code will be declared in: src/addons/XF/hashes.json
If it is an add-on file, it will be declared in the file hashes.json located in the directory of the add-on.
Example: src/addons/NameAddon/hashes.json

XenVn add-on has a built-in feature that helps you see the SHA256 code of all files in the source code.
Go to XenVn File Manager at: domain.com/admin.php?xv/files

How to fix File health check - Unexpected contents - Xenforo 2-1.webp


Browse to the file you edited, (Listed in File health check results). Example: src/XF.php
Click the SHA256 button
The file's SHA256 code will appear, copy that code

How to fix File health check - Unexpected contents - Xenforo 2-2.webp


Open the file hashes.json (follow the instructions above), find the edited file path, you will see it has the form:
"src/XF.php": "7cb33bbe2a0787980c3b66b85509eaaed9bfe3fa07cd4a6aa74a8da1062c9e5a"
Then replace the old SHA256 code with the new one you copied above

How to fix File health check - Unexpected contents - Xenforo 2-3.webp


Do the same with all the files you edited and get the message Unexpected contents.

How to fix File health check - Unexpected contents - Xenforo 2-4.webp


See details about XenVn add-on at:
https://xenvn.com/threads/xenvn-all-in-one-tools-for-xenforo-2.516/
 
In which folder is this file located?
If it's Xenforo files, the SHA256 code will be declared in: src/addons/XF/hashes.json
If it is an add-on file, it will be declared in the file hashes.json located in the directory of the add-on.
Example: src/addons/NameAddon/hashes.json
 
Open the file hashes.json (follow the instructions above), find the edited file path, you will see it has the form:

"src/XF.php": "7cb33bbe2a0787980c3b66b85509eaaed9bfe3fa07cd4a6aa74a8da1062c9e5a"
Then replace the old SHA256 code with the new one you copied above

"src/XF.php": "7cb33bbe2a0787980c3b66b85509eaaed9bfe3fa07cd4a6aa74a8da1062c9e5a"

The code I "copied" in XF.php SHA255 and the code in the "hashes.json" file are both the same. But I still get error in admin panel :(
 
"src/XF.php": "7cb33bbe2a0787980c3b66b85509eaaed9bfe3fa07cd4a6aa74a8da1062c9e5a"

The code I "copied" in XF.php SHA255 and the code in the "hashes.json" file are both the same. But I still get error in admin panel :(
"src/XF.php": "7cb33bbe2a0787980c3b66b85509eaaed9bfe3fa07cd4a6aa74a8da1062c9e5a"

The code I "copied" in XF.php SHA255 and the code in the "hashes.json" file are both the same. But I still get error in admin panel :(
You must run the file health checker again.
 
Sorry, I understand now...
But by default, styles/XV/no-image.jpg is missing in the "hashes.json" file.
I added it manually but it still gives an error.
I give up, unfortunately it doesn't work. :(
 
Last edited:
Top