Skip to content

Commit

Permalink
Merge pull request #3510 from ExpressionEngine/6.dev
Browse files Browse the repository at this point in the history
ExpressionEngine 6.4.12
  • Loading branch information
matthewjohns0n committed Jun 13, 2023
2 parents 69b7533 + 61f99ec commit 55ce678
Show file tree
Hide file tree
Showing 38 changed files with 204 additions and 42 deletions.
2 changes: 1 addition & 1 deletion build-tools/build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"tag": "6.4.11",
"tag": "6.4.12",

"repositories": {
"app": "git@github.com:ExpressionEngine/ExpressionEngine",
Expand Down
2 changes: 2 additions & 0 deletions build-tools/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ gulp.task('_delete_files', function (cb) {
'system/ee/EllisLab/Tests/',
'system/ee/ExpressionEngine/Tests/',

'.php-cs-fixer.dist.php',

'src',
'vue.config.js',
'npm-shrinkwrap.json',
Expand Down
7 changes: 6 additions & 1 deletion cp-styles/app/styles/base/_inputs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,12 @@ em label input[type='checkbox'] {
}



input[type=text][dir=rtl][field_content_type=numeric],
input[type=text][dir=rtl][field_content_type=integer],
input[type=text][dir=rtl][field_content_type=decimal]{
direction: ltr;
text-align: right;
}

// $input-padding: 8px;

Expand Down
8 changes: 8 additions & 0 deletions cp-styles/app/styles/components/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ $link-padding: 6px 12px;
border-radius: $border-radius-base;
}
}

@include m-tablet-down {
display: flex;

a {
display: inline-block;
}
}
}

.ui-sortable .sidebar__link .ui-sortable-handle i {
Expand Down
4 changes: 3 additions & 1 deletion system/ee/ExpressionEngine/Addons/channel/mod.channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,9 @@ public function build_sql_query($qstring = '')
}

