Skip to content

Commit

Permalink
Merge pull request #1 from dlobo/CRM-12096
Browse files Browse the repository at this point in the history
fix CRM-12096
  • Loading branch information
kurund committed Mar 13, 2013
2 parents debf821 + f8f23ad commit 6eb2fed
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
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

0 comments on commit 6eb2fed

Please sign in to comment.