Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepereiradasilva committed Apr 1, 2016
2 parents 40d4ef4 + 44c28d3 commit 83f1661
Show file tree
Hide file tree
Showing 67 changed files with 1,632 additions and 403 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -22,6 +22,10 @@ matrix:
env: RUN_PHPCS="yes" INSTALL_APCU="yes"
- php: 7.0
env: INSTALL_APCU="yes" INSTALL_APCU_BC_BETA="no" INSTALL_MEMCACHE="no" INSTALL_MEMCACHED="no" INSTALL_REDIS="no" # Disabled apcu_bc install until https://github.com/travis-ci/travis-ci/issues/5207 is resolved
- php: hhvm
env: INSTALL_APCU_BC_BETA="no" INSTALL_MEMCACHE="no" INSTALL_MEMCACHED="no" INSTALL_REDIS="no" # Disabled items that currently do not work in travis-ci hhvm
allow_failures:
- php: hhvm

services:
- memcache
Expand Down
17 changes: 17 additions & 0 deletions administrator/components/com_admin/script.php
Expand Up @@ -38,6 +38,7 @@ public function update($installer)
$this->updateAssets();
$this->clearStatsCache();
$this->convertTablesToUtf8mb4();
$this->cleanJoomlaCache();

// VERY IMPORTANT! THIS METHOD SHOULD BE CALLED LAST, SINCE IT COULD
// LOGOUT ALL THE USERS
Expand Down Expand Up @@ -1853,6 +1854,8 @@ private function serverClaimsUtf8mb4Support($format)
* @param string $query The query to convert
*
* @return string The converted query
*
* @since 3.5
*/
private function convertUtf8mb4QueryToUtf8($query)
{
Expand All @@ -1868,4 +1871,18 @@ private function convertUtf8mb4QueryToUtf8($query)
// Replace utf8mb4 with utf8
return str_replace('utf8mb4', 'utf8', $query);
}

/**
* This method clean the Joomla Cache using the method `clean` from the com_cache model
*
* @return void
*
* @since 3.5.1
*/
private function cleanJoomlaCache()
{
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_cache/models');
$model = JModelLegacy::getInstance('cache', 'CacheModel');
$model->clean();
}
}
Expand Up @@ -20,9 +20,11 @@ ALTER TABLE `#__content_types` DROP KEY `idx_alias`;
ALTER TABLE `#__finder_links` DROP KEY `idx_title`;
ALTER TABLE `#__menu` DROP KEY `idx_alias`;
ALTER TABLE `#__menu` DROP KEY `idx_client_id_parent_id_alias_language`;
ALTER TABLE `#__menu` DROP KEY `idx_path`;
ALTER TABLE `#__redirect_links` DROP KEY `idx_old_url`;
ALTER TABLE `#__tags` DROP KEY `idx_path`;
ALTER TABLE `#__tags` DROP KEY `idx_alias`;
ALTER TABLE `#__ucm_content` DROP KEY `idx_alias`;
ALTER TABLE `#__ucm_content` DROP KEY `idx_title`;
ALTER TABLE `#__ucm_content` DROP KEY `idx_content_type`;
ALTER TABLE `#__users` DROP KEY `idx_name`;
@@ -1,37 +1,31 @@
--
-- Step 2 of the UTF-8 Multibyte (utf8mb4) conversion for MySQL
--
-- Add back indexes previosly dropped with step 1, utf8mb4-conversion-01.sql,
-- but with limited lenghts of columns, and then perform the conversions
-- for utf8mb4.
-- Enlarge some database columns to avoid data losses, then convert all tables
-- to utf8mb4 or utf8, then set default character sets and collations for all
-- tables, then add back indexes previosly dropped with step 1,
-- utf8mb4-conversion-01.sql, but addd them back with limited lenghts of
-- columns.
--
-- Do not rename this file or any other of the utf8mb4-conversion-*.sql
-- files unless you want to change PHP code, too.
--
-- This file here will the be processed with reporting exceptions.
-- IMPORTANT: When adding an index modification to this file for limiting the
-- length by which one or more columns go into that index,
--