if (empty($channel_ids)) {
return '';
if ($channelInOperator == 'IN') {
return '';
}
} else {
$sql .= "AND t.channel_id " . $channelInOperator . " (" . implode(',', $channel_ids) . ") ";
}
Expand Down
4 changes: 2 additions & 2 deletions system/ee/ExpressionEngine/Addons/grid/ft.grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ public function display_field($data)
$grid = ee('CP/GridInput', array(
'field_name' => $this->name(),
'lang_cols' => false,
'grid_min_rows' => $this->settings['grid_min_rows'],
'grid_max_rows' => $this->settings['grid_max_rows'],
'grid_min_rows' => isset($this->settings['grid_min_rows']) ? $this->settings['grid_min_rows'] : 0,
'grid_max_rows' => isset($this->settings['grid_max_rows']) ? $this->settings['grid_max_rows'] : '',
'reorder' => isset($this->settings['allow_reorder'])
? get_bool_from_string($this->settings['allow_reorder'])
: true,
Expand Down
9 changes: 9 additions & 0 deletions system/ee/ExpressionEngine/Addons/pages/tab.pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ private function makeValidTemplateRule($values)
private function makeValidURIRule()
{
return function ($field, $value) {
if (empty($value)) {
return true;
}
$c_page_uri = preg_replace(
"#[^a-zA-Z0-9_\-/\.]+$#i",
'',
Expand All @@ -259,6 +262,9 @@ private function makeValidURIRule()
private function makeValidSegmentCountRule()
{
return function ($field, $value) {
if (empty($value)) {
return true;
}
$value_segs = substr_count(trim($value, '/'), '/');

// More than 9 pages URI segs? goodbye
Expand All @@ -279,6 +285,9 @@ private function makeValidSegmentCountRule()
private function makeNotDuplicatedRule($entry)
{
return function ($field, $value) use ($entry) {
if (empty($value)) {
return true;
}
$static_pages = ee()->config->item('site_pages');
$uris = $static_pages[ee()->config->item('site_id')]['uris'];

Expand Down
4 changes: 2 additions & 2 deletions system/ee/ExpressionEngine/Controller/Channels/Sets.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ public function doImport()
$set->cleanUpSourceFiles();
$errors = $result->getErrors();
$model_errors = $result->getModelErrors();
foreach (array('Channel Field', 'Category', 'Category Group', 'Status') as $type) {
foreach (array('Channel Field', 'Category', 'Category Group', 'Status', 'Upload Destination') as $type) {
if (isset($model_errors[$type])) {
foreach ($model_errors[$type][0][2] as $error) {
$errors[] = $error->getLanguageKey();
$errors[] = $type . ': ' . $model_errors[$type][0][1] . ' — ' . $error->getLanguageKey();
}
}
}
Expand Down
1 change: 1 addition & 0 deletions system/ee/ExpressionEngine/Controller/Design/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ private function getExistingTemplates($selected_id = null)
$templates = ee('Model')->get('Template')
->with('TemplateGroup')
->with('Site')
->filter('TemplateGroup.group_id', 'IS NOT', null)
->order('TemplateGroup.group_name')
->order('Template.template_name');

Expand Down
2 changes: 1 addition & 1 deletion system/ee/ExpressionEngine/Controller/Logs/Logs.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ protected function delete($model, $log_type)
$query = ee('Model')->get($model, $id);

$count = $query->count();
$query->all()->delete();
$query->delete();

$message = sprintf(lang('logs_deleted_desc'), $count, lang($log_type));

Expand Down
2 changes: 1 addition & 1 deletion system/ee/ExpressionEngine/Controller/Publish/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public function entry($id = null, $autosave_id = null)
}

$entry = ee('Model')->get('ChannelEntry', $id)
->with('Channel', 'Autosaves')
->with('Channel', 'Status', 'Autosaves')
->all()
->first();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public function add($token)
*/
public function evaluate()
{
if (empty($this->tokens)) {
// none of tokens is defined, null === null
return true;
}

$rpn = $this->convertToRPN($this->tokens);

return $this->bool($this->evaluateRPN($rpn));
Expand Down
9 changes: 6 additions & 3 deletions system/ee/ExpressionEngine/Model/Channel/ChannelEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,15 @@ public function onBeforeUpdate($changed)

private function ensureStatusSynced($update_by_name)
{
if ($update_by_name) {
// if selected status is new one, but has the same name as the one that was deleted
// then there's no change and $update_by_name would be false
// so additional check if Status (by status_id) actually exists
if ($update_by_name === false && !is_null($this->Status)) {
$this->setProperty('status', $this->Status->status);
} else {
$this->Status = $this->getModelFacade()->get('Status')
->filter('status', $this->getProperty('status'))
->first();
} else {
$this->setProperty('status', $this->Status->status);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ public function transform(array $fields)
{
$display = parent::transform($fields);

// show message if there are no category groups assigned
$tab = $display->getTab('categories');
$fields = $tab->getFields();
if (count($fields) == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public function getId()
return $this->field->getId();
}

public function getData()
{
return $this->field->getData();
}

public function getType()
{
return $this->field->getItem('field_type');
Expand Down
14 changes: 14 additions & 0 deletions system/ee/ExpressionEngine/Model/Content/Display/LayoutTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ public function setFields($fields)

public function addField($field)
{
// not sure this is the best place for this check, but:
// we need to show alert if the status is not available,
// and this is the point where we for sure have all data
if ($field->getId() == 'status') {
if (! array_key_exists($field->getData(), $field->get('field_list_items'))) {
ee('CP/Alert')->makeInline('status-not-available')
->asWarning()
->cannotClose()
->withTitle(lang('status_not_available'))
->addToBody(sprintf(lang('status_not_available_desc'), $field->getData()))
->now();
}
}

$this->fields[] = $field;

return $this;
Expand Down
3 changes: 3 additions & 0 deletions system/ee/ExpressionEngine/Model/Content/FieldModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ public function parse($data, $content_id, $content_type, $variable_mods, $tagdat
false
));
}
if (is_null($data)) {
$data = '';
}
if ($tag) {
return str_replace(LD . $tag . RD, $data, $tagdata);
}
Expand Down
7 changes: 5 additions & 2 deletions system/ee/ExpressionEngine/Model/Role/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,11 @@ public function getMembersCount($mode = 'all')
$query->where('members_roles.role_id', $this->getId());
}
if (in_array($mode, ['all', 'primary'])) {
foreach ($this->RoleGroups as $role_group) {
$query->or_where('members_role_groups.group_id', $role_group->getId());
$roleGroupsQuery = ee('db')->select('group_id')->from('roles_role_groups')->where('role_id', $this->getId())->get();
if ($roleGroupsQuery->num_rows() > 0) {
foreach ($roleGroupsQuery->result_array() as $roleGroup) {
$query->or_where('members_role_groups.group_id', $roleGroup['group_id']);
}
}
}

Expand Down
29 changes: 28 additions & 1 deletion system/ee/ExpressionEngine/Model/Status/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ class Status extends Model
);

protected static $_events = array(
'beforeInsert'
'beforeInsert',
'afterInsert',
'afterUpdate'
);

protected $status_id;
Expand Down Expand Up @@ -99,6 +101,31 @@ public function onBeforeInsert()
}
}

/**
* New status might have same name as the one that was deleted
* and the entries were left orphan
* In that case, we establish relationship
*/
public function onAfterInsert()
{
//direct SQL, as we need it to be fast
ee('db')->where('status', $this->getProperty('status'))->update('channel_titles', ['status_id' => $this->getId()]);
}

/**
* Update the existing entries using this status
*
* @param array $previous
* @return void
*/
public function onAfterUpdate($previous)
{
if ($previous['status'] != $this->status) {
//direct SQL, as we need it to be fast
ee('db')->where('status', $previous['status'])->update('channel_titles', ['status' => $this->status]);
}
}

/**
* Returns the value and rendered label for option select input display
*
Expand Down
12 changes: 10 additions & 2 deletions system/ee/ExpressionEngine/Service/ChannelSet/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,14 @@ private function exportUploadDestination($id)
{
$dir = ee('Model')->get('UploadDestination', $id)->first();

if (is_null($dir)) {
return 'all';
}

$result = new StdClass();
$result->name = $dir->name;
$result->server_path = $dir->server_path;
$result->url = $dir->url;

$this->upload_destinations[$dir->name] = $result;

Expand Down Expand Up @@ -478,8 +484,10 @@ private function exportRelationshipField($field)
$result->channels = array();

foreach ($settings['channels'] as $id) {
$channel = $this->channels[$id];
$result->channels[] = $channel->channel_title;
if (array_key_exists($id, $this->channels)) {
$channel = $this->channels[$id];
$result->channels[] = $channel->channel_title;
}
}
}

Expand Down
12 changes: 7 additions & 5 deletions system/ee/ExpressionEngine/Service/ChannelSet/Set.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@ private function loadUploadDestinations($destinations)
$destination = ee('Model')->make('UploadDestination');
$destination->site_id = $this->site_id;
$destination->name = $upload_data->name;
$destination->url = isset($upload_data->url) ? $upload_data->url : '{base_url}';
$destination->server_path = isset($upload_data->server_path) ? $upload_data->server_path : null;

$this->applyOverrides($destination, $upload_data->name);

Expand Down Expand Up @@ -799,7 +801,7 @@ private function loadChannelField(\SplFileInfo $file)

foreach ($data as $key => $value) {
if (($type == 'grid' || $type == 'file_grid') && $key == 'columns') {
$this->importGrid($field, $value);
$this->importGrid($field, $value, $type);

continue;
}
Expand Down Expand Up @@ -888,11 +890,11 @@ private function loadCategoryField(\SplFileInfo $file)
* @param Array $columns The columns defined in the field.type file
* @return void
*/
private function importGrid($field, $columns)
private function importGrid($field, $columns, $type = 'grid')
{
$that = $this;
$fn = function () use ($columns, $that) {
unset($_POST['grid']);
$fn = function () use ($columns, $that, $type) {
unset($_POST[$type]);

// grid[cols][new_0][col_label]
foreach ($columns as $i => $column) {
Expand All @@ -904,7 +906,7 @@ private function importGrid($field, $columns)
}

foreach ($column as $col_label => $col_value) {
$_POST['grid']['cols']["new_{$i}"]['col_' . $col_label] = $col_value;
$_POST[$type]['cols']["new_{$i}"]['col_' . $col_label] = $col_value;
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion system/ee/ExpressionEngine/Tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
define('BASEPATH', SYSPATH . 'ee/legacy/');
define('PATH_CACHE', SYSPATH . 'user/cache/');
define('APPPATH', BASEPATH);
define('APP_VER', '6.4.11');
define('APP_VER', '6.4.12');
define('PATH_THEMES', realpath(SYSPATH . '/../themes') . '/');
define('DOC_URL', 'http://our.doc.url/');
define('PATH_THIRD', SYSPATH . 'user/addons/');
Expand Down
2 changes: 1 addition & 1 deletion system/ee/ExpressionEngine/View/_shared/form/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
'field_name' => $field_name,
'choices' => $field['choices'],
'disabled_choices' => isset($field['disabled_choices']) ? $field['disabled_choices'] : null,
'value' => $value,
'value' => is_array($value) ? array_unique($value) : $value,
'scalar' => isset($field['scalar']) ? $field['scalar'] : null,
'multi' => ($field['type'] == 'checkbox'),
'nested' => isset($field['nested']) ? $field['nested'] : false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php if ((empty(ee()->uri->segment(2)) || ee()->uri->segment(2) == 'homepage') && ee()->session->getMember()->dismissed_banner != 'y') : ?>
<div class="upgrade-success-banner__wrapper" style="background-image: url('<?= URL_THEMES ?>asset/img/ee-pro-promo-banner-bg@2x.png');">
<a href="<?= DOC_URL . 'installation/changelog.html#version-640' ?>" class="upgrade-success-banner__title" target="_blank">&#127881; ExpressionEngine <strong>6.4.0</strong></a>
<a href="<?= DOC_URL . 'installation/changelog.html#version-640' ?>" class="upgrade-success-banner__title-link" target="_blank"><i class="fas fa-clipboard"></i> Release Notes&hellip;</a>
<a href="<?= DOC_URL . 'installation/changelog.html#version-' . str_replace('.', '', APP_VER) ?>" class="upgrade-success-banner__title" target="_blank">&#127881; ExpressionEngine <strong><?=APP_VER?></strong></a>
<a href="<?= DOC_URL . 'installation/changelog.html#version-' . str_replace('.', '', APP_VER) ?>" class="upgrade-success-banner__title-link" target="_blank"><i class="fas fa-clipboard"></i> Release Notes&hellip;</a>

<!-- Change number of blurb columns via inline grid style below IF less than 3 blurbs: -->
<div class="upgrade-success-banner__blurb-wrapper" style="grid-template-columns: repeat(3, 1fr);">
Expand All @@ -18,10 +18,10 @@
</a>
<a href="https://expressionengine.com/blog/expressionengine-7-official-release" class="upgrade-success-banner__blurb" target="_blank">
<i class="fas fa-star fa-fw"></i>
<h6>ExpressionEngine 7</h6>
<p>We're pleased to announce the release of ExpressionEngine version 7. The largest ExpressionEngine release ever. <span class="upgrade-success-banner__blurb-learn">Find out more&hellip;</span></p>
<h6>ExpressionEngine 7.3 is Available</h6>
<p>Along with the new File Manager, the latest ExpressionEngine 7 release allows Field Groups in Fluid fields, chaining variable modifiers in templates, and new CLI commands. <span class="upgrade-success-banner__blurb-learn">Find out more&hellip;</span></p>
</a>
</div>
<a href="<?= ee('CP/URL')->make('homepage/dismissBanner')->compile(); ?>" class="banner-dismiss"></a>
</div>
<?php endif; ?>
<?php endif; ?>
2 changes: 1 addition & 1 deletion system/ee/installer/controllers/wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class Wizard extends CI_Controller
{
public $version = '6.4.11'; // The version being installed
public $version = '6.4.12'; // The version being installed
public $installed_version = ''; // The version the user is currently running (assuming they are running EE)
public $schema = null; // This will contain the schema object with our queries
public $languages = array(); // Available languages the installer supports (set dynamically based on what is in the "languages" folder)
Expand Down
Loading

0 comments on commit 55ce678

Please sign in to comment.