Hi Will, On Mon, 2002-11-25 at 21:27, Will Shine wrote: > > > I am having troubles getting mgd_create_article to work. > > > I was getting an access denied error from the sample code supplied on the= > > > web site until i adjusted permissions. > > > Now I fixed the permissions so that I no longer get an access denied=20 > > > error but now I get an object does not exist error. > > > Is there something that I am missing here? > > > > Maybe. An article needs to be in a topic, so you'd call: ...
> I switched to the oop way of doing this.
>
> When I do a $article=mgd_get_article()
...
> When I call the create method, nothing seems to happen.
> Afterwards,
>
> $article->id becomes Object
What do you mean by 'becomes Object'?
> and when I display mgd_errno() on the page, I see
>
> Object does not exist.
>
> I also checked the articles table, and saw nothing there, and I could see
> no new articles in the admin web page
> > but at any rate be sure that the topic you want to create the article in
> > exists, and that the up field is either zero or points to an existing
> > article.
>
> I have verified this, by putting in bogus values for topic and I do get
> an error stating a failure on the create method.
Intresting. Looking at the source of article.c:
if (!mgd_exists_id(mgd_handle(), "person", "id=$d",
(*author)->value.lval))
RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS);
if (!mgd_exists_id(mgd_handle(), "topic", "id=$d",
(*topic)->value.lval))
RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS);
if ((*up)->value.lval != 0 && !mgd_exists_id(mgd_handle(), "article",
"id=$d", (*up)->value.lval))
RETURN_FALSE_BECAUSE(MGD_ERR_NOT_EXISTS);
if (!istopicowner((*topic)->value.lval)) {
RETURN_FALSE_BECAUSE(MGD_ERR_ACCESS_DENIED);
}
if ((*name)->value.str.len != 0 && mgd_exists_id(mgd_handle(),
"article",
"topic=$d AND name=$q AND up=$d",
(*topic)->value.lval, (*name)->value.str.val,
(*up)->value.lval)) {
RETURN_FALSE_BECAUSE(MGD_ERR_DUPLICATE);
}
These are the checks performed before creation of an article, and you
could get the Object does not exist because:
- there is no person object with the id mentioned in the 'author' field
- there is no topic object with the id mentioned in the 'topic' field
- there is no article object with the id mentioned in the 'up' field
AND this 'up' field is nonzero.
I didn't think of the person object in my previous mail, so you could
doublecheck that. If that doesn't get you on track, I suggest you turn
on mysql logging if you haven't done so allready, and track what mysql
queries are done by midgard when you execute your function, and replay
those queries by hand. That will give you some extra information that
might help to understand at what exact moment midgard bails out, and
why.
wkr,
--
Envida http://www.envida.net/
Armand A. Verstappen Graadt van Roggenweg 328
[EMAIL PROTECTED] 3531 AH Utrecht
tel: +31 (0)30 298 2255 Postbus 19127
fax: +31 (0)30 298 2111 3501 DC Utrecht
signature.asc
Description: This is a digitally signed message part
