Skip to content

Commit

Permalink
Merge branch 'release/3.0.0-beta.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Feb 17, 2017
2 parents aa20909 + 1d0cd43 commit 0a1390f
Show file tree
Hide file tree
Showing 123 changed files with 1,615 additions and 1,197 deletions.
72 changes: 71 additions & 1 deletion CHANGELOG-v3.md
@@ -1,6 +1,76 @@
Craft CMS 3.0 Working Changelog
===============================

## 3.0.0-beta.4 - 2017-02-17

### Added
- #1388: Added the “Branch Limit” Categories field setting, which replaces the “Limit” setting.
- Added the `withStructure` param to element queries (defaults to `true` for entry and category queries).
- Added `craft\base\PluginInterface::setSettings()`.
- Added `craft\base\FolderVolumeInterface` that should be used by all Volumes supporting discrete folders.
- Added `craft\base\FolderVolume` that should be used by all Volumes supporting discrete folders.
- Added `craft\elements\db\ElementQueryInterface::withStructure()`.
- Added `craft\helpers\App::humanizeClass()`.
- Added `craft\helpers\FileHelper::lastModifiedTime()`.
- Added `craft\models\FieldLayout::getFieldByHandle()`.
- Added `craft\services\Categories::applyBranchLimitToCategories()`.
- Added `craft\services\Tasks::getTaskInfo()`.
- Added `craft\web\Request::accepts()`.
- Added the `$maybeAutoRun` argument to `craft\services\Tasks::queueTask()`.
- Added Craft’s required PHP extensions to `composer.json`.

### Changed
- The Resave Elements task now shows a more humanized version of the element type’s class name in its default descriptions.
- Elements no longer get a default title on save, unless they’re being saved without validation.
- `craft\fields\BaseRelationField::$allowMultipleSources` is now public.
- `craft\fields\BaseRelationField::$allowLimit` is now public.
- Renamed `craft\fields\BaseRelationField::sourceOptions()` to `getSourceOptions()`, and now it’s public.
- Renamed `craft\fields\BaseRelationField::targetSiteFieldHtml()` to `getTargetSiteFieldHtml()`, and now it’s public.
- Renamed `craft\fields\BaseRelationField::viewModeFieldHtml()` to `getViewModeFieldHtml()`, and now it’s public.
- It’s now possible for field types that extend `craft\fields\BaseRelationField` to override the settings template by setting the `$settingsTemplate` property.
- `craft\volumes\Local` now extends `craft\base\FolderVolume` instead of `craft\base\Volume`.
- Replaced `craft\services::fillGapsInCategoryIds()` with `fillGapsInCategories()`.
- Updated Garnish to 0.1.13.

### Removed
- Removed `craft\base\Element::resolveStructureId()`.
- Removed `craft\base\ElementInterface::getStructureId()`.
- Removed `craft\base\ElementInterface::setStructureId()`.
- Removed `craft\base\Volume::createDir()`.
- Removed `craft\base\Volume::deleteDir()`.
- Removed `craft\base\Volume::folderExists()`.
- Removed `craft\base\Volume::renameDir()`.
- Removed `craft\base\VolumeInterface::createDir()`.
- Removed `craft\base\VolumeInterface::deleteDir()`.
- Removed `craft\base\VolumeInterface::renameDir()`.
- Removed the `table.inputs` styles. Use `div.flex` instead.

