How to make Require_once refreshable

View: New views
9 Messages — Rating Filter:   Alert me  

How to make Require_once refreshable

by nan wich :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I was trying to track down an issue I am having with the node module's content_types.inc so I stuck in some messages. Unfortunately, the menu system uses require_once to load these files, so my changes are not working. I really don't want to have to reboot every time I do something. Is there any quicker way to get PHP to reload these files?
 
Nancy E. Wichmann, PMP
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
 

Re: How to make Require_once refreshable

by andrew morton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Oct 5, 2009 at 11:12 AM, Nancy Wichmann <nan_wich@...> wrote:
> I was trying to track down an issue I am having with the node module's
> content_types.inc so I stuck in some messages. Unfortunately, the menu
> system uses require_once to load these files, so my changes are not working.
> I really don't want to have to reboot every time I do something. Is there
> any quicker way to get PHP to reload these files?

That's definitely not PHP's default behavior. It sounds like you might
have some caching happening, perhaps APC? That or you might be editing
a different file other than the one you're expecting? I've found
myself hacking a way for a good half hour only to realize I'm on the
wrong site.

andrew

Re: How to make Require_once refreshable

by Jennifer Hodgdon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nancy Wichmann wrote:
> I was trying to track down an issue I am having with the node module's
> content_types.inc so I stuck in some messages. Unfortunately, the menu
> system uses require_once to load these files, so my changes are not working.
> I really don't want to have to reboot every time I do something. Is there
> any quicker way to get PHP to reload these files?

Every time you (or anyone else) visits a Drupal page, Drupal starts up
again from scratch and loads all the files it needs to load. So unless
your page, block, etc. that is triggering the require_once() is
cached, your file should get included on every page load.

You might consider blowing out all the Drupal caches, to make sure
that is not the problem.

    --Jennifer

--
Jennifer Hodgdon * Poplar ProductivityWare
www.poplarware.com
Drupal, WordPress, and custom Web programming


Re: How to make Require_once refreshable

by Larry Garfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

By default, PHP will reload files on disk every page request.  If it's
not, then it's doing something weird.

Possible causes:

1) You're running APC in no-stat mode.  You need to restart apache for
it to flush its cache.  This is not a good mode to run a dev server for
the reason you're seeing.

2) You're running APC not in no-stat mode, but it's acting buggy and is
not stating anyway.  Restart apache or disable APC.

3) You're actually editing the wrong file.  I have lots of copies of
Drupal floating around my web directories.  It happens at times. :-)

4) The code you think is running is not actually running, so your debug
statements are never reached.  This has happened to me, too.

5) Your OS or Apache are just being buggy.  Switch to a less buggy OS or
Apache.

--Larry Garfield

Nancy Wichmann wrote:

> I was trying to track down an issue I am having with the node module's
> content_types.inc so I stuck in some messages. Unfortunately, the menu
> system uses require_once to load these files, so my changes are not
> working. I really don't want to have to reboot every time I do
> something. Is there any quicker way to get PHP to reload these files?
>  
> Nancy E. Wichmann, PMP
> Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L.
> King, Jr.
>  

Re: How to make Require_once refreshable

by nan wich :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't have APC. It is PHP 5.2.5 and Apache 2.2.6.

So I guess that means I'm editing the wrong file. Sigh...

Nancy E. Wichmann, PMP
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King,
Jr.


-----Original Message-----
From: development-bounces@...
[mailto:development-bounces@...]On Behalf Of
larry@...
Sent: Monday, October 05, 2009 11:31 AM
To: development@...
Subject: Re: [development] How to make Require_once refreshable


By default, PHP will reload files on disk every page request.  If it's
not, then it's doing something weird.

Possible causes:

1) You're running APC in no-stat mode.  You need to restart apache for
it to flush its cache.  This is not a good mode to run a dev server for
the reason you're seeing.

2) You're running APC not in no-stat mode, but it's acting buggy and is
not stating anyway.  Restart apache or disable APC.

3) You're actually editing the wrong file.  I have lots of copies of
Drupal floating around my web directories.  It happens at times. :-)

4) The code you think is running is not actually running, so your debug
statements are never reached.  This has happened to me, too.

5) Your OS or Apache are just being buggy.  Switch to a less buggy OS or
Apache.

--Larry Garfield

Nancy Wichmann wrote:

> I was trying to track down an issue I am having with the node module's
> content_types.inc so I stuck in some messages. Unfortunately, the menu
> system uses require_once to load these files, so my changes are not
> working. I really don't want to have to reboot every time I do
> something. Is there any quicker way to get PHP to reload these files?
>
> Nancy E. Wichmann, PMP
> Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L.
> King, Jr.
>
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.420 / Virus Database: 270.14.3/2412 - Release Date: 10/05/09
06:19:00


Re: How to make Require_once refreshable

by nan wich :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 3) You're actually editing the wrong file.
Hmm....

From node.module:
  $items['admin/content/types'] = array(
    'title' => 'Content types',
    'description' => 'Manage posts by content type, including default status, front page promotion, etc.',
    'page callback' => 'node_overview_types',
    'access arguments' => array('administer content types'),
    'file' => 'content_types.inc',
  );

But a hook_menu_alter to dump the entry shows:
Array
(
    [title] => Content types
    [description] => Manage posts by content type, including default status, front page promotion, etc.
    [page callback] => content_types_overview
    [access arguments] => Array
        (
            [0] => administer content types
        )

    [file] => content.admin.inc
    [module] => node
    [file path] => sites/all/modules/cck/includes
)

The file has changed somewhere along the line...


Nancy E. Wichmann, PMP
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.


Re: How to make Require_once refreshable

by Earl Miles :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nancy Wichmann wrote:
>     [file] => *content.admin.inc*
>     [file path] => sites/all/modules/cck/includes

see content.module in CCK -- that's clearly content_menu_alter making
the change.

Re: How to make Require_once refreshable

by nan wich :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Earl Miles wrote:
> see content.module in CCK -- that's clearly content_menu_alter

Thank you, Earl. I had discovered that. And now I am submitting a patch to
CCK to take care of a "@TODO.

Nancy E. Wichmann, PMP
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King,
Jr.


Re: How to make Require_once refreshable

by Earnie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Quoting Nancy Wichmann <nan_wich@...>:

> I was trying to track down an issue I am having with the node module's
> content_types.inc so I stuck in some messages. Unfortunately, the menu
> system uses require_once to load these files, so my changes are not working.
> I really don't want to have to reboot every time I do something. Is there
> any quicker way to get PHP to reload these files?
>

The menu system will only call hook_menu if variable  
"menu_rebuild_needed" is set to TRUE.  You can cause that to happen by  
clicking then "admin/settings/performance->Clear cached data" button.

--
Earnie
-- http://r-feed.com/           -- http://for-my-kids.com/
-- http://www.4offer.biz/       -- http://give-me-an-offer.com/