Skip to content

Conversation

@elkuku
Copy link
Contributor

@elkuku elkuku commented Sep 15, 2018

Pull Request for Issue #22137 .

Summary of Changes

This will add an option to select a storage type for the debug plugin.

Currently only two options are supported:

  1. File - Debug information will be written to disk in json format.
  2. None

Testing Instructions

  1. Activate debug in global configuration
  2. Switch the storage type in plugin configuration and confirm that files are written - or not.

storage-setting

Expected result

Ability to Set the storage type to 'None'

Actual result

Files are always written - this might be a security issue.

Documentation Changes Required

Yes.
Add words to description of #20380 (TBD)

close #22137

@elkuku elkuku requested a review from brianteeman as a code owner September 15, 2018 04:51
@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-4.0-dev labels Sep 15, 2018
@elkuku elkuku changed the title [4.0] Add option to select debug information storage method [4.0] plg_system_debug - Add option to select debug information storage method Sep 15, 2018
@elkuku elkuku changed the title [4.0] plg_system_debug - Add option to select debug information storage method [4.0] plg_system_debug - Add option to select storage method Sep 15, 2018
@brianteeman
Copy link
Contributor

why is this a new fieldset? Surely it belongs with logging?

@elkuku
Copy link
Contributor Author

elkuku commented Sep 16, 2018 via email

}

/**
* Setup the storage method where debug information will be store (or not).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to stored

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@elkuku
Copy link
Contributor Author

elkuku commented Sep 16, 2018 via email

@brianteeman
Copy link
Contributor

Storage only refers to logging so it should be in the logging tab

@brianteeman
Copy link
Contributor

It also makes no sense at all what the "storage" is referring to when it is on its own tab.

It needs to be on the logging tab AND only shown when logging is actually enabled

@elkuku
Copy link
Contributor Author

elkuku commented Sep 17, 2018

Back on my keyboard...
So, what I am trying to say is that

  • Logging refers basically to "Messages" that are generated by the system during execution, deprecated messages or messages by 3PD extensions.
    I believe activating this should not imply that those messages are going to be written to text files.
  • Storage refers to the way the whole "debug bar" data (like system info, session and request data, database queries and, well, the log messages) are handled.
      Current options include:
    • File
    • None
      Other possible options would be
    • Redis
    • PDO
    • A custom handler

So, in my humble opinion, this deserves two separated tabs.

On the other hand, if that doesn't make any sense to you, I would be willing, and able, to perform the required changes to get this merged so I can use my keyboard for writing code instead of comments 😉

@brianteeman
Copy link
Contributor

please make the requested changes - if the other stuff is ever written then the decision can always be reviewed at that time

@elkuku
Copy link
Contributor Author

elkuku commented Sep 17, 2018

Done .

@elkuku
Copy link
Contributor Author

elkuku commented Sep 17, 2018

Partially reverted...
If you think that the storage option doesn't deserve its own tab it should go to the general "Plugin" tab, because it has absolutely no connection to the log tab for the reasons stated above.

@brianteeman
Copy link
Contributor

I stick by my original comment

@mbabker
Copy link
Contributor

mbabker commented Sep 18, 2018

This isn't a logging configuration in the sense of dealing with log files, so IMO it's right that it does not go onto the logging tab.

@brianteeman
Copy link
Contributor

what is it then? Maybe i have completely misunderstood it but from what I understand its purpose is to decide if log files are created

@mbabker
Copy link
Contributor

mbabker commented Sep 18, 2018

It's to configure whether the temporary files for a debugged request's data is stored basically, used in conjunction with the debug bar's Open Handler feature. It basically gives you the ability to review data for previous requests.

screen shot 2018-09-18 at 7 20 07 am

@mbabker
Copy link
Contributor

mbabker commented Sep 18, 2018

Well, when this option is fully integrated it wouldn't be "just" whether the data is stored but what backend storage is used (as hinted at earlier in this thread and in another issue).

@brianteeman
Copy link
Contributor

Then the word storage is definitely misleading to me although now I see exactly what it is I see it is called storage in the code http://phpdebugbar.com/docs/storage.html

So if the field was called something like "storing collected data" or "collecting data storage" that would be less confusing perhaps?

@mbabker
Copy link
Contributor

mbabker commented Sep 18, 2018

"Collected Data Storage" should work.

@elkuku
Copy link
Contributor Author

elkuku commented Sep 18, 2018

Thank you very much.
Let's blame Mrs. Hamilton, my English teacher at school...
I also could have posted the link to the docs about storage, not sure why I omitted that - My fault.

Copy link
Contributor

@brianteeman brianteeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve language strings

@brianteeman
Copy link
Contributor

Mrs Hamilton did a good job

@elkuku
Copy link
Contributor Author

elkuku commented Sep 18, 2018

OK since now we all know what we are talking about... I'd like to pollute my own PR with something a little OT..

I just tried to implement the open handler.
The following code:

# /components/com_content/Controller/DisplayController.php

public function xxx()
{
	$debugBar = new DebugBar();
	$debugBar->setStorage(new FileStorage($this->app->get('tmp_path')));

	$handler = new OpenHandler($debugBar);
	$handler->handle();
}

and

# /plugins/system/debug/debug.php:293

$debugBarRenderer
  ->setOpenHandlerUrl(JUri::root(true) . '/index.php?option=com_content&task=xxx&format=raw');

will enable the browsing of previous requests inside the debug bar which, IMHO, is a killer feature since it will enable the average developer for the first time to examine what happens during a redirect without the requirement for a single step debugger.

Now as you might have noticed the code is "hacked" into com_content which is obviously not the right place.
On the other hand I think that adding a new component (com_debug) to add this functionality would be an overkill...

Suggestions?

@mbabker
Copy link
Contributor

mbabker commented Sep 18, 2018

Add a view to com_admin.

@elkuku
Copy link
Contributor Author

elkuku commented Sep 18, 2018 via email

@elkuku
Copy link
Contributor Author

elkuku commented Sep 20, 2018

Add a view to com_admin.

I tried hard but I could not find a way to display anything from com_admin in frontend :(
Any hint how to accomplish this would be very much appreciated.

@elkuku
Copy link
Contributor Author

elkuku commented Sep 24, 2018

Not sure if we want to explore how to disable this great feature or are we good with the security enhancement that will be introduced by #22327 (which also includes the answer to my OT question here)?
So this could be closed.

@joomla-cms-bot
Copy link

Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/22188

@ghost
Copy link

ghost commented Sep 25, 2018

Closed as stated above.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22188.

@elkuku elkuku deleted the plg_debug-storage branch December 20, 2018 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Language Change This is for Translators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants