Skip to content

Commit

Permalink
Merge branch '4.0-dev' into feature/compile-es6
Browse files Browse the repository at this point in the history
# Conflicts:
#	package.json
  • Loading branch information
dneukirchen committed Feb 19, 2018
2 parents b8be210 + 3537bf5 commit 345a666
Show file tree
Hide file tree
Showing 149 changed files with 1,032 additions and 726 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ node_modules/
# We are ignoring this as a temporary measure until Node 8 and npm5 become the LTS release
# and we can require it.
package-lock.json
yarn.lock

# Removed in Joomla 4 #
administrator/templates/isis
Expand Down
6 changes: 3 additions & 3 deletions administrator/components/com_banners/tmpl/banners/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
<?php echo JHtml::_('jgrid.published', $item->state, $i, 'banners.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?>
</div>
</td>
<td class="nowrap has-context">
<div>
<td class="nowrap">
<div class="break-word">
<?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'banners.', $canCheckin); ?>
<?php endif; ?>
Expand All @@ -135,7 +135,7 @@
<?php else : ?>
<?php echo $this->escape($item->name); ?>
<?php endif; ?>
<span class="small">
<span class="small break-word">
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
</span>
<div class="small">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function setup(\SimpleXMLElement $element, $value, $group = null)
/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
* @param string $name The property name for which to the the value.
* @param string $name The property name for which to get the value.
*
* @return mixed The property value or null.
*
Expand All @@ -87,7 +87,7 @@ public function __get($name)
/**
* Method to set certain otherwise inaccessible properties of the form field object.
*
* @param string $name The property name for which to the the value.
* @param string $name The property name for which to set the value.
* @param mixed $value The value of the property.
*
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ public function delete(&$pks)
if ($return)
{
// Now check to see if this articles was featured if so delete it from the #__content_frontpage table
$db = \JFactory::getDbo();
$db = $this->getDbo();
$query = $db->getQuery(true)
->delete($db->quoteName('#__content_frontpage'))
->where('content_id IN (' . implode(',', $pks) . ')');
Expand Down
9 changes: 5 additions & 4 deletions administrator/components/com_content/Model/ArticlesModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,13 @@ protected function getListQuery()
}

// Filter by categories and by level
$categoryId = $this->getState('filter.category_id');
$categoryId = $this->getState('filter.category_id', array());
$level = $this->getState('filter.level');

$categoryId = $categoryId && !is_array($categoryId)
? array($categoryId)
: $categoryId;
if (!is_array($categoryId))
{
$categoryId = $categoryId ? array($categoryId) : array();
}

// Case: Using both categories filter and by level filter
if (count($categoryId))
Expand Down
37 changes: 15 additions & 22 deletions administrator/components/com_fields/Model/FieldModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,32 +587,25 @@ public function setFieldValue($fieldId, $itemId, $value)
$needsInsert = false;
$needsUpdate = false;

if ($field->default_value == $value)
$oldValue = $this->getFieldValue($fieldId, $itemId);
$value = (array) $value;

if ($oldValue === null)
{
$needsDelete = true;
// No records available, doing normal insert
$needsInsert = true;
}
elseif (count($value) == 1 && count((array) $oldValue) == 1)
{
// Only a single row value update can be done
$needsUpdate = true;
}
else
{
$oldValue = $this->getFieldValue($fieldId, $itemId);
$value = (array) $value;

if ($oldValue === null)
{
// No records available, doing normal insert
$needsInsert = true;
}
elseif (count($value) == 1 && count((array) $oldValue) == 1)
{
// Only a single row value update can be done
$needsUpdate = true;
}
else
{
// Multiple values, we need to purge the data and do a new
// insert
$needsDelete = true;
$needsInsert = true;
}
// Multiple values, we need to purge the data and do a new
// insert
$needsDelete = true;
$needsInsert = true;
}

if ($needsDelete)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Application\SiteApplication;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Document\FactoryInterface;
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Document\Document;
use Joomla\CMS\Factory;
use Joomla\CMS\Log\Log;
use Joomla\CMS\Plugin\PluginHelper;
Expand Down Expand Up @@ -168,7 +168,7 @@ public function batch()
);

// Get the HTML document.
$html = Document::getInstance('html', $attributes);
$html = Factory::getContainer()->get(FactoryInterface::class)->createDocument('html', $attributes);

// TODO: Why is this document fetched and immediately overwritten?
$doc = Factory::getDocument();
Expand Down
36 changes: 22 additions & 14 deletions administrator/components/com_finder/helpers/indexer/indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,22 +511,30 @@ protected function addTokensToDb($tokens, $context = '')
// Count the number of token values.
$values = 0;

// Iterate through the tokens to create SQL value sets.
foreach ($tokens as $token)
// Break into chunks of no more than 1000 items
$chunks = array_chunk($tokens, 1000);

foreach ($chunks as $tokens)
{
$query->values(
$db->quote($token->term) . ', '
. $db->quote($token->stem) . ', '
. (int) $token->common . ', '
. (int) $token->phrase . ', '
. (float) $token->weight . ', '
. (int) $context . ', '
. $db->quote($token->language)
);
++$values;
}
$query->clear('values');

$db->setQuery($query)->execute();
// Iterate through the tokens to create SQL value sets.
foreach ($tokens as $token)
{
$query->values(
$db->quote($token->term) . ', '
. $db->quote($token->stem) . ', '
. (int) $token->common . ', '
. (int) $token->phrase . ', '
. (float) $token->weight . ', '
. (int) $context . ', '
. $db->quote($token->language)
);
++$values;
}

$db->setQuery($query)->execute();
}

return $values;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public function getElement($name)
*
* @return array The elements
*
* @since __DEPLOY_VERSION__
* @since 3.8.3
*/
public function getElements()
{
Expand Down
19 changes: 17 additions & 2 deletions administrator/components/com_installer/Model/UpdateModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,30 @@ private function install($update)
return false;
}

