Skip to content
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

Drupal 7? #12

Open
alex-moreno opened this issue Mar 21, 2016 · 12 comments
Open

Drupal 7? #12

alex-moreno opened this issue Mar 21, 2016 · 12 comments

Comments

@alex-moreno
Copy link

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

@kentr
Copy link
Collaborator

kentr commented Mar 21, 2016

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.

@alex-moreno
Copy link
Author

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, notifications@github.com 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
#12 (comment)

@kentr
Copy link
Collaborator

kentr commented Mar 21, 2016

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.

@bertrama
Copy link

bertrama commented Apr 1, 2016

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.

@kentr
Copy link
Collaborator

kentr commented Apr 1, 2016

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.

@bertrama
Copy link

bertrama commented Apr 2, 2016

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
Copy link

bertrama commented Apr 2, 2016

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);

@kentr
Copy link
Collaborator

kentr commented Apr 2, 2016

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
Copy link
Collaborator

kentr commented May 4, 2016

@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.

@bertrama
Copy link

bertrama commented May 5, 2016

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
Copy link

bertrama commented May 9, 2016

I've uploaded my code:

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

Very experimental, and needs cleaning up.

@alex-moreno
Copy link
Author

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 notifications@github.com 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
#12 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants