The default file admin view for /admin/content/files /admin/content/files/usage/% can't be found after uninstall file_entity module.

The problme occurs on DRUPAL 10.0.7 , basically it ruined the basic file menu/features of Drupal. I was expeccting than upon removal, the original drupal file system will return to its original state. I think this module has a good potential. Thx u

Comments

shenzhuxi created an issue. See original summary.

slashrsm’s picture

Priority: Critical » Normal

File entity provides a view on the same url as core. When file entity is installed core's view get disabled. When file entity is disabled I'd expect core's view to be kept and maybe even re-enabled. However, it is deleted as file_entity gets listed as one of its dependencies. I am not sure why that happens and didn't have time to dig into it.

This is not critical as there are ways to re-import core's view if needed.

f2t’s picture

I have the same issue.

mahfuznz’s picture

Hi,

This happened to me as well. How can I re-install core's files view?

Many thanks,

Mahfuz

marcoscano’s picture

Go to /admin/config/development/configuration/single/import, select "View", then paste there the contents of core/modules/file/config/optional/views.view.files.yml and click "Import"

jacqui.tenderwolf’s picture

Thank you, @marcoscano! FYI in case others find the same, you may need to remove file_entity from the list of module dependencies in the config export yaml (this is why the View gets deleted when uninstalling the module). Then it should import just fine.

jacqui.tenderwolf’s picture

Also, in order for the View to show back up as a tab on the /admin/content page, you'll need to re-enable the View (or edit the configuration yaml by hand before importing... status: true instead of status: false).

kunalkursija’s picture

Confirming - This issue still exists.

brunapimenta’s picture

Status: Active » Needs review
StatusFileSize
new946 bytes

Adding patch to enable core Files view when uninstalling. I also removed the code that disabled core File view from install hook because when the view is disabled, even file_entity's one existing the menu link disappears.

Both views can be enabled, at the end its the file_entity view which will be displayed.

I tested in Drupal core version: 8.8.6 and 8.8.7

brunapimenta’s picture

joseph.olstad’s picture

Assigned: Unassigned » berdir

Thanks!

The uninstall portion of this patch looks correct, not sure about the install change though. Perhaps @Berdir can weigh in on this?

I will assign to Berdir

berdir’s picture

Assigned: berdir » Unassigned
Status: Needs review » Needs work
+++ b/file_entity.install
@@ -118,6 +112,12 @@ function file_entity_uninstall() {
+
+  // Enable the core files view.
+  if ($view = View::load('files');) {
+    $view->set('status', TRUE);
+    $view->save();
+  }
 }

The extra ; here inside the condition causes the php syntax/lint error.

I think the order when both are enable is a bit unpredictable, maybe once the syntax error is fixed the tests will tell us if they are happy or not. If we have explicit tests for that, which I would expect we do, as we test some features on that view.

brunapimenta’s picture

Status: Needs work » Needs review
StatusFileSize
new945 bytes

Oops! My bad, sorry.

Thanks for the review.

New patch added :)

infohome’s picture

Issue summary: View changes

joseph.olstad’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.