### Fixed
- #1361: Fixed a bug where a plugin’s `init()` method couldn’t access its own settings values.
- Fixed a PHP type error if you tried to save a Number field’s setting with “Min Value” set to nothing.
- Fixed a bug where it was not possible to rename a file with the Asset "Rename File" action.
- #1367: Fixed a PHP error that occurred when uploading a user photo.
- #1365: Fixed a bug where element titles were not translatable.
- #1366: Fixed a PHP error that occurred on the Settings → General page if the `timezone` config setting was set.
- Fixed a bug where some Control Panel message strings were getting translated with the `site` translation category rather than `app`.
- Fixed a bug where pagination URLs would define page numbers using a `pg` query string param if the `pageTrigger` config setting was set to `'?p'` and the `pathParam` config setting was set to something besides `'p'`.
- Fixed a bug where if a Craft update failed and the attempt to restore the database from a backup failed, the UI would still show that the restore was successful.
- Fixed several migration related bugs that were preventing some Craft 2.6 installs from being able to update to Craft 3.
- Fixed a bug where renaming a folder would remove it’s trailing slash from path.
- #1371: Fixed a bug where asset bundles weren’t always getting re-published when a sub-file(s) had been updated.
- Fixed a bug where SVG images without a viewbox defined would not be scaled correctly.
- Fixed a bug where Craft would generate warning when trying to index images with no content in them.
- #1372: Fixed a bug where the Database Backup utility wouldn’t show an error when the backup failed.
- Fixed a bug where saving preexisting Active Record objects was not updating the `dateUpdated` column automatically.
- #1380: Fixed a bug where required fields on a field layout were not being enforced.
- Fixed a bug where required Plain Text fields were not getting a validation error if left blank.
- Fixed a PHP type error that occurred when calling `craft\base\Element::getPrevSibling()` or `getNextSibling()`.
- #1375: Fixed a bug where Structure-related element methods (e.g. `getParent()`) weren’t working for elements that weren’t queried with the `structureId` param set.
- #1389: Fixed a bug where an exception was thrown when saving an element with a slug that was more than 255 characters long, rather than giving the slug a validation error.
- #1391: Fixed a bug where the Password input on the Control Panel Login page was getting extra padding on the right side instead of the left side for browsers that preferred a RTL language.
- Fixed several issues and unexpected behaviors around the Number field, its default values, min and max settings and required validation.
- Fixed a bug where the element listing wouldn’t get refreshed after running the “Set status” action, if any of the elements couldn’t be enabled due to validation errors.

## 3.0.0-beta.3 - 2017-02-07

### Added
Expand Down Expand Up @@ -292,7 +362,7 @@ Craft CMS 3.0 Working Changelog
- Added `craft\web\Session::addAssetBundleFlash()`.
- Added `craft\web\Session::getAssetBundleFlashes()`.
- Added `craft\web\UploadedFile::saveAsTempFile()`.
- Added the `beforeDelete`, `afterDelete`, `beforeMoveInStructure`, and `afterMoveInStructure`, events to `craft\base\Element`.
- Added the `beforeDelete`, `afterDelete`, `beforeMoveInStructure`, and `afterMoveInStructure` events to `craft\base\Element`.
- Added the `beforeElementSave`, `afterElementSave`, `beforeElementDelete`, and `afterElementDelete` events to `craft\base\Field`.
- Added the `beforeRestoreBackup` and `afterRestoreBackup` events to `craft\db\Connection`.
- Added the `registerActions` event to `craft\base\Element`.
Expand Down
30 changes: 27 additions & 3 deletions CHANGELOG.md
Expand Up @@ -4,14 +4,38 @@ Craft CMS Changelog
## Unreleased

### Fixed
- #1378: Fixed a bug where the `forms/checkboxSelect.html` include template wouldn’t display a checkbox option with the value of `0`.

- Fixed a bug where you could get a `json_encode` “Invalid UTF-8 sequence” error on some servers when specifying a `depth` in an element query.
- Fixed a bug where an Entry Type’s “Title Field Label” wasn’t being HTML encoded on the edit entry page.
## 2.6.2962 - 2017-02-15

## 2.6.2960 - 2017-02-02
### Added
- The Control Panel now recognizes potentially-stalled tasks, and gives the user the option to retry or cancel them.

### Changed
- The Control Panel now polls for updated background task information at a variable frequency based on the speed of the currently-running task.

### Removed
- Removed `TasksController::actionGetRunningTaskInfo()`.

### Fixed
- Fixed a PHP error that occurred when auto-updating Craft if the OPcache `restrict_api` config setting was set.
- Fixed a bug where SVGs without a `viewbox` were not getting scaled correctly.
- Fixed a warning that occurred when indexing images with no content.
- Fixed a bug where the asset upload progress bar was not staying fixed in the center of the window when scrolling down the page.

### Security
- Fixed four potential XSS vulnerabilities in the Control Panel.

## 2.6.2961 - 2017-02-08

### Fixed
- Fixed an “Invalid UTF-8 sequence” error that occurred on some servers when using the deprecated `depth` element criteria param.
- Fixed a bug where custom Title field labels weren’t getting HTML-encoded on Edit Entry pages.
- Fixed a bug where editable tables may not be responsive until the window had been resized.

## 2.6.2960 - 2017-02-02

### Fixed
- Fixed a bug where `{% exit %}` tags would always result in a 500 error regardless of the exit code passed in, when Dev Mode was disabled.
- Fixed a bug where it was impossible to replace files on Rackspace Sources with whitespaces in the filename. (Thanks Thoai.)