-- 1. remember to add the statement to drop the index to the file for step 1,
-- utf8mb4-conversion-01.sql, and
--
-- Step 2.1: Limit indexes to first 100 so their max allowed lengths would not get exceeded with utf8mb4
-- 2. check if the index is created created or modified in some old schema
-- update sql in an "ALTER TABLE" statement and limit the column length
-- there, too ("CREATE TABLE" is ok, no need to modify those).
--
-- This file here will the be processed with reporting exceptions, in opposite
-- to the file for step 1.
--

ALTER TABLE `#__banners` ADD KEY `idx_metakey_prefix` (`metakey_prefix`(100));
ALTER TABLE `#__banner_clients` ADD KEY `idx_metakey_prefix` (`metakey_prefix`(100));
ALTER TABLE `#__categories` ADD KEY `idx_path` (`path`(100));
ALTER TABLE `#__categories` ADD KEY `idx_alias` (`alias`(100));
ALTER TABLE `#__content_types` ADD KEY `idx_alias` (`type_alias`(100));
ALTER TABLE `#__finder_links` ADD KEY `idx_title` (`title`(100));
ALTER TABLE `#__menu` ADD KEY `idx_alias` (`alias`(100));
ALTER TABLE `#__menu` ADD UNIQUE `idx_client_id_parent_id_alias_language` (`client_id`,`parent_id`,`alias`(100),`language`);
ALTER TABLE `#__redirect_links` ADD KEY `idx_old_url` (`old_url`(100));
ALTER TABLE `#__tags` ADD KEY `idx_path` (`path`(100));
ALTER TABLE `#__tags` ADD KEY `idx_alias` (`alias`(100));
ALTER TABLE `#__ucm_content` ADD KEY `idx_alias` (`core_alias`(100));
ALTER TABLE `#__ucm_content` ADD KEY `idx_title` (`core_title`(100));
ALTER TABLE `#__ucm_content` ADD KEY `idx_content_type` (`core_type_alias`(100));

--
-- Step 2.2: Enlarge columns to avoid data loss on later conversion to utf8mb4
-- Step 2.1: Enlarge columns to avoid data loss on later conversion to utf8mb4
--

ALTER TABLE `#__banners` MODIFY `alias` varchar(400) NOT NULL DEFAULT '';
Expand All @@ -49,9 +43,10 @@ ALTER TABLE `#__tags` MODIFY `alias` varchar(400) NOT NULL DEFAULT '';
ALTER TABLE `#__ucm_content` MODIFY `core_type_alias` varchar(400) NOT NULL DEFAULT '' COMMENT 'FK to the content types table';
ALTER TABLE `#__ucm_content` MODIFY `core_title` varchar(400) NOT NULL;
ALTER TABLE `#__ucm_content` MODIFY `core_alias` varchar(400) NOT NULL DEFAULT '';
ALTER TABLE `#__users` MODIFY `name` varchar(400) NOT NULL DEFAULT '';

--
-- Step 2.3: Convert all tables to utf8mb4 chracter set with utf8mb4_unicode_ci collation
-- Step 2.2: Convert all tables to utf8mb4 chracter set with utf8mb4_unicode_ci collation
-- except #__finder_xxx tables, those will have utf8mb4_general_ci collation.
-- Note: The database driver for mysql will change utf8mb4 to utf8 if utf8mb4 is not supported
--
Expand Down Expand Up @@ -126,7 +121,7 @@ ALTER TABLE `#__utf8_conversion` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb
ALTER TABLE `#__viewlevels` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

--
-- Step 2.4: Set collation to utf8mb4_bin for formerly utf8_bin collated columns
-- Step 2.3: Set collation to utf8mb4_bin for formerly utf8_bin collated columns
-- and for the lang_code column of the languages table
--

Expand All @@ -141,7 +136,7 @@ ALTER TABLE `#__tags` MODIFY `alias` varchar(400) CHARACTER SET utf8mb4 COLLATE
ALTER TABLE `#__ucm_content` MODIFY `core_alias` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '';

--
-- Step 2.5: Set default character set and collation for all tables
-- Step 2.4: Set default character set and collation for all tables
--

ALTER TABLE `#__assets` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Expand Down Expand Up @@ -212,3 +207,24 @@ ALTER TABLE `#__user_profiles` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_uni
ALTER TABLE `#__user_usergroup_map` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `#__utf8_conversion` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `#__viewlevels` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

