XF 2.2 Add-on delete files button

FoxSecrets

Active member
I am building an add-on but the "delete files" button is not shown after uninstalling.

Am I missing something?


1689354097741.webp
 
The directory the addon is in must be writeable (if the web server doesn't have permissions to write to that directory, it also can't delete files from there). Other things to check that would prevent an addon from being deleted from the admin area:
  • If the addon doesn't have a hashes.json file
  • If the addon directory is empty
Since it's an addon you are building, my guess is the part about the hashes.json since that's generated when you do a build-release and install the addon.
 
I am building in docker and created using cli "create".

The directories are writable. Here are all permission, should be all 777?

Directories are 777
Setup and addon.json 333
Files in _data 344
 
It's generated when you build the release... with CLI it's the php cmd.php xf-addon:build-release command (it includes it with the installable archive). It's a hash of every file in your addon and that hash changes anytime a file is edited, so it wouldn't make sense to generate that on addon creation (before there are any files).

Not entirely sure what the logic is with it being required in order to delete the addon (maybe to prevent people from accidentally deleting the original addon that was built there [not installed]). Either way, if you want the hashes.json file, you need to install the addon from the install zip archive (not just create an addon).
 
Well, checked now inside the zip folder, the hashes file is inside it.
I am testing installation using the zip anyway, but still do not show delete files button.
Any other suggestion?
 
If the hashes.json file isn't in the root directory of your addon for whatever reason (the same directory that the addon.json file is in), the option to delete it from the admin control panel won't be presented to you (it doesn't matter if it exists in a zip file).
 
The hashes.json is present in addon directory after installation from zip file, so it should show the delete option, right? But still can't see.

View attachment 288559
It's one of a few things... depending on the "user" your web server is running as, maybe it doesn't have permissions to delete that directory since it looks like permissions are 0644 for some things in there. Without knowing the web server "user", you could make the directory and everything in it 777 as a test (then any user can delete it). If you installed the addon manually (uploading the files) and didn't install it from the admin control panel, it's probably a permission issue (if you install it as the web server "user", you should be able to uninstall it too).

Just out of curiosity, why are you trying to delete it from the admin control panel anyway? If you are just trying to test it, test it fully as an end user... delete the whole directory, then install it from the archive from the admin control panel (creating an addon manually and copying individual files yourself is different than what a user would be doing).
 
I'm building with the process from XF documentation, no mentions about permission. That's my first add-on by the way, I think would be automatic after releasing it. The releases are being generated from docker with root user. Would docker be an issue?

The problem should not be on server-side. If you check my first message, you'll see that other addons I can delete. Jus the one I'm building I can't.

PS: As I am doing for general public, it must be user-friendly, this is why I need delete button.

1689358654287.png
 
Last edited:
Well, I doubt your web server is running as the root user. To delete from the web interface, you are limited to the permissions of the web server, not the server's root user. Would be a disaster if the web server had root user permissions.

Again... if you are trying to delete it as a user, install it from scratch as a user would (from the web interface). If you install it as the root user from the shell, that's how you need to delete it too.

The web server does not run as the server's root user. The ability to delete from web interface is based on the permissions of the web server (since that's the "user" that would be deleting the files).
 
Top Bottom