-
-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Future add data source #489
base: master
Are you sure you want to change the base?
Future add data source #489
Conversation
evgenybukharev
commented
Jun 23, 2022
•
edited
Loading
edited
Q | A |
---|---|
Is bugfix? | ❌ |
New feature? | ✔️ |
Breaks BC? | ✔️ |
* add data storage * add data storage * add data storage * fix type hints
Another debug data storage support |
Thank you for putting effort in the improvement of the Yii framework. Unfortunately a use case is missing. It is required to get a better understanding of the pull request and helps us to determine the necessity and applicability of the suggested change to the framework. Could you supply us with a use case please? Please be as detailed as possible and show some code! Thanks! This is an automated comment, triggered by adding the label |
The functionality of data storage of the debug panel is implemented not only in file storage, an interface has been added that allows users to implement any convenient storage for data, whether it is a database or redis. The cache data storage is also implemented sorry for my english |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks like a good thing but requires major release since public API changes. Need a line for CHANGELOG and UPGRADE instructions.
I like the idea of this PR but I'm not convinced on the architectural choices. In my opinion storing data is the task of a log target. By limiting your changes only to a new Also I don't see the benefit of introducing a new interface, which will see few implementors. My unfinished proof of concept: #495 achieves similar functionality with just a new target. Meaning no BC break. Also this PR suffers from the same shortcoming as my PoC for mail files: they are still stored on disk. |
# Conflicts: # src/LogTarget.php # src/Module.php # src/controllers/DefaultController.php
# Conflicts: # src/LogTarget.php # src/Module.php # src/components/data/CacheDataStorage.php # src/components/data/FileDataStorage.php # src/controllers/DefaultController.php
@samdark Hi, I added line to CHANGELOG and added instructions to README |
$data = $this->cache->get($this->cacheDebugDataKey . $tag); | ||
if (empty($data)) { | ||
return []; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is new component, let's stop this nonsense with returns in the if-else.
$manifest = $this->cache->get($this->cacheDebugManifestKey); | ||
if (empty($manifest)) { | ||
return []; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is new component, let's stop this nonsense with returns in the if-else.
And we need tests. |
Thank you for putting effort in the improvement of the Yii framework. In order for the framework and your solution to remain stable in the future, we have a unit test requirement in place. Therefore we can only accept your pull request if it is covered by unit tests. Could you add these please? Thanks! P.S. If you have any questions about the creation of unit tests? Don't hesitate to ask for support. More information about unit tests This is an automated comment, triggered by adding the label |
|
||
/** | ||
* The Yii Debug Module provides the debug toolbar and debugger | ||
* | ||
* @author Qiang Xue <qiang.xue@gmail.com> | ||
* @since 2.0 | ||
* @since 2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @since 2.0 | |
* @since 2.0 |
Data Storage | ||
----- | ||
|
||
You can save debug data in any storage, for this you need to implement the yii\debug\components\data\DataStorage interface, and configure the module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can save debug data in any storage, for this you need to implement the yii\debug\components\data\DataStorage interface, and configure the module. | |
You can save debug data in any storage, for this you need to implement the `yii\debug\components\data\DataStorage` interface, and configure the module. |
@@ -226,7 +220,8 @@ public static function setYiiLogo($logo) | |||
public function init() | |||
{ | |||
parent::init(); | |||
$this->dataPath = Yii::getAlias($this->dataPath); | |||
|
|||
$this->dataStorage = Instance::ensure($this->dataStorageConfig + ['module' => $this],'yii\debug\components\data\DataStorage'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->dataStorage = Instance::ensure($this->dataStorageConfig + ['module' => $this],'yii\debug\components\data\DataStorage'); | |
$this->dataStorage = Instance::ensure($this->dataStorageConfig + ['module' => $this], 'yii\debug\components\data\DataStorage'); |
} | ||
|
||
/** | ||
* @param string $tag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need phpdoc here and in every other method.