--
-- Step 2.5: Limit indexes to first 100 so their max allowed lengths would not get exceeded with utf8mb4
--

ALTER TABLE `#__banners` ADD KEY `idx_metakey_prefix` (`metakey_prefix`(100));
ALTER TABLE `#__banner_clients` ADD KEY `idx_metakey_prefix` (`metakey_prefix`(100));
ALTER TABLE `#__categories` ADD KEY `idx_path` (`path`(100));
ALTER TABLE `#__categories` ADD KEY `idx_alias` (`alias`(100));
ALTER TABLE `#__content_types` ADD KEY `idx_alias` (`type_alias`(100));
ALTER TABLE `#__finder_links` ADD KEY `idx_title` (`title`(100));
ALTER TABLE `#__menu` ADD KEY `idx_alias` (`alias`(100));
ALTER TABLE `#__menu` ADD UNIQUE `idx_client_id_parent_id_alias_language` (`client_id`,`parent_id`,`alias`(100),`language`);
ALTER TABLE `#__menu` ADD KEY `idx_path` (`path`(100));
ALTER TABLE `#__redirect_links` ADD KEY `idx_old_url` (`old_url`(100));
ALTER TABLE `#__tags` ADD KEY `idx_path` (`path`(100));
ALTER TABLE `#__tags` ADD KEY `idx_alias` (`alias`(100));
ALTER TABLE `#__ucm_content` ADD KEY `idx_alias` (`core_alias`(100));
ALTER TABLE `#__ucm_content` ADD KEY `idx_title` (`core_title`(100));
ALTER TABLE `#__ucm_content` ADD KEY `idx_content_type` (`core_type_alias`(100));
ALTER TABLE `#__users` ADD KEY `idx_name` (`name`(100));
@@ -1,3 +1,8 @@
ALTER TABLE `#__menu` DROP INDEX `idx_client_id_parent_id_alias`;

ALTER TABLE `#__menu` ADD UNIQUE `idx_client_id_parent_id_alias_language` ( `client_id` , `parent_id` , `alias` , `language` );
--
-- The following statment had to be modified for utf8mb4 in Joomla! 3.5.1, changing
-- `alias` to `alias`(100)
--

ALTER TABLE `#__menu` ADD UNIQUE `idx_client_id_parent_id_alias_language` ( `client_id` , `parent_id` , `alias`(100) , `language` );
@@ -1,4 +1,5 @@
UPDATE `#__update_sites` SET `location` = 'https://update.joomla.org/core/list.xml' WHERE `name` = 'Joomla! Core' AND `type` = 'collection';
UPDATE `#__update_sites` SET `location` = 'https://update.joomla.org/jed/list.xml' WHERE `name` = 'Joomla! Extension Directory' AND `type` = 'collection';
UPDATE `#__update_sites` SET `location` = 'https://update.joomla.org/language/translationlist_3.xml' WHERE `name` = 'Accredited Joomla! Translations' AND `type` = 'collection';
UPDATE `#__update_sites` SET `location` = 'https://update.joomla.org/core/extensions/com_joomlaupdate.xml' WHERE `name` = 'Joomla! Update Component Update Site' AND `type` = 'extension';
--
-- Make #__user_keys.user_id fit to #__users.username
--

ALTER TABLE `#__user_keys` MODIFY `user_id` varchar(150) NOT NULL;
@@ -0,0 +1,6 @@
--
-- Reset UTF-8 Multibyte (utf8mb4) or UTF-8 conversion status
-- to force a new conversion when updating from version 3.5.0
--

UPDATE `#__utf8_conversion` SET converted = 0 WHERE (SELECT COUNT(*) FROM `#__extensions` WHERE `extension_id`=700 AND `manifest_cache` LIKE '%"version":"3.5.0"%') = 1;
Expand Up @@ -47,7 +47,7 @@ CREATE TABLE "#__contentitem_tag_map" (
CONSTRAINT "uc_ItemnameTagid" UNIQUE ("type_alias", "content_item_id", "tag_id")
);

