Skip to content
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
1ceec68
Change Model / tmpl
NunoLopesPT Jun 27, 2017
3ca6ba7
first look / working of database fix for 3rd party extensions
NunoLopesPT Jul 3, 2017
0b447a1
pull from master
NunoLopesPT Jul 3, 2017
10d11de
phpcs
NunoLopesPT Jul 3, 2017
87d0a13
phpcs
NunoLopesPT Jul 3, 2017
9b0e728
phpcs
NunoLopesPT Jul 3, 2017
399da44
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into f…
NunoLopesPT Jul 3, 2017
36b3f1e
translate problems
NunoLopesPT Jul 3, 2017
4e4ff12
Language bugs fixed / individual alert for core / 3rd
NunoLopesPT Jul 4, 2017
27e28dd
wrong code
NunoLopesPT Jul 4, 2017
b8e364e
info message when no 3rd party extension databases are outdated
NunoLopesPT Jul 4, 2017
a021ad4
Clean code on the feature / filters added
NunoLopesPT Jul 7, 2017
20b4ec6
Codestyle
NunoLopesPT Jul 7, 2017
ad94d0e
Factory to \JFactory and Codestyle
NunoLopesPT Jul 8, 2017
7611b5e
mismatch ?>
NunoLopesPT Jul 17, 2017
a8b2517
Merge branch 'master' of https://github.com/joomla-projects/gsoc17_ex…
NunoLopesPT Jul 24, 2017
8cac2b6
Merge branch 'fix_database' of https://github.com/NunoLopes96/gsoc17_…
NunoLopesPT Jul 24, 2017
2ec2309
Merge branch 'master' of https://github.com/joomla-projects/gsoc17_ex…
NunoLopesPT Jul 25, 2017
709cdd7
Merge branch 'master' of https://github.com/NunoLopes96/gsoc17_expand…
NunoLopesPT Jul 25, 2017
bdf909c
Bug fix
NunoLopesPT Jul 26, 2017
a2a3960
Merge branch 'master' of https://github.com/NunoLopes96/gsoc17_expand…
NunoLopesPT Jul 27, 2017
d291c39
Merge branch 'fix_database' of https://github.com/joomla-projects/gso…
NunoLopesPT Jul 27, 2017
5e0bbb7
Cache added to database
NunoLopesPT Jul 27, 2017
73fb78f
Merge branch 'fix_database' of https://github.com/NunoLopes96/gsoc17_…
NunoLopesPT Jul 27, 2017
117f5c5
Codestyle
NunoLopesPT Jul 27, 2017
32b5e21
Rework feature: Cache added, new view with information
NunoLopesPT Jul 30, 2017
b7ec345
Bug fix / Cache desactivate to review filters
NunoLopesPT Jul 30, 2017
2340573
Check this reorganization
anibalsanchez Aug 1, 2017
91ef506
Bug on session
NunoLopesPT Aug 1, 2017
7e50ed8
More tweaks to the cache
anibalsanchez Aug 1, 2017
df27ad3
filters
NunoLopesPT Aug 1, 2017
66781fe
Fix Database for Extensions v2.0
NunoLopesPT Aug 2, 2017
e70e9a5
Bug fix
NunoLopesPT Aug 2, 2017
ae235a3
phpcs
NunoLopesPT Aug 2, 2017
2ffbcc5
phpcs
NunoLopesPT Aug 2, 2017
d227bd2
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into f…
NunoLopesPT Aug 14, 2017
c38f450
code style
NunoLopesPT Aug 14, 2017
4cde55e
CodeStyle
NunoLopesPT Aug 15, 2017
60b47ef
Merge branch '4.0-dev' into fix_database
roland-d May 21, 2018
3b1ac9d
Resolve conflicts and code cleanup using namespaces
roland-d May 21, 2018
10f3529
Merge branch '4.0-dev' into fix_database
roland-d May 21, 2018
f3371f2
Code cleanup
roland-d May 21, 2018
9c94a72
Further code cleanup
roland-d May 21, 2018
60a1549
Merge branch '4.0-dev' into fix_database
roland-d May 21, 2018
2cf5082
Codestyle
roland-d May 21, 2018
d461724
Merge remote-tracking branch 'origin/fix_database' into fix_database
roland-d May 21, 2018
bfeec71
Merge branch '4.0-dev' into fix_database
laoneo May 23, 2018
19ae179
Code cleanup
roland-d May 24, 2018
ab13733
Merge remote-tracking branch 'origin/fix_database' into fix_database
roland-d May 24, 2018
c74add1
Spaced out
roland-d May 24, 2018
38aa62a
Merge branch '4.0-dev' into fix_database
roland-d May 27, 2018
191d23c
Merge branch '4.0-dev' into fix_database
roland-d May 28, 2018
6f5134a
Removed session usage
roland-d Jun 3, 2018
8284d69
Merge branch '4.0-dev' into fix_database
roland-d Jun 3, 2018
f50772b
Fixed codestyle
roland-d Jun 3, 2018
56f54b8
Merge branch '4.0-dev' into fix_database
roland-d Jun 3, 2018
4c0c58a
Merge branch '4.0-dev' into fix_database
laoneo Jun 9, 2018
cb6f5e6
Update default.php
laoneo Jun 9, 2018
763d0f2
Code cleanup after review
roland-d Jun 10, 2018
4baaf00
Merge remote-tracking branch 'origin/fix_database' into fix_database
roland-d Jun 10, 2018
d1f2389
Query cleanup
roland-d Jun 10, 2018
b7a36ca
Code cleanup after review
roland-d Jun 10, 2018
4b9193b
Use the status filter
roland-d Jun 10, 2018
90d3d8f
Code Calisthenics
roland-d Jun 10, 2018
201ca32
Fixed indentation
roland-d Jun 10, 2018
865b95c
Further code cleanup
roland-d Jun 11, 2018
72a7922
Another round of cleanups
roland-d Jun 12, 2018
d9723d9
Merge branch '4.0-dev' into fix_database
roland-d Jun 12, 2018
f06aa54
Remove obsolete status filter
roland-d Jun 12, 2018
1cb6e6d
Merge remote-tracking branch 'origin/fix_database' into fix_database
roland-d Jun 12, 2018
67202d3
Apply same styling as the Extension Manage page
roland-d Jun 12, 2018
10e70eb
Change name header
roland-d Jun 12, 2018
4fa0e85
Fixed search by ID
roland-d Jun 12, 2018
2be8238
Code cleanup
roland-d Jun 13, 2018
552ee27
Further code cleanup
roland-d Jun 13, 2018
f04645a
Merge branch '4.0-dev' into fix_database
roland-d Jun 14, 2018
f177f40
Space out
roland-d Jun 14, 2018
8535cda
Back to 3 spaces
roland-d Jun 14, 2018
027d3ef
Merge branch '4.0-dev' into fix_database
roland-d Jun 14, 2018
3bb921f
More space
roland-d Jun 14, 2018
b824fd4
Merge branch '4.0-dev' into fix_database
roland-d Jun 15, 2018
ac08f40
Line up wording
roland-d Jun 15, 2018
2de1baa
Restore lost language string
roland-d Jun 15, 2018
1f3858f
One more space, yeah right
roland-d Jun 15, 2018
71de8fa
Merge branch '4.0-dev' into fix_database
laoneo Jun 16, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\Component\Installer\Administrator\Model\DatabaseModel;
use Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel;