Expand Down
18 changes: 15 additions & 3 deletions composer.json
@@ -1,7 +1,7 @@
{
"name": "craftcms/cms",
"description": "Craft CMS",
"version": "3.0.0-beta.3",
"version": "3.0.0-beta.4",
"keywords": [
"cms",
"craftcms",
Expand All @@ -19,6 +19,13 @@
},
"require": {
"php": ">=7.0.0",
"ext-pcre": "*",
"ext-pdo": "*",
"ext-openssl": "*",
"ext-mbstring": "*",
"ext-json": "*",
"ext-curl": "*",
"ext-zip": "*",
"yiisoft/yii2": "2.0.11.1",
"yiisoft/yii2-debug": "2.0.7",
"yiisoft/yii2-swiftmailer": "2.0.6",
Expand All @@ -33,22 +40,27 @@
"bower-asset/d3-format": "1.0.2.0",
"bower-asset/d3-time-format": "2.0.3.0",
"bower-asset/element-resize-detector": "1.1.10",
"bower-asset/garnishjs": "0.1.12",
"bower-asset/garnishjs": "0.1.13",
"bower-asset/jquery.payment": "3.0.0",
"bower-asset/picturefill": "3.0.2",
"bower-asset/selectize": "0.12.4",
"bower-asset/timepicker": "1.11.9",
"bower-asset/velocity": "1.4.2",
"bower-asset/fabric": "1.7.3",
"zendframework/zend-feed": "2.7.0",
"craftcms/server-check": "1.0.8"
"craftcms/server-check": "1.0.9"
},
"require-dev": {
"codeception/codeception": "2.2.8",
"codeception/verify": "0.3.2",
"codeception/specify": "0.4.5",
"codeception/mockery-module": "0.2.2"
},
"suggest": {
"ext-imagick": "Adds support for more image processing formats and options.",
"ext-iconv": "Adds support for more character encodings than PHP’s built-in mb_convert_encoding() function, which Craft will take advantage of when converting strings to UTF-8.",
"ext-intl": "Adds rich internationalization support."
},
"autoload": {
"psr-4": {
"craft\\": "src/"
Expand Down
86 changes: 21 additions & 65 deletions src/base/Element.php
Expand Up @@ -60,17 +60,17 @@
* @property string|null $thumbUrl The URL to the element’s thumbnail, if there is one
* @property string|null $iconUrl The URL to the element’s icon image, if there is one
* @property string|null $status The element’s status
* @property Element $next The next element relative to this one, from a given set of criteria
* @property Element $prev The previous element relative to this one, from a given set of criteria
* @property Element $parent The element’s parent
* @property Element|null $next The next element relative to this one, from a given set of criteria
* @property Element|null $prev The previous element relative to this one, from a given set of criteria
* @property Element|null $parent The element’s parent
* @property mixed $route The route that should be used when the element’s URI is requested
* @property int|null $structureId The ID of the structure that the element is associated with, if any
* @property ElementQueryInterface $ancestors The element’s ancestors
* @property ElementQueryInterface $descendants The element’s descendants
* @property ElementQueryInterface $children The element’s children
* @property ElementQueryInterface $siblings All of the element’s siblings
* @property Element $prevSibling The element’s previous sibling
* @property Element $nextSibling The element’s next sibling
* @property Element|null $prevSibling The element’s previous sibling
* @property Element|null $nextSibling The element’s next sibling
* @property bool $hasDescendants Whether the element has descendants
* @property int $totalDescendants The total number of descendants that the element has
* @property string $title The element’s title
Expand Down Expand Up @@ -663,13 +663,6 @@ protected static function prepElementQueryForTableAttribute(ElementQueryInterfac
*/
private $_prevElement;

/**
* @var int|false|null The structure ID that the element is associated with
* @see getStructureId()
* @see setStructureId()
*/
private $_structureId;

/**
* @var
*/
Expand Down Expand Up @@ -826,7 +819,7 @@ public function rules()
],
[['siteId'], SiteIdValidator::class],
[['dateCreated', 'dateUpdated'], DateTimeValidator::class],
[['title'], 'string', 'max' => 255],
[['title', 'slug'], 'string', 'max' => 255],
];

// Require the title?
Expand Down Expand Up @@ -1123,41 +1116,13 @@ public function setParent(ElementInterface $parent = null)
}
}

/**
* @inheritdoc
*/
public function getStructureId()
{
if ($this->_structureId === null) {
$this->setStructureId($this->resolveStructureId());
}

if ($this->_structureId !== false) {
return $this->_structureId;
}

return null;
}