$url = $update->downloadurl->_data;
$url = $update->downloadurl->_data;
$sources = $update->get('downloadSources', array());

if ($extra_query = $update->get('extra_query'))
{
$url .= (strpos($url, '?') === false) ? '?' : '&amp;';
$url .= $extra_query;
}

$p_file = \JInstallerHelper::downloadPackage($url);
$mirror = 0;

while (!($p_file = \JInstallerHelper::downloadPackage($url)) && isset($sources[$mirror]))
{
$name = $sources[$mirror];
$url = $name->url;

if ($extra_query)
{
$url .= (strpos($url, '?') === false) ? '?' : '&amp;';
$url .= $extra_query;
}

$mirror++;
}

// Was the package downloaded?
if (!$p_file)
Expand Down
23 changes: 21 additions & 2 deletions administrator/components/com_joomlaupdate/Model/UpdateModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ public function download()
{
$updateInfo = $this->getUpdateInformation();
$packageURL = $updateInfo['object']->downloadurl->_data;
$sources = $updateInfo['object']->get('downloadSources', array());
$headers = get_headers($packageURL, 1);

// Follow the Location headers until the actual download URL is known
Expand Down Expand Up @@ -299,7 +300,16 @@ public function download()
if (!$exists)
{
// Not there, let's fetch it.
return $this->downloadPackage($packageURL, $target);
$mirror = 0;

while (!($download = $this->downloadPackage($packageURL, $target)) && isset($sources[$mirror]))
{
$name = $sources[$mirror];
$packageURL = $name->url;
$mirror++;
}

return $download;
}
else
{
Expand All @@ -308,7 +318,16 @@ public function download()

if (empty($filesize))
{
return $this->downloadPackage($packageURL, $target);
$mirror = 0;

while (!($download = $this->downloadPackage($packageURL, $target)) && isset($sources[$mirror]))
{
$name = $sources[$mirror];
$packageURL = $name->url;
$mirror++;
}

return $download;
}

// Yes, it's there, skip downloading.
Expand Down
24 changes: 13 additions & 11 deletions administrator/components/com_menus/Controller/ItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,24 +357,26 @@ public function save($key = null, $urlVar = null)

$data = $model->validate($form, $data);

// Preprocess request fields to ensure that we remove not set or empty request params
$request = $form->getGroup('request');

// Check for the special 'request' entry.
if ($data['type'] == 'component' && isset($data['request']) && is_array($data['request']) && !empty($data['request']))
if ($data['type'] == 'component' && !empty($request))
{
$removeArgs = array();

// Preprocess request fields to ensure that we remove not set or empty request params
$request = $form->getGroup('request');
if (!isset($data['request']) || !is_array($data['request']))
{
$data['request'] = array();
}

if (!empty($request))
foreach ($request as $field)
{
foreach ($request as $field)
{
$fieldName = $field->getAttribute('name');
$fieldName = $field->getAttribute('name');

if (!isset($data['request'][$fieldName]) || $data['request'][$fieldName] == '')
{
$removeArgs[$fieldName] = '';
}
if (!isset($data['request'][$fieldName]) || $data['request'][$fieldName] == '')
{
$removeArgs[$fieldName] = '';
}
}

Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_menus/Field/Modal/MenuField.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class MenuField extends FormField
/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
* @param string $name The property name for which to the the value.
* @param string $name The property name for which to get the value.
*
* @return mixed The property value or null.
*
Expand All @@ -86,7 +86,7 @@ public function __get($name)
/**
* Method to set certain otherwise inaccessible properties of the form field object.
*
* @param string $name The property name for which to the the value.
* @param string $name The property name for which to set the value.
* @param mixed $value The value of the property.
*
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class JFormFieldMenuitemByType extends JFormFieldGroupedList
/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
* @param string $name The property name for which to the the value.
* @param string $name The property name for which to get the value.
*
* @return mixed The property value or null.
*
Expand All @@ -96,7 +96,7 @@ public function __get($name)
/**
* Method to set certain otherwise inaccessible properties of the form field object.
*
* @param string $name The property name for which to the the value.
* @param string $name The property name for which to set the value.
* @param mixed $value The value of the property.
*
* @return void
Expand Down

0 comments on commit 345a666

Please sign in to comment.