32
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-12-27 10:22:38 +00:00

Merge pull request #42 from joomla-extensions/updateScriptEdits

Only execute schema changes on MySQL, PHPCS stuff
This commit is contained in:
javier gomez 2015-05-19 13:30:56 +02:00
commit 9a3c345e05

View File

@ -12,8 +12,6 @@ defined('_JEXEC') or die;
/**
* Installation class to perform additional changes during install/uninstall/update
*
* @package Joomla.Administrator
* @subpackage com_weblinks
* @since 3.4
*/
class Com_WeblinksInstallerScript
@ -70,16 +68,25 @@ class Com_WeblinksInstallerScript
}
/**
* method to run after an install/downloads/uninstall method
* Method to run after the install routine.
*
* @param string $type The action being performed
* @param JInstallerAdapterComponent $parent The class calling this method
*
* @return void
*
* @since 3.4.1
*/
function postflight($type, $parent)
public function postflight($type, $parent)
{
// Only execute database changes on MySQL databases
$dbName = JFactory::getDbo()->name;
if (strpos($dbName, 'mysql') !== false)
{
// Drop the Table Colums if needed
$this->dropColumnsIfNeeded();
}
// Insert missing UCM Records if needed
$this->insertMissingUcmRecords();
@ -92,7 +99,7 @@ class Com_WeblinksInstallerScript
*
* @since 3.4.1
*/
public function insertMissingUcmRecords()
private function insertMissingUcmRecords()
{
// Insert the rows in the #__content_types table if they don't exist already
$db = JFactory::getDbo();
@ -190,7 +197,7 @@ class Com_WeblinksInstallerScript
foreach ($columns as $column)
{
$sql = 'ALTER TABLE ' . $db->qn('#__weblinks') . ' DROP COLUMN ' . $db->qn($column);
$sql = 'ALTER TABLE ' . $db->quoteName('#__weblinks') . ' DROP COLUMN ' . $db->quoteName($column);
$db->setQuery($sql);
$db->execute();
}