Unable to uninstall #865

Closed
opened 2022-02-07 11:30:11 +00:00 by Polm90 · 2 comments
Polm90 commented 2022-02-07 11:30:11 +00:00 (Migrated from github.com)

Steps to reproduce the issue

I have a component with a custom user field and a custom field.
Try to uninstall it.

Expected result

The component uninstalls without errors

Actual result

When I try to uninstall it, it fails with error "Unable to setQuery of null".

System information (as much as possible)

  • OS Name & Version: Windows 11
  • MySql Version: 8.0.23
  • Apache Version: 2.4.52
  • PHP Version: 8.0
  • Joomla Version: 3.10.5
  • JCB Version: 2.12.5
  • Browser: FF last version

Additional comments

In the file administrator/components/com_<component_name>/script.php, in the method unistall 2 lines are missing:

$db = JFactory::getDbo();
$app = JFactory::getApplication('administrator');

### Steps to reproduce the issue I have a component with a custom user field and a custom field. Try to uninstall it. ### Expected result The component uninstalls without errors ### Actual result When I try to uninstall it, it fails with error "Unable to setQuery of null". ### System information (as much as possible) - OS Name & Version: Windows 11 - MySql Version: 8.0.23 - Apache Version: 2.4.52 - PHP Version: 8.0 - Joomla Version: 3.10.5 - JCB Version: 2.12.5 - Browser: FF last version ### Additional comments In the file administrator/components/com_<component_name>/script.php, in the method unistall 2 lines are missing: $db = JFactory::getDbo(); $app = JFactory::getApplication('administrator');

All lone numbers are from this file: https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/admin/helpers/compiler/e_Interpretation.php (I used this link since gitHub can't show large files)

Okay on line 7975 and 8016 we add $db = JFactory::getDbo() to the install, unless you have custom install, since then its added on line 7876.

For uninstall we add this on line 8119 and 8123 if the uninstall script builder has values, in your case it should. Since $this->uninstallScriptBuilder value is build with we have joomla_fields on line 23755

So do me a favor and check the values in $this->uninstallScriptBuilder on line 8108 with the following code:

echo '<pre>';
var_dump($this->uninstallScriptBuilder);
exit;

Run the compiler and you should see the output in the browser... remove the code again.

Should you find that it is empty... then check the values of $view['joomla_fields'] at line 23726 again in the following way:

echo '<pre>';
var_dump($view['joomla_fields']);
exit;

You should again run compile and get the dump values in the browser... you may want to target the view like this, to look at the right view at that moment:

if ($nameSingleCode === 'yoursingleviewcodename')
{
	echo '<pre>';
	var_dump($view['joomla_fields']);
	exit;
}

Again once you have the values post them here, and remove the code. These code snippets is just to debug and see what caused JCB no to add the code, as it is there and should have been added.

Let the hunt begin.... 👍

All lone numbers are from this file: https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/admin/helpers/compiler/e_Interpretation.php (I used this link since gitHub can't show large files) Okay on line 7975 and 8016 we add `$db = JFactory::getDbo()` to the install, unless you have custom install, since then its added on line 7876. For uninstall we add this on line 8119 and 8123 if the uninstall script builder has values, in your case it should. Since `$this->uninstallScriptBuilder` value is build with we have joomla_fields on line 23755 So do me a favor and check the values in `$this->uninstallScriptBuilder` on line 8108 with the following code: ``` echo '<pre>'; var_dump($this->uninstallScriptBuilder); exit; ``` Run the compiler and you should see the output in the browser... remove the code again. Should you find that it is empty... then check the values of `$view['joomla_fields']` at line 23726 again in the following way: ``` echo '<pre>'; var_dump($view['joomla_fields']); exit; ``` You should again run compile and get the dump values in the browser... you may want to target the view like this, to look at the right view at that moment: ``` if ($nameSingleCode === 'yoursingleviewcodename') { echo '<pre>'; var_dump($view['joomla_fields']); exit; } ``` Again once you have the values post them here, and remove the code. These code snippets is just to debug and see what caused JCB no to add the code, as it is there and should have been added. Let the hunt begin.... :+1:

@Polm90 are you still able to respond here?

@Polm90 are you still able to respond here?
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#865
No description provided.