Cant add "new resource" > "View directory"

Cant add "new resource" > "View directory"

by Sven Tiberg -
Number of replies: 7

Hi.

Just upgraded to latest version of Moodle.

Try to add a new resource > view directory.

and got the message "Could not add a new instance of resource"

Can create the direcory and add files.

Same while using administrator account.

Any hints?

BG

Sven-Erik Tiberg

Average of ratings: -
In reply to Sven Tiberg

Re: Cant add "new resource" > "View directory"

by Sven Tiberg -

Screenshots of the error

Pls. give us some advises.

We do need it urgently.

/BG

Sven-Erik Tiberg

IT-unit Lulea Univ. of Techn.

Sweden

In reply to Sven Tiberg

Re: Cant add "new resource" > "View directory"

by Richard Enison -

ST,

It seems to be saying that you are trying to add a resource you already have. The error message is not "Could not add resource", but "Could not add a new instance of resource." Is it possible you already have the directory resource you are trying to add?

As a Moodle newbie myself, that is all the help I can give you at this point.

RLE

In reply to Richard Enison

Re: Cant add "new resource" > "View directory"

by ryan davis -

Hi i am having the same problem the particulars you can find under the windows section, i have done some investigating and this is the problem im getting whilst in debug mode.

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Only one top level element is allowed in an XML document. Error processing resource

'http://scat-vle/moodle/course/modedit....

<div class="notifytiny" style="text-align:center">Field 'alltext' doesn't have a default value<br /><br />...

Invalid operation.

i have searched high and low but am beggining to wonder if it has relevence to using mysql 5.0.37 with php 5.2.1? Does this happen when using 1.7 or a lower version of mysql or php?

In reply to ryan davis

Re: Cant add "new resource" > "View directory"

by Simon Ward -

I have the same thing happening on my install.  I am using IIS 6.0 and PHP 5.2.1 and moodle 1.8 with MSSQL.  But if I install the 1.7 version the problem doesn't happen.

In reply to Sven Tiberg

Re: Cant add "new resource" > "View directory"

by Andrew Schmadeke -
I posted a solution on a different thread:

http://moodle.org/mod/forum/discuss.php?d=68455#p310772

And, I created a tracker item for this, so I imagine that the Moodle Development Team will have this ironed out in an official version in the next couple of days.

--Andrew Schmadeke
In reply to Andrew Schmadeke

Re: Cant add "new resource" > "View directory"

by Morgan Winters -
I am running 1.7 and everything was fine until last week when I started getting the "Could not add a new instance of resource".

I tried the solution you posted above (just the first section of it, not the optional 2nd part) and got no difference.

I do have a developer doing some custom mods, but we did not have this problem even with that.

Any ideas where to look to debug this? I can't create any type of resource in my course.

Should I be thinking about trying to clear the cache on the server? How would I do that from a shared account? Is it possible?

Thanks!
In reply to Morgan Winters

Re: Cant add "new resource" > "View directory"

by Andrew Schmadeke -
The bug we're discussing didn't exist until 1.8, so I'm guessing your customizations are the source of the problem.

I would first look at the SQL logs, since they should tell you which query bombed out. If you can post that query here, someone can tell you where to look in the code.

If you can't access the SQL logs, modify moodle/lib/dmlib.php to display the problem INSERT query. Note, you don't want to do this on a production environment:

Find this line around line 1418:
if (!$rs = $db->Execute($insertSQL)) {

Add these lines right above it:
echo $insertSQL;
exit;

Now, try adding a resource again. The problem query will be displayed on the screen. Post it here for more help.

-Andrew