/**
Expand All @@ -25,21 +29,41 @@ class DatabaseController extends BaseController
*
* @return void
*
* @throws \Exception
*
* @since 2.5
* @todo Purge updates has to be replaced with an events system
*/
public function fix()
{
/* @var \Joomla\Component\Installer\Administrator\Model\DatabaseModel $model */
$model = $this->getModel('database');
$model->fix();
// Check for request forgeries
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));

// Get items to fix the database.
$cid = $this->input->get('cid', array(), 'array');

if (!is_array($cid) || count($cid) < 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this here still work when no extension is selected?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@laoneo If no extension is selected, you get a popup in the backend saying you must make a selection.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also when I just want to fix Joomla?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes
image

Joomla is just another option in the list.

{
$this->app->getLogger()->warning(
Text::_(
'COM_INSTALLER_ERROR_NO_EXTENSIONS_SELECTED'
), array('category' => 'jerror')
);
}
else
{
// Get the model
/** @var DatabaseModel $model */
$model = $this->getModel('database');
$model->fix($cid);

$updateModel = new UpdateModel;
$updateModel->purge();
$updateModel = new UpdateModel;
$updateModel->purge();

// Refresh versionable assets cache
$this->app->flushAssets();
// Refresh versionable assets cache
$this->app->flushAssets();
}

$this->setRedirect(\JRoute::_('index.php?option=com_installer&view=database', false));
$this->setRedirect(Route::_('index.php?option=com_installer&view=database', false));
}
}
91 changes: 70 additions & 21 deletions administrator/components/com_installer/Helper/InstallerHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move lines 11-13 after defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