CREATE INDEX "#__contentitem_tag_map_idx_tag_name" ON "#__contentitem_tag_map" ("tag_id", "type_alias");
CREATE INDEX "#__contentitem_tag_map_idx_tag_type" ON "#__contentitem_tag_map" ("tag_id", "type_alias");
CREATE INDEX "#__contentitem_tag_map_idx_date_id" ON "#__contentitem_tag_map" ("tag_date", "tag_id");
CREATE INDEX "#__contentitem_tag_map_idx_tag" ON "#__contentitem_tag_map" ("tag_id");
CREATE INDEX "#__contentitem_tag_map_idx_core_content_id" ON "#__contentitem_tag_map" ("core_content_id");
Expand Down
@@ -1,2 +1,2 @@
ALTER TABLE "#__contentitem_tag_map" DROP INDEX "#__contentitem_tag_map_idx_tag";
ALTER TABLE "#__contentitem_tag_map" DROP INDEX "#__contentitem_tag_map_idx_type";
DROP INDEX "#__contentitem_tag_map_idx_tag";
DROP INDEX "#__contentitem_tag_map_idx_type";
@@ -1,5 +1,5 @@
ALTER TABLE "#__redirect_links" DROP CONSTRAINT "#__redirect_links_idx_link_old";
ALTER TABLE "#__redirect_links" ALTER COLUMN "old_url" TYPE varchar(2048);
ALTER TABLE "#__redirect_links" ALTER COLUMN "new_url" TYPE varchar(2048);
ALTER TABLE "#__redirect_links" ALTER COLUMN "referer" TYPE varchar(2048);
ALTER TABLE "#__redirect_links" ALTER COLUMN "old_url" TYPE character varying(2048);
ALTER TABLE "#__redirect_links" ALTER COLUMN "new_url" TYPE character varying(2048);
ALTER TABLE "#__redirect_links" ALTER COLUMN "referer" TYPE character varying(2048);
CREATE INDEX "#__idx_link_old" ON "#__redirect_links" ("old_url");

This file was deleted.

This file was deleted.

10 changes: 5 additions & 5 deletions administrator/components/com_banners/views/banners/view.html.php
Expand Up @@ -111,19 +111,19 @@ protected function addToolbar()

if ($canDo->get('core.edit.state'))
{
if ($this->state->get('filter.state') != 2)
if ($this->state->get('filter.published') != 2)
{
JToolbarHelper::publish('banners.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('banners.unpublish', 'JTOOLBAR_UNPUBLISH', true);
}

if ($this->state->get('filter.state') != -1)
if ($this->state->get('filter.published') != -1)
{
if ($this->state->get('filter.state') != 2)
if ($this->state->get('filter.published') != 2)
{
JToolbarHelper::archiveList('banners.archive');
}
elseif ($this->state->get('filter.state') == 2)
elseif ($this->state->get('filter.published') == 2)
{
JToolbarHelper::unarchiveList('banners.publish');
}
Expand All @@ -149,7 +149,7 @@ protected function addToolbar()
JToolbar::getInstance('toolbar')->appendButton('Custom', $dhtml, 'batch');
}

if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete'))
if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete'))
{
JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'banners.delete', 'JTOOLBAR_EMPTY_TRASH');
}
Expand Down
46 changes: 39 additions & 7 deletions administrator/components/com_categories/models/categories.php
Expand Up @@ -360,16 +360,48 @@ public function getItems()
{
$extension = $this->getState('filter.extension');

// Load Helper file of the component for which com_categories displays the categories
$classname = ucfirst(substr($extension, 4)) . 'Helper';
$this->countItems($items, $extension);
}

return $items;
}

if (class_exists($classname) && method_exists($classname, 'countItems'))
/**
* Method to load the countItems method from the extensions
*
* @param stdClass[] &$items The category items
* @param string $extension The category extension
*
* @return void
*
* @since 3.5
*/
public function countItems(&$items, $extension)
{
$parts = explode('.', $extension);
$component = $parts[0];
$section = null;

if (count($parts) > 1)
{
$section = $parts[1];
}

// Try to find the component helper.
$eName = str_replace('com_', '', $component);
$file = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/helpers/' . $eName . '.php');

if (file_exists($file))
{
require_once $file;

$prefix = ucfirst(str_replace('com_', '', $component));
$cName = $prefix . 'Helper';

if (class_exists($cName) && is_callable(array($cName, 'countItems')))
{
// Get the SQL to extend the com_category $query object with item count (published, unpublished, trashed)
$classname::countItems($items);
call_user_func(array($cName, 'countItems'), $items, $section);
}
}

return $items;
}
}
Expand Up @@ -9,6 +9,8 @@

