mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-09-28 21:19:07 +00:00
Update script.php
This commit is contained in:
parent
fcbeb48a49
commit
68a8d4bf86
@ -85,25 +85,21 @@ class Com_WeblinksInstallerScript
|
|||||||
'3' => 'approved',
|
'3' => 'approved',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach $tasks as $column)
|
|
||||||
{
|
|
||||||
$db = JFactory::getDbo();
|
$db = JFactory::getDbo();
|
||||||
$query = $db->getQuery(true);
|
$table = $db->getTableColumns('#__weblinks');
|
||||||
|
|
||||||
$query->select(*);
|
foreach ($tasks as $column)
|
||||||
$query->from($db->quoteName('information_schema.columns'));
|
|
||||||
$query->where($db->quoteName('table_name') . ' = '. $db->quote('#__weblinks'));
|
|
||||||
$query->where($db->quoteName('column_name') . ' = '. $db->quote($column));
|
|
||||||
|
|
||||||
$numrows = $query->getNumRows();
|
|
||||||
$db->clean();
|
|
||||||
|
|
||||||
if ($numrows != 0)
|
|
||||||
{
|
{
|
||||||
$sql = "ALTER TABLE `#__weblinks` DROP COLUMN `' . $column . '`";
|
foreach ($table as $columName => $columType)
|
||||||
|
{
|
||||||
|
if ($columName == $column)
|
||||||
|
{
|
||||||
|
$sql = "ALTER TABLE `#__weblinks` DROP COLUMN `" . $column . "`";
|
||||||
|
$db->clean();
|
||||||
$db->setQuery($sql);
|
$db->setQuery($sql);
|
||||||
$db->execute();
|
$db->execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user