Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix CRM-12096 #1

Merged
merged 1 commit into from
Mar 13, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions admin/configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function civicrm_setup() {

$adminPath = JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_civicrm';

$jConfig = JFactory::getConfig();
$jConfig = new JConfig();
set_time_limit(4000);

// Path to the archive
Expand Down Expand Up @@ -70,7 +70,7 @@ function civicrm_setup() {
$db->setQuery(' SELECT count( * )
FROM information_schema.tables
WHERE table_name LIKE "civicrm_domain"
AND table_schema = "' . $jConfig->getValue('config.db') . '" ');
AND table_schema = "' . $jConfig->db . '" ');

global $civicrmUpgrade;
$civicrmUpgrade = ($db->loadResult() == 0) ? FALSE : TRUE;
Expand Down
38 changes: 29 additions & 9 deletions script.civicrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ function install($parent) {
$installer = new JInstaller();
$plgArray = array();

// Joomla 3.0 no longer supports DS
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}

foreach ($manifest->plugins->plugin as $plugin) {
$attributes = $plugin->attributes();
$plg = $source . DS . $attributes['folder'] . DS . $attributes['plugin'];
Expand All @@ -98,18 +103,33 @@ function install($parent) {
}

$db = JFactory::getDbo();
$tableExtensions = $db->nameQuote("#__extensions");
$columnElement = $db->nameQuote("element");
$columnType = $db->nameQuote("type");
$columnEnabled = $db->nameQuote("enabled");

// In joomla 3.0, they decided to change the below name to quoteName
// so we'll do a switch and check which fn name to use
if (method_exists($db, 'nameQuote')) {
$quoteFn = 'nameQuote';
}
else if (method_exists($db, 'quoteName')) {
$quoteFn = 'quoteName';
}
else {
echo "Could not determine name of the quote function in Joomla!";
exit();
}

$tableExtensions = $db->$quoteFn("#__extensions");
$columnElement = $db->$quoteFn("element");
$columnType = $db->$quoteFn("type");
$columnEnabled = $db->$quoteFn("enabled");
$plgList = implode(',', $plgArray);

// Enable plugins
$db->setQuery("UPDATE $tableExtensions
SET $columnEnabled = 1
WHERE $columnElement IN ($plgList)
AND $columnType = 'plugin'"
);
$db->setQuery("
UPDATE $tableExtensions
SET $columnEnabled = 1
WHERE $columnElement IN ($plgList)
AND $columnType = 'plugin'
");
$db->query();

echo $content;
Expand Down