Working on a "private messages" plugin

Postby jondaley on Wed Apr 25, 2007 3:20 pm

evens83 wrote:
Code: Select all
Exception message: lt_include(/home/stud/evens/public_html/lifetype1/plugins/privatemessage/class/dao/messagestatus.class.php): failed to open stream: No such file or directory
Error code: 2
-- Backtrace --
/home/stud/evens/public_html/lifetype1/class/object/loader.class.php(6): lt_include
/home/stud/evens/public_html/lifetype1/plugins/friends/class/dao/friendinfo.class.php(4): lt_include
/home/stud/evens/public_html/lifetype1/plugins/friends/class/dao/friends.class.php(4): include_once
/home/stud/evens/public_html/lifetype1/plugins/favouriteblogs/pluginfavouriteblogs.class.php(13): include_once
/home/stud/evens/public_html/lifetype1/class/object/loader.class.php(6): include_once
/home/stud/evens/public_html/lifetype1/class/plugin/pluginmanager.class.php(246): lt_include
/home/stud/evens/public_html/lifetype1/class/plugin/pluginmanager.class.php(177): pluginmanager._createplugininstance
/home/stud/evens/public_html/lifetype1/admin.php(40): pluginmanager.loadplugins


I think that maby I should use 'include_once' instead of 'lt_include' in my plugins. But I'm currently trying to work out a solution to this problem.


It would be good to understand if there is really a problem with the lt_include function - does that file that it gave the error on exist? I think the only limitation of lt_include is that you have to use absolute pathnames in order for it to correctly only include the file once.

I have also been meaning to do some testing to see if using include() instead of include_once() is better.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Postby phunkphorce on Wed Apr 25, 2007 4:05 pm

jondaley wrote:I have also been meaning to do some testing to see if using include() instead of include_once() is better.


I already tried and it's not going to work. The problem is that in lt_include we store the path to the file as the key in the array that we use to check whether a file was loaded. Include_once prevents us from attempting to load the same file twice and therefore running into an error. If we used include(), the following code would cause an error although it points to the same file:

Code: Select all
lt_include( "myfile.php" );
lt_include( "./myfile.php" );


The internal array would end up with two different keys, one for "myfile.php" and another one for "./myfile.php", unless we did something to the file paths before processing them (but it would kind of defeat the point that lt_include is faster than include_once if we have to do all that)

If the above sounds confusing, try and see for yourself :)
phunkphorce
Lifetype Expert
 
Posts: 9028
Joined: Mon Aug 25, 2003 6:34 am
Location: Suomessa

Postby jondaley on Thu Apr 26, 2007 12:16 pm

Right. lt_include only works with absolute pathnames. I thought we accepted that limitation. If we are using include_once, we are still paying the filename lookup penalty of include_once, though it is less than it used to be.

Do we have relative path name includes in our code? I thought we always used PLOG_CLASS_PATH, so we don't care about that.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Postby phunkphorce on Thu Apr 26, 2007 2:36 pm

When I tried to replace include_once() with include() in our lt_include I run into some trouble, perhaps it was related to plugins... I can't remember. Perhaps you can give it a try again and see what the problem was.
phunkphorce
Lifetype Expert
 
Posts: 9028
Joined: Mon Aug 25, 2003 6:34 am
Location: Suomessa

Postby jondaley on Thu Apr 26, 2007 6:43 pm

I looked this over some. You should use lt_include everywhere.
If you mix and match require, require_once, include, include_once with lt_include, you will run into problems.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

just an idea

Postby mock_turtle on Sat Oct 20, 2007 11:26 pm

i think it would be nice to add a little panel to the "about" parts of blog templates which contains a "send message" link for authenticated users. maybe a pop up box could appear for sending messg. when clicked, instead of directing the user to admin page for just a liittle message. also the panel could contain a signifier if the owner of the blog is online or not.
mock_turtle
 
Posts: 8
Joined: Tue Oct 09, 2007 6:06 pm

Re: Working on a "private messages" plugin

Postby Logan on Sun Jun 01, 2008 12:02 pm

Where I download this Plugin (( private message). --link broken--
Logan
 
Posts: 8
Joined: Sun May 11, 2008 8:23 pm
LifeType Version: 1.28

Previous

Return to LifeType 2.0 Development

cron