Skip to content

Commit 6eb2fed

Browse files
committed
Merge pull request #1 from dlobo/CRM-12096
fix CRM-12096
2 parents debf821 + f8f23ad commit 6eb2fed

File tree

2 files changed

+31
-11
lines changed

2 files changed

+31
-11
lines changed

admin/configure.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function civicrm_setup() {
3434

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

37-
$jConfig = JFactory::getConfig();
37+
$jConfig = new JConfig();
3838
set_time_limit(4000);
3939

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

7575
global $civicrmUpgrade;
7676
$civicrmUpgrade = ($db->loadResult() == 0) ? FALSE : TRUE;

script.civicrm.php

+29-9
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ function install($parent) {
9090
$installer = new JInstaller();
9191
$plgArray = array();
9292

93+
// Joomla 3.0 no longer supports DS
94+
if (!defined('DS')) {
95+
define('DS', DIRECTORY_SEPARATOR);
96+
}
97+
9398
foreach ($manifest->plugins->plugin as $plugin) {
9499
$attributes = $plugin->attributes();
95100
$plg = $source . DS . $attributes['folder'] . DS . $attributes['plugin'];
@@ -98,18 +103,33 @@ function install($parent) {
98103
}
99104

100105
$db = JFactory::getDbo();
101-
$tableExtensions = $db->nameQuote("#__extensions");
102-
$columnElement = $db->nameQuote("element");
103-
$columnType = $db->nameQuote("type");
104-
$columnEnabled = $db->nameQuote("enabled");
106+
107+
// In joomla 3.0, they decided to change the below name to quoteName
108+
// so we'll do a switch and check which fn name to use
109+
if (method_exists($db, 'nameQuote')) {
110+
$quoteFn = 'nameQuote';
111+
}
112+
else if (method_exists($db, 'quoteName')) {
113+
$quoteFn = 'quoteName';
114+
}
115+
else {
116+
echo "Could not determine name of the quote function in Joomla!";
117+
exit();
118+
}
119+
120+
$tableExtensions = $db->$quoteFn("#__extensions");
121+
$columnElement = $db->$quoteFn("element");
122+
$columnType = $db->$quoteFn("type");
123+
$columnEnabled = $db->$quoteFn("enabled");
105124
$plgList = implode(',', $plgArray);
106125

107126
// Enable plugins
108-
$db->setQuery("UPDATE $tableExtensions
109-
SET $columnEnabled = 1
110-
WHERE $columnElement IN ($plgList)
111-
AND $columnType = 'plugin'"
112-
);
127+
$db->setQuery("
128+
UPDATE $tableExtensions
129+
SET $columnEnabled = 1
130+
WHERE $columnElement IN ($plgList)
131+
AND $columnType = 'plugin'
132+
");
113133
$db->query();
114134

115135
echo $content;

0 commit comments

Comments
 (0)