Databases: is SQL relies on obsolete tables!

Databases: is SQL relies on obsolete tables!

von Mohammad Hossein Hayati -
Anzahl Antworten: 9

Dear all

Hi

one of my Course Creator set the
enrolment key only for 3 days and when I want to enroll students in course
for more time, Moodle find this error” SQL relies on obsolete tables! Your
code must be fixed by a developer”.  How can I solve this problem?

my Moodle is 1.7

thanks.thoughtful

Mittelwert:  -
Als Antwort auf Mohammad Hossein Hayati

Re: Databases: is SQL relies on obsolete tables!

von Ger Tielemans -
I have the same error message when I try to run the course format project under 1.7 or 1.8
Als Antwort auf Mohammad Hossein Hayati

Re: Databases: is SQL relies on obsolete tables!

von Iñaki Arenaza -
Nutzerbild von Core developers Nutzerbild von Documentation writers Nutzerbild von Peer reviewers Nutzerbild von Plugin developers
Having a look at .../lib/dmllib.php it seems this warning is issued when the SQL sentence uses one of the obsolete tables (from 1.7 on) prefix_user_students, prefix_user_teachers, prefix_user_coursecreators and prefix_user_admins.

All of those tables are gone and the code should be using the new roles system. So you _really_ need a developer to fix that code zwinkernd

Saludos. Iñaki.
Als Antwort auf Iñaki Arenaza

Re: Databases: is SQL relies on obsolete tables!

von Tariq Adel Al Ammadi -
It is possible, of course, to hack the dmllib.php file to allow you to use the old tables, but that is not the spirit of 1.7 ;), in either case you still need a developer.

The code causing your problems is probably a third party module or block. Backup and restore your course and in the copy try removing each third party module, hopefully you will find the offending plugin.
Als Antwort auf Tariq Adel Al Ammadi

Re: Databases: is SQL relies on obsolete tables!

von Ger Tielemans -

Iñaki, You are right! The course format project is using the tables: user_teachers, user_students!! thanks for the clue..

So, how can I change these calls into the spirit of 1.7/1.8?

  $teachers = get_records('user_teachers','course',$courseid);
  $students = get_records('user_students','course',$courseid);
    $teacher = get_record('user_teachers', 'userid', $USER->id, 'course', $course->id)

Als Antwort auf Ger Tielemans

Re: Databases: is SQL relies on obsolete tables!

von Tariq Adel Al Ammadi -
Users are now defined by roles, type show tables like '%roles%' at the MySQL client prompt to see the tables involved.

You will now need to group users by what capabilities their roles have, for example if I have block which I want only users that are able to use the chat module to edit, then I would need to include the following code somewhere in my_block's code:
...
$blockobject = block_instance('my_block', $bi);

$context = get_context_instance(CONTEXT_COURSE,
 blockobject->instance->pageid);

require_capability('mod/chat:chat', $context);
...
For further information on roles see Managing Roles.
Als Antwort auf Ger Tielemans

Re: Databases: is SQL relies on obsolete tables!

von Tim Hunt -
Nutzerbild von Core developers Nutzerbild von Documentation writers Nutzerbild von Particularly helpful Moodlers Nutzerbild von Peer reviewers Nutzerbild von Plugin developers
Why do you want that information? What do you do with it? We need more information to be able to tell you what to do under roles and capabilites.
Als Antwort auf Mohammad Hossein Hayati

Re: Databases: is SQL relies on obsolete tables!

von Bernard Boucher -
Hi all,
if you don't make too much use of roles maybe that simple hack on /lib/dmllib.php may be usefull.

Please don't try it on a production server, and test all the role you will need before concluding it working.

I hope it may help,

Bernard



Als Antwort auf Bernard Boucher

Re: Databases: is SQL relies on obsolete tables!

von Ger Tielemans -

Thank you very much Bernard, that did the trick!!

I now wonder why they coded it as an error instead of an:  

if (isadmin()) {WARNING!!}


Just wondering: created you already with jpGraph a 360 grade modul where students fill questions about each other and jpGraph creates a kind of Radar-grpah? 

Als Antwort auf Ger Tielemans

Re: Databases: is SQL relies on obsolete tables!

von Bernard Boucher -
Hi Ger,
the radar graphs that I remember to have posted here are there and are part of my old project Socrate for wich I got some funding big grin ( free time to work on next year ) but they are created with excel.

But Jpgraph is able to generate equivalents.

I hope it may help,

Bernard

p.s. The mindmap of the second link Socrate is not yet clickable like yours but it will be soonwink and I think you will like it!