XF 2.0 Why isn't hashes.json written to filesystem?

Sim

Well-known member
I use an automated deployment tool to push updates for my addons out to my staging and production servers directly from Git.

However, the new hashes.json file generated for addons in XF2 is not written to the filesystem and is only found in the build release zip file.

So my deployed addons won't contain a hashes.json because they weren't deployed from the zip file.

As such, file health checks won't do anything for my addons because no hashes.json is found and so I believe it skips the checks.

Shouldn't the hashes.json file be written to the filesystem when generated so we can get some benefit from it? I guess the issue then is that it will start to generate errors on the dev server if it is not deleted before files are modified for new coding.

Or perhaps a new CLI command to generate hashes.json which can be run as part of the deployment process so we can get a hashes.json on the staging/production servers even if not on the dev server?
 
I'd be in support for a new CLI command, but if needs be you can manually generate the file by looping through your files and their contents and using $hash = hash('sha256', str_replace("\r", '', $file));


Fillip
 
I guess the issue then is that it will start to generate errors on the dev server if it is not deleted before files are modified for new coding.
Basically this reason.

I'd be in support for a new CLI command, but if needs be you can manually generate the file by looping through your files and their contents and using $hash = hash('sha256', str_replace("\r", '', $file));


Fillip
There's a HashGenerator service, so tbh I'd just call that.

From the ReleaseBuilder service:
PHP:
$ds = DIRECTORY_SEPARATOR;

/** @var HashGenerator $hashGenerator */
$hashGenerator = $this->service(
    'XF:AddOn\HashGenerator', $this->addOn, $this->uploadRoot, $this->addOnBase . $ds . 'hashes.json'
);

$output = $hashGenerator->generate();
 
Top Bottom