Example #1
0
 /**
  * Try to uninstall Akeeba Strapper
  *
  * @param   JInstallerAdapterPackage  $parent
  */
 private function uninstallStrapper($parent)
 {
     $tmpInstaller = new JInstaller();
     $db = $parent->getParent()->getDbo();
     $query = $db->getQuery(true)->select('extension_id')->from('#__extensions')->where('type = ' . $db->quote('file'))->where('element = ' . $db->quote('file_strapper30'));
     $db->setQuery($query);
     $id = $db->loadResult();
     if (!$id) {
         return;
     }
     try {
         $tmpInstaller->uninstall('file', $id, 0);
     } catch (\Exception $e) {
         // We can expect the uninstallation to fail if there are other extensions depending on the Akeeba Strapper
         // package.
     }
 }
Example #2
0
 /**
  * Try to uninstall the FOF library. We don't go through the Joomla! package uninstallation since we can expect the
  * uninstallation of the FOF library to fail if other software depends on it.
  *
  * @param   JInstallerAdapterPackage  $parent
  */
 private function uninstallFOF($parent)
 {
     // Check dependencies on FOF
     $dependencyCount = count($this->getDependencies('fof30'));
     if ($dependencyCount) {
         $msg = "<p>You have {$dependencyCount} extension(s) depending on this version of FOF. The package cannot be uninstalled unless these extensions are uninstalled first.</p>";
         JLog::add($msg, JLog::WARNING, 'jerror');
         return;
     }
     $tmpInstaller = new JInstaller();
     $db = $parent->getParent()->getDbo();
     $query = $db->getQuery(true)->select('extension_id')->from('#__extensions')->where('type = ' . $db->quote('library'))->where('element = ' . $db->quote('lib_fof30'));
     $db->setQuery($query);
     $id = $db->loadResult();
     if (!$id) {
         return;
     }
     try {
         $tmpInstaller->uninstall('library', $id, 0);
     } catch (\Exception $e) {
         // We can expect the uninstallation to fail if there are other extensions depending on the FOF library.
     }
 }