defined('_JEXEC') or die;

use Joomla\String\Inflector;

// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');

Expand All @@ -24,7 +26,22 @@
$listDirn = $this->escape($this->state->get('list.direction'));
$ordering = ($listOrder == 'a.lft');
$saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc');
$component = $app->input->get('extension');
$parts = explode('.', $extension);
$component = $parts[0];
$section = null;

if (count($parts) > 1)
{
$section = $parts[1];

$inflector = Inflector::getInstance();

if (!$inflector->isPlural($section))
{
$section = $inflector->toPlural($section);
}
}

$columns = 7;

if ($saveOrder)
Expand Down Expand Up @@ -193,25 +210,25 @@
</td>
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_published')) : ?>
<td class="center btns hidden-phone">
<a class="badge <?php if ($item->count_published > 0) echo "badge-success"; ?>" title="<?php echo JText::_('COM_CATEGORY_COUNT_PUBLISHED_ITEMS');?>" href="<?php echo JRoute::_('index.php?option=' . $component . '&filter[category_id]=' . (int) $item->id . '&filter[published]=1' . '&filter[level]=' . (int) $item->level);?>">
<a class="badge <?php if ($item->count_published > 0) echo "badge-success"; ?>" title="<?php echo JText::_('COM_CATEGORY_COUNT_PUBLISHED_ITEMS');?>" href="<?php echo JRoute::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=1' . '&filter[level]=' . (int) $item->level);?>">
<?php echo $item->count_published; ?></a>
</td>
<?php endif;?>
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_unpublished')) : ?>
<td class="center btns hidden-phone">
<a class="badge <?php if ($item->count_unpublished > 0) echo "badge-important"; ?>" title="<?php echo JText::_('COM_CATEGORY_COUNT_UNPUBLISHED_ITEMS');?>" href="<?php echo JRoute::_('index.php?option=' . $component . '&filter[category_id]=' . (int) $item->id . '&filter[published]=0' . '&filter[level]=' . (int) $item->level);?>">
<a class="badge <?php if ($item->count_unpublished > 0) echo "badge-important"; ?>" title="<?php echo JText::_('COM_CATEGORY_COUNT_UNPUBLISHED_ITEMS');?>" href="<?php echo JRoute::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=0' . '&filter[level]=' . (int) $item->level);?>">
<?php echo $item->count_unpublished; ?></a>
</td>
<?php endif;?>
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_archived')) : ?>
<td class="center btns hidden-phone">
<a class="badge <?php if ($item->count_archived > 0) echo "badge-info"; ?>" title="<?php echo JText::_('COM_CATEGORY_COUNT_ARCHIVED_ITEMS');?>" href="<?php echo JRoute::_('index.php?option=' . $component . '&filter[category_id]=' . (int) $item->id . '&filter[published]=2' . '&filter[level]=' . (int) $item->level);?>">
<a class="badge <?php if ($item->count_archived > 0) echo "badge-info"; ?>" title="<?php echo JText::_('COM_CATEGORY_COUNT_ARCHIVED_ITEMS');?>" href="<?php echo JRoute::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=2' . '&filter[level]=' . (int) $item->level);?>">
<?php echo $item->count_archived; ?></a>
</td>
<?php endif;?>
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_trashed')) : ?>
<td class="center btns hidden-phone">
<a class="badge <?php if ($item->count_trashed > 0) echo "badge-inverse"; ?>" title="<?php echo JText::_('COM_CATEGORY_COUNT_TRASHED_ITEMS');?>" href="<?php echo JRoute::_('index.php?option=' . $component . '&filter[category_id]=' . (int) $item->id . '&filter[published]=-2' . '&filter[level]=' . (int) $item->level);?>">
<a class="badge <?php if ($item->count_trashed > 0) echo "badge-inverse"; ?>" title="<?php echo JText::_('COM_CATEGORY_COUNT_TRASHED_ITEMS');?>" href="<?php echo JRoute::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=-2' . '&filter[level]=' . (int) $item->level);?>">
<?php echo $item->count_trashed; ?></a>
</td>
<?php endif;?>
Expand Down

0 comments on commit 83f1661

Please sign in to comment.