[geeklog-devel] Deleting comments

Tony Bibbs tony at tonybibbs.com
Thu Jan 20 14:03:06 EST 2005


Dirk, actually, in the stubbed out functions I would put the require_once:

function COM_deleteComment()
{
require_once '/path/to/lib-comment.php';
CMT_deleteComment();
}

Gets around the issue of including code that probably won't be used and
it provides the backwards compatibility. Note that making this elegant
isn't a big deal as that the whole notion of deprecating the
COM_*Comment functions is that those functions will eventually go bye-bye.

Also, worth noting is that you shouldn't call require_once after you do
a function_exists. The overhead to check for the function is made up
automatically by simply calling require_once.

--Tony

Dirk Haun wrote:


>Tony,

>

>

>

>>Only issue with this sort of stuff is it will clearly break

>>compatiblity. I say you would leave the stubbed out functions in

>>lib-common.php, call the new library equivalent (i.e. COM_deleteComment

>>would call CMT_deleteComment) and then log a warning to error.log that

>>the function is deprecated and will be removed in a future version.

>>

>>

>

>That would still require lib-common.php to include the lib-comment.php

>then. Since comments are only used by a few components (and plugins) I

>was actually thinking about getting rid of that code entirely so that

>those components that actually need it would have to include this.

>

>if (!function_exists ('COM_comment')) {

> require_once ($_CONF['path_system'] . 'lib-comment.php');

>}

>

>Yeah, it would break compatibility. But then again, there are more flaws

>in the plugin API regarding comments (I'll post something about them

>later) and this would be a good opportunity to fix them all at once.

>

>Vinny, I'm not opposed to having a comment.class.php instead of the lib-

>comment.php if you think that makes sense.

>

>bye, Dirk

>

>

>

>





More information about the geeklog-devel mailing list