/**
* Installer helper.
*
Expand All @@ -23,46 +27,48 @@ class InstallerHelper
* @param string $vName The name of the active view.
*
* @return void
*
* @since 1.6
*/
public static function addSubmenu($vName = 'install')
{
\JHtmlSidebar::addEntry(
\JText::_('COM_INSTALLER_SUBMENU_INSTALL'),
Text::_('COM_INSTALLER_SUBMENU_INSTALL'),
'index.php?option=com_installer',
$vName == 'install'
);
\JHtmlSidebar::addEntry(
\JText::_('COM_INSTALLER_SUBMENU_UPDATE'),
Text::_('COM_INSTALLER_SUBMENU_UPDATE'),
'index.php?option=com_installer&view=update',
$vName == 'update'
);
\JHtmlSidebar::addEntry(
\JText::_('COM_INSTALLER_SUBMENU_MANAGE'),
Text::_('COM_INSTALLER_SUBMENU_MANAGE'),
'index.php?option=com_installer&view=manage',
$vName == 'manage'
);
\JHtmlSidebar::addEntry(
\JText::_('COM_INSTALLER_SUBMENU_DISCOVER'),
Text::_('COM_INSTALLER_SUBMENU_DISCOVER'),
'index.php?option=com_installer&view=discover',
$vName == 'discover'
);
\JHtmlSidebar::addEntry(
\JText::_('COM_INSTALLER_SUBMENU_DATABASE'),
Text::_('COM_INSTALLER_SUBMENU_DATABASE'),
'index.php?option=com_installer&view=database',
$vName == 'database'
);
\JHtmlSidebar::addEntry(
\JText::_('COM_INSTALLER_SUBMENU_WARNINGS'),
Text::_('COM_INSTALLER_SUBMENU_WARNINGS'),
'index.php?option=com_installer&view=warnings',
$vName == 'warnings'
);
\JHtmlSidebar::addEntry(
\JText::_('COM_INSTALLER_SUBMENU_LANGUAGES'),
Text::_('COM_INSTALLER_SUBMENU_LANGUAGES'),
'index.php?option=com_installer&view=languages',
$vName == 'languages'
);
\JHtmlSidebar::addEntry(
\JText::_('COM_INSTALLER_SUBMENU_UPDATESITES'),
Text::_('COM_INSTALLER_SUBMENU_UPDATESITES'),
'index.php?option=com_installer&view=updatesites',
$vName == 'updatesites'
);
Expand All @@ -88,7 +94,7 @@ public static function getExtensionTypes()

foreach ($types as $type)
{
$options[] = \JHtml::_('select.option', $type, \JText::_('COM_INSTALLER_TYPE_' . strtoupper($type)));
$options[] = HTMLHelper::_('select.option', $type, Text::_('COM_INSTALLER_TYPE_' . strtoupper($type)));
}

return $options;
Expand All @@ -103,20 +109,20 @@ public static function getExtensionTypes()
*/
public static function getExtensionGroupes()
{
$db = \JFactory::getDbo();
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('DISTINCT folder')
->from('#__extensions')
->where('folder != ' . $db->quote(''))
->order('folder');
->select('DISTINCT ' . $db->quoteName('folder'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('folder') . ' != ' . $db->quote(''))
->order($db->quoteName('folder'));
$db->setQuery($query);
$folders = $db->loadColumn();

$options = array();

foreach ($folders as $folder)
{
$options[] = \JHtml::_('select.option', $folder, $folder);
$options[] = HTMLHelper::_('select.option', $folder, $folder);
}

return $options;
Expand All @@ -133,8 +139,8 @@ public static function getClientOptions()
{
// Build the filter options.
$options = array();
$options[] = \JHtml::_('select.option', '0', \JText::_('JSITE'));
$options[] = \JHtml::_('select.option', '1', \JText::_('JADMINISTRATOR'));
$options[] = HTMLHelper::_('select.option', '0', Text::_('JSITE'));
$options[] = HTMLHelper::_('select.option', '1', Text::_('JADMINISTRATOR'));

return $options;
}
Expand All @@ -150,11 +156,54 @@ public static function getStateOptions()
{
// Build the filter options.
$options = array();
$options[] = \JHtml::_('select.option', '0', \JText::_('JDISABLED'));
$options[] = \JHtml::_('select.option', '1', \JText::_('JENABLED'));
$options[] = \JHtml::_('select.option', '2', \JText::_('JPROTECTED'));
$options[] = \JHtml::_('select.option', '3', \JText::_('JUNPROTECTED'));
$options[] = HTMLHelper::_('select.option', '0', Text::_('JDISABLED'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need Status filter?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think so. It is used in the list filter. Why do you think we don't need it?

Copy link
Contributor

@Quy Quy Jun 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I filtered on Protected and Joomla! Patch Tester appears on the list. So I assume it has no effect.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, I see the filter was there but it wasn't applied in the query. That has been fixed now.

$options[] = HTMLHelper::_('select.option', '1', Text::_('JENABLED'));
$options[] = HTMLHelper::_('select.option', '2', Text::_('JPROTECTED'));
$options[] = HTMLHelper::_('select.option', '3', Text::_('JUNPROTECTED'));

return $options;
}

/**
* Get a list of filter options for the application statuses.
*
* @param string $element element of an extension
* @param string $type type of an extension
* @param integer $client_id client_id of an extension
* @param string $folder folder of an extension
*
* @return \SimpleXMLElement
*
* @since __DEPLOY_VERSION__
*/
public static function getInstallationXML($element, $type, $client_id = 1, $folder = null)
{
$path = $client_id ? JPATH_ADMINISTRATOR : JPATH_ROOT;

switch ($type)
{
case 'component':
$path .= '/components/' . $element . '/' . substr($element, 4) . '.xml';
break;
case 'plugin':
$path .= '/plugins/' . $folder . '/' . $element . '/' . $element . '.xml';
break;
case 'module':
$path .= '/modules/' . $element . '/' . $element->element . '.xml';
break;
case 'template':
$path .= '/templates/' . $element . '/templateDetails.xml';
break;
case 'library':
$path = JPATH_ADMINISTRATOR . '/manifests/libraries/' . $element . '.xml';
break;
case 'file':
$path = JPATH_ADMINISTRATOR . '/manifests/files/' . $element . '.xml';
break;
case 'package':
$path = JPATH_ADMINISTRATOR . '/manifests/packages/' . $element . '.xml';
}

return simplexml_load_file($path);
}
}
Loading