php-pm-drupal icon indicating copy to clipboard operation
php-pm-drupal copied to clipboard

Drupal 7?

Open alex-moreno opened this issue 9 years ago • 12 comments

would that be possible? Has anyone tried? I understand for the patches that this one is just for D8

alex-moreno avatar Mar 21 '16 18:03 alex-moreno

I don't personally plan to try it or put other effort into it. I don't know whether or not it would be possible.

kentr avatar Mar 21 '16 18:03 kentr

I don't mind to give it a go, although I wanted to make sure that, given the similarity of D8 and symfony architecture, is something that couldn't be achieved in D7. Thanks

On Mon, 21 Mar 2016 18:32 KentR, [email protected] wrote:

I don't personally plan to try it or put other effort into it. I don't know whether or not it would be possible.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/php-pm/php-pm-drupal/issues/12#issuecomment-199416224

alex-moreno avatar Mar 21 '16 18:03 alex-moreno

I suspect that lack of Symfony won't be a deciding factor. @marcj would know better. As I see it, PHP-PM is somewhat like a bridge between the ReactPHP event loop and other code (Drupal, Symfony, etc…).

If global users is actually the cause of the authentication problems that I found with D8, you’ll probably have the issue with D7 as well.

kentr avatar Mar 21 '16 19:03 kentr

For what it's worth, I have tried this, and I've gotten to a point where I can render a page. There are an indeterminate number of drupal_static() variables that will need to be reset before it works correctly. Global variables like $user, etc will have to be reset too. Also I encountered questionable practices, like defining functions in template files, that caused it to crash.

bertrama avatar Apr 01 '16 23:04 bertrama

Global variables like $user, etc will have to be reset too.

Can you describe what you're thinking WRT "reset"?

My understanding is that the app itself is running continuously, and so all requests would access the same global variables. I'd expect this to cause concurrency problems.

Example:

  1. One request comes in.
  2. $user is set to that request's user.
  3. Another request comes in before the first finishes and either:
    • The second request erroneously gets the first request's $user and uses it, causing problems for request 2.
    • The second request changes $user, causing errors in subsequent processing of request 1.

kentr avatar Apr 01 '16 23:04 kentr

Sure. I didn't mention it, but I assume that each php-pm worker is single threaded so that no two requests run in parallel on the same worker. That should keep all of Drupal's global state separate between calls. I just have to unset the variables between requests. There are probably going to be problems with anything that depends on Drupal registering shutdown functions for the php runtime. I haven't gotten that far yet.

bertrama avatar Apr 02 '16 00:04 bertrama

in terms of actually "resetting" a variable, I mostly have been calling unset() on the globals. drupal_static(), on the other hand, can be cleared with drupal_static($name, NULL, TRUE);

bertrama avatar Apr 02 '16 00:04 bertrama

Ah, you’re probably right about a single worker only handling one request at a time. I didn’t think of that.

I’m looking forward to the results.

kentr avatar Apr 02 '16 02:04 kentr

@bertrama, are you actively working on this? I need to merge in the upstream changes eventually (such as #11 ), but don't have a lot of time for testing or fixing new problems. I want to make sure it won't interfere with what you're doing.

kentr avatar May 04 '16 20:05 kentr

It's a side project that I don't get to spend much time on. Drupal 7 has a very different structure from Drupal 8, so I've pretty much started it from scratch. So your changes here won't affect anything I've done. Thanks for checking, though!

bertrama avatar May 05 '16 02:05 bertrama

I've uploaded my code:

https://github.com/bertrama/php-pm-drupal-seven

Very experimental, and needs cleaning up.

bertrama avatar May 09 '16 04:05 bertrama

amazing Albert :-), I'll try to play with that in the next days and give some feedback

On Mon, 9 May 2016 at 05:08 Albert Bertram [email protected] wrote:

I've uploaded my code:

https://github.com/bertrama/php-pm-drupal-seven

Very experimental, and needs cleaning up.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/php-pm/php-pm-drupal/issues/12#issuecomment-217772204

alex-moreno avatar May 09 '16 08:05 alex-moreno