/**
* @inheritdoc
*/
public function setStructureId($structureId)
{
if (!empty($structureId)) {
$this->_structureId = $structureId;
} else {
$this->_structureId = false;
}
}

/**
* @inheritdoc
*/
public function getAncestors(int $dist = null)
{
return static::find()
->structureId($this->getStructureId())
->structureId($this->structureId)
->ancestorOf($this)
->siteId($this->siteId)
->ancestorDist($dist);
Expand All @@ -1174,7 +1139,7 @@ public function getDescendants(int $dist = null)
}

return static::find()
->structureId($this->getStructureId())
->structureId($this->structureId)
->descendantOf($this)
->siteId($this->siteId)
->descendantDist($dist);
Expand All @@ -1199,22 +1164,20 @@ public function getChildren()
public function getSiblings()
{
return static::find()
->structureId($this->getStructureId())
->structureId($this->structureId)
->siblingOf($this)
->siteId($this->siteId);
}

/**
* @inheritdoc
*
* @return ElementQueryInterface
*/
public function getPrevSibling(): ElementQueryInterface
public function getPrevSibling()
{
if ($this->_prevSibling === null) {
/** @var ElementQuery $query */
$query = $this->_prevSibling = static::find();
$query->structureId = $this->getStructureId();
$query->structureId = $this->structureId;
$query->prevSiblingOf = $this;
$query->siteId = $this->siteId;
$query->status = null;
Expand All @@ -1231,15 +1194,13 @@ public function getPrevSibling(): ElementQueryInterface

/**
* @inheritdoc
*
* @return ElementQueryInterface
*/
public function getNextSibling(): ElementQueryInterface
public function getNextSibling()
{
if ($this->_nextSibling === null) {
/** @var ElementQuery $query */
$query = $this->_nextSibling = static::find();
$query->structureId = $this->getStructureId();
$query->structureId = $this->structureId;
$query->nextSiblingOf = $this;
$query->siteId = $this->siteId;
$query->status = null;
Expand Down Expand Up @@ -1799,7 +1760,8 @@ protected function fieldByHandle(string $handle)
$contentService = Craft::$app->getContent();
$originalFieldContext = $contentService->fieldContext;
$contentService->fieldContext = $this->getFieldContext();
$this->_fieldsByHandle[$handle] = Craft::$app->getFields()->getFieldByHandle($handle);
$fieldLayout = $this->getFieldLayout();
$this->_fieldsByHandle[$handle] = $fieldLayout ? $fieldLayout->getFieldByHandle($handle) : null;
$contentService->fieldContext = $originalFieldContext;

return $this->_fieldsByHandle[$handle];
Expand Down Expand Up @@ -1840,17 +1802,6 @@ public function getSite(): Site
return $site;
}

/**
* Returns the ID of the structure that the element is inherently associated with, if any.
*
* @return int|null
* @see getStructureId()
*/
protected function resolveStructureId()
{
return null;
}

/**
* Returns the HTML that should be shown for a given attribute in Table View.
*
Expand Down Expand Up @@ -1912,7 +1863,12 @@ protected function tableAttributeHtml(string $attribute): string
if ($field instanceof EagerLoadingFieldInterface && $this->hasEagerLoadedElements($field->handle)) {
$value = $this->getEagerLoadedElements($field->handle);
} else {
$value = $this->getFieldValue($field->handle);
// The field might not actually belong to this element
try {
$value = $this->getFieldValue($field->handle);
} catch (\Exception $e) {
$value = $field->normalizeValue(null);
}
}

return $field->getTableAttributeHtml($value, $this);
Expand Down
14 changes: 0 additions & 14 deletions src/base/ElementInterface.php
Expand Up @@ -527,20 +527,6 @@ public function getParent();
*/
public function setParent(ElementInterface $parent = null);

/**
* Returns the ID of the structure that the element is associated with, if any.
*
* @return int|null|false The ID of the structure, or null if there isn’t one
*/
public function getStructureId();

/**
* Sets the ID of the structure that the element is associated with.
*
* @param int|false|null $structureId The ID of the structure, or null to remove the previous association.
*/
public function setStructureId($structureId);

/**
* Returns the element’s ancestors.
*
Expand Down
5 changes: 5 additions & 0 deletions src/base/ElementTrait.php
Expand Up @@ -30,6 +30,11 @@ trait ElementTrait
*/
public $uid;

/**
* @var int|null The element’s structure ID
*/
public $structureId;

/**
* @var int|null The element’s content row ID
*/
Expand Down

0 comments on commit 0a1390f

Please sign in to comment.