diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 77fe9c90d..db544f9a6 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -8,6 +8,7 @@ In order to read more about upgrading and BC breaks have a look at the [UPGRADE > Check the [UPGRADE document](UPGRADE.md) to read more about breaking changes. + [#2068](https://github.com/luyadev/luya/issues/2068) Disabled the automatically register process of CSRF tokens. Since ActiveForms are widely used they register the CSRF token. ++ [#2081](https://github.com/luyadev/luya/pull/2081) Removed deprecated methods and/or added a deprecation error trigger. + [#2077](https://github.com/luyadev/luya/pull/2077) Fix issue with caching when using SVG widget and symbol names. ## 1.9.0 (11. February 2021) diff --git a/core/UPGRADE.md b/core/UPGRADE.md index d8dc8f8cb..07b6468c5 100644 --- a/core/UPGRADE.md +++ b/core/UPGRADE.md @@ -23,6 +23,7 @@ return $this->render('form', [...]); ``` Read more about CSRF implementation in the [Yii Framework Security Guide](https://www.yiiframework.com/doc/guide/2.0/en/security-best-practices#avoiding-csrf). ++ [#2081](https://github.com/luyadev/luya/pull/2081) Removed deprecated methods and/or added a deprecation error trigger. ## 1.6.0 diff --git a/core/base/Boot.php b/core/base/Boot.php index fdad846fe..7bfba3250 100644 --- a/core/base/Boot.php +++ b/core/base/Boot.php @@ -72,19 +72,6 @@ public function getBaseYiiFile() return $this->_baseYiiFile; } - /** - * Whether current request is runing in cli env or not. - * - * This is determined by php_sapi_name(). - * - * @return boolean - * @deprecated Depreacted since 1.0.12 use getisCli() instead. - */ - public function isCli() - { - return $this->getIsCli(); - } - private $_isCli; /** diff --git a/core/behaviors/Encode.php b/core/behaviors/Encode.php deleted file mode 100644 index efaf73502..000000000 --- a/core/behaviors/Encode.php +++ /dev/null @@ -1,13 +0,0 @@ - - * @deprecated Deprecated since 1.0.9 use HtmlEncodeBehavior instead will be removed in 2.0 - */ -class Encode extends HtmlEncodeBehavior -{ -} diff --git a/core/behaviors/Timestamp.php b/core/behaviors/Timestamp.php deleted file mode 100644 index cd0470fe1..000000000 --- a/core/behaviors/Timestamp.php +++ /dev/null @@ -1,14 +0,0 @@ - - * @since 1.0.0 - * @deprecated Deprecated since 1.0.9 use TimestampBehavior instead will be removed in 2.0 - */ -class Timestamp extends TimestampBehavior -{ -} diff --git a/core/console/commands/ThemeController.php b/core/console/commands/ThemeController.php index 4e5cc86cb..af6b3eb2e 100644 --- a/core/console/commands/ThemeController.php +++ b/core/console/commands/ThemeController.php @@ -184,7 +184,7 @@ private function renderLayout($themeName) $this->beginPage(); ?> - + <?= $this->title; ?> diff --git a/core/web/Bootstrap.php b/core/web/Bootstrap.php index 767ae31b0..783a2f300 100644 --- a/core/web/Bootstrap.php +++ b/core/web/Bootstrap.php @@ -102,9 +102,7 @@ public function run($app) // @see https://github.com/luyadev/luya/issues/1778 $app->request->csrfParam = '_csrf_admin'; - $app->getModule('admin')->assets = $app->getAdminModulesAssets(); // @deprecated in version 2.0 or 4.0 of LUYA Admin Module $app->getModule('admin')->controllerMap = $this->_apis; - $app->getModule('admin')->moduleMenus = $app->getAdminModulesMenus(); // @deprecated in version 2.0 or 4.0 of LUYA Admin Module $app->getModule('admin')->setJsTranslations($app->getAdminModulesJsTranslationMessages()); // calculate api defintions diff --git a/core/web/Composition.php b/core/web/Composition.php index c1dcb4de2..348fc06d2 100644 --- a/core/web/Composition.php +++ b/core/web/Composition.php @@ -44,11 +44,6 @@ class Composition extends Component implements \ArrayAccess * @var string The Regular-Expression matching the var finder inside the url parts */ const VAR_MATCH_REGEX = '/<(\w+):?([^>]+)?>/'; - - /** - * @deprecated Deprecated in 1.0.5 remove in 1.1.x - */ - const EVENT_AFTER_SET = 'EVENT_AFTER_SET'; /** * @var \yii\web\Request Request-Object container from DI @@ -461,16 +456,15 @@ public function offsetUnset($offset) throw new Exception('Deleting keys in Composition is not allowed.'); } - // Deprecated methods - /** * Wrapper for `getKey('langShortCode')` to load language to set php env settings. * * @return string|boolean Get the language value from the langShortCode key, false if not set. - * @deprecated in 1.1.0 use `getLangShortCode()` instead. + * @deprecated in 1.1.0 use `getLangShortCode()` instead, trigger in 2.0, will be removed in 3.0 */ public function getLanguage() { + trigger_error('use `getLangShortCode()` instead. Will be removed in version 3.0', E_USER_DEPRECATED); return $this->getKey(self::VAR_LANG_SHORT_CODE); } @@ -478,10 +472,11 @@ public function getLanguage() * Return the whole composition array. * * @return array - * @deprecated Remove in 1.1.0 use `getKeys()` instead. + * @deprecated Remove in 1.1.0 use `getKeys()` instead, trigger in 2.0, will be removed in 3.0 */ public function get() { + trigger_error('use `getKeys()` instead. Will be removed in version 3.0', E_USER_DEPRECATED); return $this->_keys; } @@ -489,10 +484,11 @@ public function get() * Return a path like string with all composition with trailing slash e.g. us/e. * * @return string - * @deprecated Remove in 1.1.0 use `getPrefixPath()` instead. + * @deprecated Remove in 1.1.0 use `getPrefixPath()` instead, trigger in 2.0, will be removed in 3.0 */ public function getFull() { + trigger_error('use `getPrefixPath()` instead. Will be removed in version 3.0', E_USER_DEPRECATED); return $this->createRouteEnsure(); } } diff --git a/core/web/CompositionAfterSetEvent.php b/core/web/CompositionAfterSetEvent.php deleted file mode 100644 index 1b325cfec..000000000 --- a/core/web/CompositionAfterSetEvent.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @since 1.0.0 - * @deprecated in 1.1.0 - */ -class CompositionAfterSetEvent extends \yii\base\Event -{ - /** - * @var string The key identifiere where the value will be set (array key). - */ - public $key; - - /** - * @var string The value for the specific key to set (array value). - */ - public $value; -} diff --git a/core/web/filters/ResponseCache.php b/core/web/filters/ResponseCache.php index 740ccf199..8b9ea011a 100644 --- a/core/web/filters/ResponseCache.php +++ b/core/web/filters/ResponseCache.php @@ -30,13 +30,13 @@ class ResponseCache extends PageCache * }); * ``` * - * @deprecated Replaced in favor of {{beforeCacheResponse}} and {{afterRestoreResponse}}. Will be removed in 2.0 + * @deprecated Replaced in favor of {{beforeCacheResponse}} and {{afterRestoreResponse}}. Triggers note in 2.0, will be removed in 3.0 */ public $actionsCallable = []; /** * @var array - * @deprecated Use {{$only}} or {{$except}} instead. Will be removed in 2.0 + * @deprecated Use {{$only}} or {{$except}} instead. Triggers note in 2.0, will be removed in 3.0 */ public $actions = []; @@ -49,6 +49,7 @@ public function init() // support deprecated $actions property if (!empty($this->actions)) { + trigger_error('$actions property will be removed in version 3.0, use {{$only}} or {{$except}} instead', E_USER_DEPRECATED); $this->only = $this->actions; } } @@ -79,6 +80,7 @@ public function beforeAction($action) // support legacy property. if (!empty($this->actionsCallable)) { + trigger_error('$actionsCallable property will be removed in version 3.0, use {{beforeCacheResponse}} and {{afterRestoreResponse}} instead.', E_USER_DEPRECATED); $this->callActionCallable($action->id, Yii::$app->response->content); } diff --git a/docs/guide/app-blocks.md b/docs/guide/app-blocks.md index 6cd507cab..9022be742 100644 --- a/docs/guide/app-blocks.md +++ b/docs/guide/app-blocks.md @@ -185,9 +185,6 @@ If there is a property defined you will get the property object otherwise return Sometimes your block should also register some css or js files, therefore you can access the global {{\luya\web\View}} Object inside of your PHP view template. It is quite similar to registering other assets with the difference that you are accessing the global scope view instead of the view on `$this`. - -> Since LUYA CMS version 1.1 `$appView` is deprecated, use `$this` instead! - Assuming the below code is the PHP View of your Block: ```php diff --git a/docs/guide/app-module-urlrules.md b/docs/guide/app-module-urlrules.md index 263c6626f..140a24744 100644 --- a/docs/guide/app-module-urlrules.md +++ b/docs/guide/app-module-urlrules.md @@ -100,7 +100,7 @@ In order to define the url rules from the urlManager config scope, you can just > When composition is enabled, it will take the correct route for the current language and prefix the pattern if enable in composition config. -To verify which composition language is used you can dump `Yii::$app->composition->language`. The {{luya\web\Composition}} component is taking care of LUYA multi language websites and is registered by default for all LUYA projects. +To verify which composition language is used you can dump `Yii::$app->composition->langShortCode`. The {{luya\web\Composition}} component is taking care of LUYA multi language websites and is registered by default for all LUYA projects. ## Application Controller Routes diff --git a/tests/core/base/BootTest.php b/tests/core/base/BootTest.php index 21015a73a..a22f642fd 100644 --- a/tests/core/base/BootTest.php +++ b/tests/core/base/BootTest.php @@ -10,7 +10,6 @@ public function testBaseObject() { $boot = new Boot(); $this->assertEquals('cli', $boot->getSapiName()); - $this->assertTrue($boot->isCli()); } public function testUnableToFindConfigFile() diff --git a/tests/core/web/CompositionTest.php b/tests/core/web/CompositionTest.php index ae7a57c7f..d8aac9ecf 100644 --- a/tests/core/web/CompositionTest.php +++ b/tests/core/web/CompositionTest.php @@ -9,17 +9,6 @@ * removed tests to implemented here (if not already). * * - $parts = Yii::$app->composition->get(); - - $this->assertArrayHasKey('langShortCode', $parts); - $this->assertArrayHasKey('foo', $parts); - $this->assertArrayHasKey('bar', $parts); - - $this->assertEquals('de', $parts['langShortCode']); - $this->assertEquals('de', Yii::$app->composition->getLanguage()); - $this->assertEquals('1234', $parts['foo']); - $this->assertEquals('luya09', $parts['bar']); - * * @author nadar */ @@ -192,7 +181,7 @@ public function testGetDefaultLanguage() $this->assertEquals('us', $override); // as override does not set/change the base value - $this->assertEquals('en', $comp->getLanguage()); + $this->assertEquals('en', $comp->getLangShortCode()); $this->assertEquals('en', $comp['langShortCode']); $this->assertTrue(isset($comp['langShortCode'])); $comp['fooCode'] = 'bar'; diff --git a/tests/core/web/UrlManagerTest.php b/tests/core/web/UrlManagerTest.php index 735efd38f..d86da7085 100644 --- a/tests/core/web/UrlManagerTest.php +++ b/tests/core/web/UrlManagerTest.php @@ -311,7 +311,7 @@ public function testCompositionRuleWithHiddenLanguageButCompositionLangShortCode $request = new Request(); $request->pathInfo = 'mentions-legales'; $composition = new Composition($request, ['hidden' => true, 'default' => ['langShortCode' => 'fr']]); - $this->assertSame('fr', $composition->language); + $this->assertSame('fr', $composition->langShortCode); $urlManager = new UrlManager(); $urlManager->composition = $composition; $urlManager->addRules([ diff --git a/tests/core/web/filters/ResponseCacheTest.php b/tests/core/web/filters/ResponseCacheTest.php index 86fe723bb..f2e565da3 100644 --- a/tests/core/web/filters/ResponseCacheTest.php +++ b/tests/core/web/filters/ResponseCacheTest.php @@ -84,7 +84,7 @@ public function testInsideActionListButNotInCache() $controller = new StubController('fooctrl', Yii::$app); $action = new StubAction('fooaction', $controller); - $filter = new ResponseCache(['actions' => ['fooaction']]); + $filter = new ResponseCache(); $content = $filter->beforeAction($action); $this->assertTrue($content); }