本文整理匯總了PHP中JInstaller::getError方法的典型用法代碼示例。如果您正苦於以下問題:PHP JInstaller::getError方法的具體用法?PHP JInstaller::getError怎麽用?PHP JInstaller::getError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JInstaller
的用法示例。
在下文中一共展示了JInstaller::getError方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: onExtensionAfterUpdate
/**
* After update of an extension.
*
* @param JInstaller $installer Installer object
* @param integer $eid Extension identifier
*/
public function onExtensionAfterUpdate($installer, $eid)
{
$msg = '';
$msg .= $eid === false ? 'Failed extension update: ' . $installer->getError() : 'Extension update successful';
$msg .= $eid ? ' with updated extension ID ' . $eid : ' with no extension ID detected or multiple extension IDs assigned';
JLog::add($msg, JLog::INFO, __METHOD__);
}
示例2: postflight
public function postflight()
{
/* Install plugin */
$plg = JPATH_SITE . '/administrator/components/com_redform/plugins/content/redform';
$db = JFactory::getDbo();
$installer = new JInstaller();
if ($installer->install($plg)) {
// autopublish the plugin
$query = ' UPDATE #__extensions SET enabled = 1 WHERE folder = ' . $db->Quote('content') . ' AND element = ' . $db->Quote('redform');
$db->setQuery($query);
if ($db->query()) {
echo JText::_('COM_REDFORM_Succesfully_installed_redform_content_plugin') . '<br />';
} else {
echo JText::_('COM_REDFORM_Error_publishing_redform_content_plugin') . '<br />';
}
} else {
echo JText::_('COM_REDFORM_Plugin_install_failed') . $installer->getError() . '<br />';
}
}
示例3: postflight
/**
* method to run after an install/update/uninstall method
*
* @return void
*/
public function postflight($type, $parent)
{
/* Install redform plugin */
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
$db =& JFactory::getDBO();
JFolder::copy(JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_redevent' . DS . 'extras' . DS . 'redform', JPATH_SITE . DS . 'tmp' . DS . 'redform_redevent', '', true);
$installer = new JInstaller();
$installer->setAdapter('plugin');
if (!$installer->install(JPATH_SITE . DS . 'tmp' . DS . 'redform_redevent')) {
echo JText::_('COM_REDEVENT_Plugin_install_failed') . $installer->getError() . '<br />';
} else {
// autopublish the plugin
$query = ' UPDATE #__extensions SET enabled = 1 WHERE folder = ' . $db->Quote('redform_integration') . ' AND element = ' . $db->Quote('redevent');
$db->setQuery($query);
if ($db->query()) {
echo JText::_('COM_REDEVENT_Succesfully_installed_redform_integration_plugin') . '<br />';
} else {
echo JText::_('COM_REDEVENT_Error_publishing_redform_integration_plugin') . '<br />';
}
}
}
示例4: uninstallExtension
/**
* Attempts to uninstall the specified extension
*
* @param array $pkg the paket package information
* @return Boolean True if successful, false otherwise
*/
function uninstallExtension($package)
{
//Get an installer instance, always get a new one
$installer = new JInstaller();
//attemp to load the manifest file
$file = $this->findManifest($package);
//check to see if the manifest was found
if (isset($file)) {
// Is it a valid joomla installation manifest file?
$manifest = $installer->_isManifest($file);
if (!is_null($manifest)) {
// If the root method attribute is set to upgrade, allow file overwrite
$root = $manifest->document;
if ($root->attributes('method') == 'upgrade') {
$installer->_overwrite = true;
}
// Set the manifest object and path
$installer->_manifest = $manifest;
$installer->setPath('manifest', $file);
// Set the installation source path to that of the manifest file
$installer->setPath('source', dirname($file));
}
} else {
$this->setError(JText::_('COM_TIENDA_UNABLE_TO_LOCATE_MANIFEST_FILE'));
return false;
}
//check if the extension is installed already and if so uninstall it
//$manifestInformation = $this->paketItemToManifest($package);
$manifestInformation = $package;
$elementID = $this->checkIfInstalledAlready($manifestInformation);
if (!empty($elementID)) {
$clientid = 0;
if ($package['client'] == 'administrator') {
$clientid = '1';
}
//uninstall the extension using the joomla uninstaller
if ($installer->uninstall($manifestInformation["type"], $elementID, $clientid)) {
$this->setError(JText::_('COM_TIENDA_ELEMENT_UNINSTALLED'));
return true;
} else {
$this->setError(JText::_('COM_TIENDA_ELEMENT_UNINSTALL_FAILED') . " :: " . $installer->getError());
return false;
}
}
$this->setError(JText::_('COM_TIENDA_ELEMENT_NOT_UNINSTALLED'));
return false;
}