/** * Shit happens. Patched function to bypass bug in package uninstaller * * @param JInstallerAdapter $parent Parent object * * @return void */ protected function loadManifest($parent) { $element = strtolower(str_replace('InstallerScript', '', get_called_class())); $elementParts = explode('_', $element); // Type not properly detected or not a package if (count($elementParts) != 2 || strtolower($elementParts[0]) != 'pkg') { $this->manifest = $parent->get('manifest'); return; } $rootPath = $parent->getParent()->getPath('extension_root'); $manifestPath = dirname($rootPath); $manifestFile = $manifestPath . '/' . $element . '.xml'; // Package manifest found if (file_exists($manifestFile)) { $this->manifest = JFactory::getXML($manifestFile); return; } $this->manifest = $parent->get('manifest'); }
/** * Install TCPDF * * @param JInstallerAdapter $parent How this was tarted * * @return void * * @since 1.7.0 */ private function _installTCPDF($parent) { $src = $parent->getParent()->getPath('source'); $needUpgrade = false; // Install the TCPDF libraries $source = $src . '/libraries/tcpdf'; $component = $source . '/tcpdf.xml'; if (file_exists($component)) { $this->srcxml = simplexml_load_file($component); } if (!defined('JPATH_LIBRARIES')) { $target = JPATH_ROOT . '/libraries/tcpdf'; } else { $target = JPATH_LIBRARIES . '/tcpdf'; } $haveToInstallTCPDF = false; if (!JFolder::exists($target)) { $component = $target . '/tcpdf.xml'; if (file_exists($component)) { $this->xml = simplexml_load_file($component); } $this->tcpdf_version = $this->xml->version; $this->tcpdf_result = 'Installed'; $haveToInstallTCPDF = true; } else { $component = $target . '/tcpdf.xml'; if (file_exists($component)) { $this->xml = simplexml_load_file($component); } $needUpgrade = version_compare($this->srcxml->version, $this->xml->version, '>'); if ($needUpgrade) { $this->tcpdf_result = 'Upgrade'; } else { $this->tcpdf_result = 'No Change'; } } if ($haveToInstallTCPDF || $needUpgrade) { $installer = new JInstaller(); $installer->install($source); } $this->status->libraries[] = ['name' => 'TCPDF', 'Version' => $this->tcpdf_version, 'result' => $this->tcpdf_result]; return; }