<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/22/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jonwitts</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/22/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jonwitts"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/Special:Contributions/Jonwitts"/>
	<updated>2026-04-16T12:06:11Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Moodle_video_tutorials&amp;diff=99208</id>
		<title>Moodle video tutorials</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Moodle_video_tutorials&amp;diff=99208"/>
		<updated>2013-02-15T13:17:30Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Video tutorials in English */ removed dead link and added one for webanywhere&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are a large number of free online video tutorials about Moodle and this page collates them for Moodle 2. If you have made some Moodle 2 video tutorials or have a link to some free Moodle 2 video tutorials, please add them here.&lt;br /&gt;
&lt;br /&gt;
==Video tutorials in English==&lt;br /&gt;
*[http://www.youtube.com/moodlehq Videos made by Moodle HQ]&lt;br /&gt;
*[http://youtube.com/usingmoodle video tutorials explaining the new features of Moodle 2]&lt;br /&gt;
*[http://www.lynda.com/Moodle-2-0-tutorials/Moodle-2-Essential-Training-for-Teachers/85410-2.html some free video tutorials from lynda.com]&lt;br /&gt;
*[http://www.youtube.com/HRDNZMoodlePartner Videos made by HRDNZ]&lt;br /&gt;
*[http://www.webanywhere.co.uk/video Videos made by Webanywhere]&lt;br /&gt;
&lt;br /&gt;
==Video tutorials in other languages==&lt;br /&gt;
*[http://youtube.com/Moodle2Ourlearning  video tutorials in French/en Français]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Moodle manuals]]&lt;br /&gt;
*[[Moodle presentations]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=ad-hoc_contributed_reports&amp;diff=97678</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=ad-hoc_contributed_reports&amp;diff=97678"/>
		<updated>2012-05-14T13:59:01Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Number of Quizes per Course */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==User and Role Report==&lt;br /&gt;
===Detailed ACTIONs for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT r.name,l.action, count( l.userid ) as counter&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE ra.roleid IN (3,4,5)&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
ORDER BY counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 1.9.x)===&lt;br /&gt;
&lt;br /&gt;
Reports a site global list of all users enroled in each course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user.firstname AS Firstname,&lt;br /&gt;
user.lastname AS Lastname,&lt;br /&gt;
user.email AS Email,&lt;br /&gt;
user.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=asg.roleid)&lt;br /&gt;
FROM&lt;br /&gt;
prefix_user AS user,&lt;br /&gt;
prefix_course AS course,&lt;br /&gt;
prefix_role_assignments AS asg&lt;br /&gt;
INNER JOIN prefix_context AS context ON asg.contextid=context.id   &lt;br /&gt;
WHERE&lt;br /&gt;
context.contextlevel = 50&lt;br /&gt;
AND&lt;br /&gt;
user.id=asg.userid&lt;br /&gt;
AND&lt;br /&gt;
context.instanceid=course.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 2.x)===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user2.firstname AS Firstname,&lt;br /&gt;
user2.lastname AS Lastname,&lt;br /&gt;
user2.email AS Email,&lt;br /&gt;
user2.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT shortname FROM prefix_role WHERE id=en.roleid) as Role&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=en.roleid) as RoleName&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course as course &lt;br /&gt;
JOIN prefix_enrol AS en ON en.courseid = course.id&lt;br /&gt;
JOIN prefix_user_enrolments AS ue ON ue.enrolid = en.id&lt;br /&gt;
JOIN prefix_user AS user2 ON ue.userid = user2.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Permissions Overides on Categories===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712834 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT rc.id, ct.instanceid, ccat.name, rc.roleid, rc.capability, rc.permission, &lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( rc.timemodified ) , &#039;%Y-%m-%d&#039; ) AS timemodified, rc.modifierid, ct.instanceid, ct.path, ct.depth&lt;br /&gt;
FROM `prefix_role_capabilities` AS rc&lt;br /&gt;
INNER JOIN `prefix_context` AS ct ON rc.contextid = ct.id&lt;br /&gt;
INNER JOIN `prefix_course_categories` AS ccat ON ccat.id = ct.instanceid&lt;br /&gt;
AND `contextlevel` =40&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;Totally Opened Courses&amp;quot; (visible, opened to guests, with no password)===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712837 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id , category , fullname , shortname , enrollable&lt;br /&gt;
FROM `prefix_course`&lt;br /&gt;
WHERE `guest` =1&lt;br /&gt;
AND `password` = &amp;quot;&amp;quot;&lt;br /&gt;
AND `visible` =1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;loggedin users&amp;quot; from the last 120 days===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id,username,FROM_UNIXTIME(`lastlogin`) as days &lt;br /&gt;
FROM `prefix_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;and user count for that same population:&#039;&#039;&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(id) as Users  FROM `prefix_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Students in all courses of some institute===&lt;br /&gt;
What is the status (deleted or not) of all Students (roleid = 5) in all courses of some Institute&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname, u.firstname, u.lastname, u.deleted&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
AND u.institution = &#039;please enter school name here&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Full User info (for deleted users)===&lt;br /&gt;
Including extra custom profile fields (from mdl_user_info_data)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT * &lt;br /&gt;
FROM prefix_user as u &lt;br /&gt;
JOIN prefix_user_info_data as uid ON uid.userid = u.id &lt;br /&gt;
JOIN prefix_user_info_field as uif ON (uid.fieldid = uif.id AND uif.shortname = &#039;class&#039;)&lt;br /&gt;
WHERE `deleted` = &amp;quot;1&amp;quot; and `institution`=&amp;quot;your school name&amp;quot; and `department` = &amp;quot;your department&amp;quot; and `data` = &amp;quot;class level and number&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===User&#039;s courses===&lt;br /&gt;
change &amp;quot;u.id = 2&amp;quot; with a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname, u.lastname, c.id, c.fullname&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE u.id = 2&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Special Roles===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.roleid,r.name&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,ra.userid,&#039;&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Username&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_context AS ctx ON (ctx.id = ra.contextid AND ctx.contextlevel = 50)&lt;br /&gt;
JOIN prefix_course AS c ON ctx.instanceid = c.id&lt;br /&gt;
WHERE ra.roleid &amp;gt; 6&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Courses without Teachers===&lt;br /&gt;
Actually, shows the number of Teachers in a course.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id) AS Teachers&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
ORDER BY Teachers ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List of users who have been enrolled for more than 4 weeks===&lt;br /&gt;
For Moodle 2.2 , by  Isuru Madushanka Weerarathna &lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT uenr.userid As User, IF(enr.courseid=enr.courseid ,&#039;Y&#039;,&#039;N&#039;) As Enrolled, &lt;br /&gt;
IF(DATEDIFF(NOW(), FROM_UNIXTIME(uenr.timecreated))&amp;gt;=28,&#039;Y&#039;,&#039;N&#039;) As EnrolledMoreThan4Weeks&lt;br /&gt;
FROM mdl_enrol As enr, mdl_user_enrolments AS uenr&lt;br /&gt;
WHERE enr.id = uenr.enrolid AND enr.status = uenr.statu&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Log Acivity Reports==&lt;br /&gt;
===Detailed &amp;quot;VIEW&amp;quot; ACTION for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT l.action, count( l.userid ) as counter , r.name&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN `prefix_role` AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE (ra.roleid IN (3,4,5)) AND (l.action LIKE &#039;%view%&#039; )&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
order by r.name,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Total Activity of Roles:&amp;quot;Teacher&amp;quot; and &amp;quot;None-Editing Teacher&amp;quot; by Dates and by Hours===&lt;br /&gt;
The output columns of this report table can be used as base for a Pivot-Table&lt;br /&gt;
which will show the amount of &#039;&#039;&#039;activity&#039;&#039;&#039; per &#039;&#039;&#039;hour&#039;&#039;&#039; per &#039;&#039;&#039;days&#039;&#039;&#039; in 3D graph view.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%Y/%m/%d&#039; ) AS grptimed ,&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%k&#039; ) AS grptimeh  , count( l.userid ) AS counter &lt;br /&gt;
FROM `prefix_log` AS l&lt;br /&gt;
JOIN prefix_user AS u ON u.id = l.userid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
WHERE ra.roleid IN (3,4)&lt;br /&gt;
GROUP BY grptimed,grptimeh&lt;br /&gt;
ORDER BY grptimed,grptimeh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===How many LOGINs per user and user&#039;s Activity===&lt;br /&gt;
+ link username to a user activity graph report&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,u.id,&#039;&amp;amp;mode=alllogs&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) as Username&lt;br /&gt;
,count(*) as logins&lt;br /&gt;
,(SELECT count(*) FROM prefix_log WHERE userid = l.userid GROUP BY userid) as Activity &lt;br /&gt;
FROM prefix_log as l JOIN prefix_user as u ON l.userid = u.id &lt;br /&gt;
WHERE `action` LIKE &#039;%login%&#039; group by userid&lt;br /&gt;
ORDER BY Activity DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Course Reports==&lt;br /&gt;
===Most Active courses===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, l.course courseId, c.fullname coursename&lt;br /&gt;
FROM prefix_log l INNER JOIN prefix_course c ON l.course = c.id&lt;br /&gt;
GROUP BY courseId&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Active courses, advanced===&lt;br /&gt;
Including: Teacher&#039;s name, link to the course, All types of log activities, special YEAR generated field, Activities and Resource count, enrolled Student count&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course &lt;br /&gt;
&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher&lt;br /&gt;
&lt;br /&gt;
,CASE &lt;br /&gt;
  WHEN c.fullname LIKE &#039;%תשע&#039; THEN &#039;תשע&#039;&lt;br /&gt;
  WHEN c.fullname LIKE &#039;%תשעא&#039; THEN &#039;תשעא&#039;&lt;br /&gt;
  WHEN c.fullname LIKE &#039;%תשעב&#039; THEN &#039;תשעב&#039;&lt;br /&gt;
END AS Year&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_course_modules cm WHERE cm.course = l.course) Modules&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_log l &lt;br /&gt;
INNER JOIN prefix_course c ON l.course = c.id&lt;br /&gt;
GROUP BY c.id&lt;br /&gt;
HAVING Modules &amp;gt; 2&lt;br /&gt;
ORDER BY Year DESC, hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===RESOURCE count for each COURSE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) count, l.course, c.fullname coursename&lt;br /&gt;
FROM prefix_resource l INNER JOIN prefix_course c on l.course = c.id&lt;br /&gt;
GROUP BY course&lt;br /&gt;
ORDER BY count DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Courses that are defined as using GROUPs===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/group/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,(SELECT count(*) FROM prefix_course_modules cm WHERE cm.course = c.id) Modules&lt;br /&gt;
 FROM `prefix_course` AS c&lt;br /&gt;
WHERE groupmode &amp;gt; 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List all Courses in and below a certain category===&lt;br /&gt;
Use this SQL code to retrieve all courses that exist in or under a set category.&lt;br /&gt;
&lt;br /&gt;
$s should be the id of the category you want to know about...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course. * , prefix_course_categories. *&lt;br /&gt;
FROM prefix_course, prefix_course_categories&lt;br /&gt;
WHERE prefix_course.category = prefix_course_categories.id&lt;br /&gt;
AND (&lt;br /&gt;
prefix_course_categories.path LIKE &#039;/$s/%&#039;&lt;br /&gt;
OR prefix_course_categories.path LIKE &#039;/$s&#039;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
===List all Categories in one level below a certain category===&lt;br /&gt;
Use this PHP code to retrieve a list of all categories below a certain category.&lt;br /&gt;
&lt;br /&gt;
$s should be the id of the top level category you are interested in.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once(&#039;./config.php&#039;);&lt;br /&gt;
&lt;br /&gt;
$parent_id = $s;&lt;br /&gt;
&lt;br /&gt;
$categories= array();&lt;br /&gt;
&lt;br /&gt;
$categories = get_categories($parent_id);&lt;br /&gt;
&lt;br /&gt;
echo &#039;&amp;lt;ol&amp;gt;&#039;;&lt;br /&gt;
foreach ($categories as $category)&lt;br /&gt;
        {&lt;br /&gt;
        echo &#039;&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;&#039;.$CFG-&amp;gt;wwwroot.&#039;/course/category.php?id=&#039;.$category-&amp;gt;id.&#039;&amp;quot;&amp;gt;&#039;.$category-&amp;gt;name.&#039;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#039;;&lt;br /&gt;
        }&lt;br /&gt;
echo &#039;&amp;lt;/ol&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Blog activity per Course (not including VIEW)===&lt;br /&gt;
Filter activity logging to some specific Course Categories!&lt;br /&gt;
+ link course name to actual course (for quick reference)&lt;br /&gt;
(you can change %blog% to %wiki% to filter down all wiki activity or any other module you wish)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID&lt;br /&gt;
,m.name ,count(cm.id) as counter &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS Students&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE `module` LIKE &#039;%blog%&#039; AND course = c.id AND action NOT LIKE &#039;%view%&#039; ) as BlogActivity&lt;br /&gt;
FROM `prefix_course_modules` as cm JOIN prefix_modules as m ON cm.module=m.id JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%blog%&#039; AND c.category IN ( 8,13,15)&lt;br /&gt;
GROUP BY cm.course,cm.module order by counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Courses which uploaded a Syllabus file===&lt;br /&gt;
+ under specific Category&lt;br /&gt;
+ show first Teacher in that course&lt;br /&gt;
+ link Course&#039;s fullname to actual course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) as Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user as u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) as Teacher&lt;br /&gt;
FROM prefix_resource as r &lt;br /&gt;
JOIN prefix_course as c ON r.course = c.id&lt;br /&gt;
WHERE ( r.name LIKE &#039;%סילבוס%&#039; OR r.name LIKE &#039;%סילאבוס%&#039; OR r.name LIKE &#039;%syllabus%&#039; OR r.name LIKE &#039;%תכנית הקורס%&#039; ) &lt;br /&gt;
AND c.category IN (10,18,26,13,28)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grade Reports==&lt;br /&gt;
===Site-Wide Grade Report with All Items===&lt;br /&gt;
Shows grades for all course items along with course totals for each student.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
c.fullname AS &#039;Course&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id &lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Site-Wide Grade Report with Just Course Totals===&lt;br /&gt;
A second site-wide grade report for all students that just shows course totals.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id AND gi.itemtype = &#039;course&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Learner report by Learner with grades===&lt;br /&gt;
Which Learners in which course and what are the grades&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;Name&#039; , u.lastname AS &#039;Surname&#039;, c.fullname AS &#039;Course&#039;, cc.name AS &#039;Category&#039;, &lt;br /&gt;
CASE WHEN gi.itemtype = &#039;Course&#039;    &lt;br /&gt;
THEN c.fullname + &#039; Course Total&#039;  &lt;br /&gt;
ELSE gi.itemname &lt;br /&gt;
END AS &#039;Item Name&#039;, ROUND(gg.finalgrade,2) AS Score,ROUND(gg.rawgrademax,2) AS Max, ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) as Percentage,&lt;br /&gt;
&lt;br /&gt;
if (ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) &amp;gt; 79,&#039;Yes&#039; , &#039;No&#039;) as Pass&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c &lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid &lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id &lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid &lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id &lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid &lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category &lt;br /&gt;
WHERE  gi.courseid = c.id and gi.itemname != &#039;Attendance&#039;&lt;br /&gt;
ORDER BY `Name` ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Activity Module Reports==&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each MODULE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT module,action,count(id) as counter&lt;br /&gt;
FROM prefix_log&lt;br /&gt;
GROUP BY module,action&lt;br /&gt;
ORDER BY module,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Most popular ACTIVITY===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, module&lt;br /&gt;
FROM prefix_log l&lt;br /&gt;
WHERE module != &#039;login&#039; AND module != &#039;course&#039; AND module != &#039;role&#039;&lt;br /&gt;
GROUP BY module&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===System wide use of ACTIVITIES and RESOURCES===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT count( cm.id ) AS counter, m.name&lt;br /&gt;
FROM `prefix_course_modules` AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
GROUP BY cm.module&lt;br /&gt;
ORDER BY counter DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LOG file ACTIONS per MODULE per COURSE (IDs)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select course,module,action,count(action) as summa from prefix_log&lt;br /&gt;
where action &amp;lt;&amp;gt; &#039;new&#039;&lt;br /&gt;
group by course,action,module&lt;br /&gt;
order by course,module,action&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===System Wide usage count of various course Activities===&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
Like: Forum, Wiki, Blog, Assignment, Database,&lt;br /&gt;
#Within specific category&lt;br /&gt;
#Teacher name in course&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher &lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%blog%&#039;) AS Blogs&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM &lt;br /&gt;
prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%forum%&#039;) AS Forums&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%data%&#039;) AS Databses&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%assignment%&#039;) AS Assignments&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 18)&lt;br /&gt;
ORDER BY Wikis DESC,Blogs DESC, Forums DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Detailed WIKI activity (per wiki per course)===&lt;br /&gt;
Including Number of Students in course (for reference)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID  &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id ) AS Students&lt;br /&gt;
,m.name&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%updat%&#039; ) as &#039;UPDAT E&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%annotate%&#039; ) as ANNOTATE&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%comment%&#039; ) as COMMENT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%add%&#039; ) as &#039;A DD&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%edit%&#039; ) as EDIT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action NOT LIKE &#039;%view%&#039; ) as &#039;All (NO View)&#039;&lt;br /&gt;
FROM `prefix_course_modules` as cm &lt;br /&gt;
JOIN prefix_modules as m ON cm.module=m.id &lt;br /&gt;
JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
GROUP BY cm.course,cm.module&lt;br /&gt;
ORDER BY &#039;All (NO View)&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Wiki usage, system wide===&lt;br /&gt;
(you can filter the output by selecting some specific course categories : &amp;quot;WHERE c.category IN ( 8,13,15)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039;) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%add%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ADD&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%edit%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;EDIT&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%annotate%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ANNOTATE&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%comments%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;Comments&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_ouwiki_pages as ouwp&lt;br /&gt;
JOIN prefix_ouwiki as ouw ON ouw.id = ouwp.subwikiid&lt;br /&gt;
WHERE ouw.course = c.id GROUP BY ouw.course  ) as OUWikiPages&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( DISTINCT nwp.pagename ) FROM prefix_wiki_pages AS nwp&lt;br /&gt;
JOIN prefix_wiki AS nw ON nw.id = nwp.dfwiki WHERE nw.course = c.id ) As NWikiPages&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 8,13,15)&lt;br /&gt;
HAVING Wikis &amp;gt; 0&lt;br /&gt;
ORDER BY &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Aggregated Teacher activity by &amp;quot;WEB2&amp;quot; Modules===&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
The NV column shows activity without VIEW log activity&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.userid, u.firstname,u.lastname&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039;) AS Wiki&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Wiki_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039;) AS Forum&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Forum_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039;) AS Blog&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Blog_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039;) AS Assignment&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Assignment_NV&lt;br /&gt;
FROM prefix_role_assignments AS ra &lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid &lt;br /&gt;
WHERE ra.roleid = 3 &lt;br /&gt;
GROUP BY ra.userid&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List all the certificates issued, sort by variables in the custom profile fields===&lt;br /&gt;
Note: The SQL queries look intimidating at first, but isn&#039;t really that difficult to learn. I&#039;ve seen in the forums that users wanted to do &#039;site-wide&#039; groups in 1.9x. This is sort of the idea. It pulls all the certificates issued to all users sorted by the custom profile fields, which in my case is the Units or Depts (i.e. my site wide groups). Why certificates? I&#039;ve explored with both grades and quizzes, the course admins are not really interested in the actual grades but whether the learner received a certificate (i.e. passed the course with x, y, z activities). It also saves me from creating groups and assigning them into the right groups. Even assigning in bulk is not efficient, since I have upward of 25 groups per course and constantly new learners enrolling in courses. The limitation is something to do with the server? as it only pull 5000 rows of data. If anyone figured out how to change this, please let me know. In the meantime, the work around is to pull only a few units/depts at a time to limit the number of rows. This is fine at the moment, since each course admin are only responsible for certain units/depts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME(prefix_certificate_issues.timecreated), &#039;%Y/%m/%d&#039; ) AS Date,&lt;br /&gt;
prefix_certificate_issues.classname AS Topic,&lt;br /&gt;
prefix_certificate.name AS Certificate,&lt;br /&gt;
prefix_certificate_issues.studentname as Name,&lt;br /&gt;
prefix_user_info_data.data AS Units&lt;br /&gt;
&lt;br /&gt;
FROM&lt;br /&gt;
prefix_certificate_issues&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_user_info_data&lt;br /&gt;
on prefix_certificate_issues.userid = prefix_user_info_data.userid&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_certificate&lt;br /&gt;
on prefix_certificate_issues.certificateid = prefix_certificate.id&lt;br /&gt;
&lt;br /&gt;
WHERE prefix_user_info_data.data=&#039;Unit 1&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 2&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 3&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY Units, Name, Topic ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Counter Blog usage in Courses,system wide===&lt;br /&gt;
What teachers in what courses, uses blogs and how many + student count in that course.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT ( @counter := @counter+1) as counter, &lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user AS u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = c.id AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%blog%&#039;) AS Blogs&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c, (SELECT @counter := 0) as s_init&lt;br /&gt;
WHERE c.category IN ( 8,13,15)&lt;br /&gt;
HAVING Blogs &amp;gt; 0&lt;br /&gt;
ORDER BY Blogs DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Assignment Module Reports==&lt;br /&gt;
===All Ungraded Assignments===&lt;br /&gt;
Returns all the submitted assignments that still need grading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id&lt;br /&gt;
and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Ungraded Assignments w/ Link===&lt;br /&gt;
Returns all the submitted assignments that still need grading, along with a link that goes directly to the submission to grade it. The links work if you view the report within Moodle.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
&#039;&amp;lt;a href=&amp;quot;http://education.varonis.com/mod/assignment/submissions.php&#039; + char(63) +&lt;br /&gt;
+ &#039;id=&#039; + cast(cm.id as varchar) + &#039;&amp;amp;userid=&#039; + cast(u.id as varchar) &lt;br /&gt;
+ &#039;&amp;amp;mode=single&amp;amp;filter=0&amp;amp;offset=2&amp;quot;&amp;gt;&#039; + a.name + &#039;&amp;lt;/a&amp;gt;&#039;&lt;br /&gt;
AS &amp;quot;Assignmentlink&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Who is using &amp;quot;Single File Upload&amp;quot; assignment===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
 &lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher &lt;br /&gt;
&lt;br /&gt;
,ass.name as &amp;quot;Assignment Name&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM &lt;br /&gt;
prefix_assignment as ass&lt;br /&gt;
&lt;br /&gt;
JOIN &lt;br /&gt;
prefix_course as c ON c.id = ass.course&lt;br /&gt;
&lt;br /&gt;
WHERE `assignmenttype` LIKE &#039;uploadsingle&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Resource Module Reports==&lt;br /&gt;
===List &amp;quot;Recently uploaded files&amp;quot;===&lt;br /&gt;
see what users are uploading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT FROM_UNIXTIME(time,&#039;%Y %M %D %h:%i:%s&#039;) as time ,ip,userid,url,info  &lt;br /&gt;
FROM `prefix_log` &lt;br /&gt;
WHERE `action` LIKE &#039;upload&#039; &lt;br /&gt;
ORDER BY `prefix_log`.`time`  DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List Courses that loaded a specific file: &amp;quot;X&amp;quot;===&lt;br /&gt;
Did the Teacher (probably) uploaded course&#039;s Syllabus ?&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname  FROM `prefix_log` as l &lt;br /&gt;
JOIN prefix_course as c ON c.id = l.course &lt;br /&gt;
WHERE `action` LIKE &#039;%upload%&#039; AND ( info LIKE &#039;%Syllabus%&#039; OR info LIKE &#039;%Sylabus%&#039; ) GROUP BY c.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All resources that link to some specific external website===&lt;br /&gt;
+ link to course&lt;br /&gt;
+ who&#039;s the teacher&lt;br /&gt;
+ link to external resource&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/resource/view.php?id=&#039;,r.id,&#039;&amp;quot;&amp;gt;&#039;,r.name,&#039;&amp;lt;/a&amp;gt;&#039;) AS Resource&lt;br /&gt;
FROM prefix_resource AS r &lt;br /&gt;
JOIN prefix_course AS c ON r.course = c.id&lt;br /&gt;
WHERE r.reference LIKE &#039;http://info.oranim.ac.il/home%&#039; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Compose Web Page&amp;quot; RESOURCE count===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT course,prefix_course.fullname, COUNT(*) AS Total&lt;br /&gt;
FROM `prefix_resource`&lt;br /&gt;
JOIN `prefix_course` ON prefix_course.id = prefix_resource.course&lt;br /&gt;
WHERE type=&#039;html&#039;&lt;br /&gt;
GROUP BY course&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Resource count in courses===&lt;br /&gt;
+ (First)Teacher name&lt;br /&gt;
+ Where course is inside some specific Categories&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
COUNT(*) AS count&lt;br /&gt;
,r.course &lt;br /&gt;
,c.shortname shortname&lt;br /&gt;
,c.fullname coursename&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user as u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = r.course AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
FROM prefix_resource r &lt;br /&gt;
JOIN prefix_course c ON r.course = c.id&lt;br /&gt;
WHERE c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY r.course&lt;br /&gt;
ORDER BY COUNT(*) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Forum Module Reports==&lt;br /&gt;
===FORUM use Count per COURSE -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===FORUM use Count per COURSE by type -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, prefix_forum.type, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course,prefix_forum.type&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Activity In Forums===&lt;br /&gt;
Trying to figure out how much real activity we have in Forums by aggregating:&lt;br /&gt;
Users in Course, Number of Posts, Number of Discussions, Unique student post, Unique student discussions, Number of Teachers , Number of Students, ratio between unique Student posts and the number of students in the Course...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.fullname,f.name,f.type &lt;br /&gt;
,(SELECT count(id) FROM prefix_forum_discussions as fd WHERE f.id = fd.forum) as Discussions&lt;br /&gt;
,(SELECT count(distinct fd.userid) FROM prefix_forum_discussions as fd WHERE fd.forum = f.id) as UniqueUsersDiscussions&lt;br /&gt;
,(SELECT count(fp.id) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as Posts&lt;br /&gt;
,(SELECT count(distinct fp.userid) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as UniqueUsersPosts&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Students&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS StudentsCount&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Teachers&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =3&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS &#039;Teacher&amp;lt;br/&amp;gt;Count&#039;&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid IN (3,5)&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS UserCount&lt;br /&gt;
, (SELECT (UniqueUsersDiscussions / StudentsCount )) as StudentDissUsage&lt;br /&gt;
, (SELECT (UniqueUsersPosts /StudentsCount)) as StudentPostUsage&lt;br /&gt;
FROM prefix_forum as f &lt;br /&gt;
JOIN prefix_course as c ON f.course = c.id&lt;br /&gt;
WHERE `type` != &#039;news&#039;&lt;br /&gt;
ORDER BY StudentPostUsage DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Forum type:NEWS===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT f.id, f.name&lt;br /&gt;
FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
JOIN prefix_forum AS f ON cm.instance = f.id&lt;br /&gt;
WHERE m.name = &#039;forum&#039;&lt;br /&gt;
AND f.type = &#039;news&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All new forum NEWS items (discussions) from all my Courses===&lt;br /&gt;
change &amp;quot;userid = 26&amp;quot; and &amp;quot;id = 26&amp;quot; to a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname,f.name,fd.name,FROM_UNIXTIME(fd.timemodified ,&amp;quot;%d %M %Y &amp;quot;) as Date&lt;br /&gt;
FROM prefix_forum_discussions as fd &lt;br /&gt;
JOIN prefix_forum as f ON f.id = fd.forum &lt;br /&gt;
JOIN prefix_course as c ON c.id = f.course &lt;br /&gt;
JOIN prefix_user_lastaccess as ul ON (c.id = ul.courseid AND ul.userid = 26)&lt;br /&gt;
WHERE fd.timemodified &amp;gt; ul.timeaccess  &lt;br /&gt;
 AND fd.forum IN (SELECT f.id&lt;br /&gt;
 FROM prefix_course_modules AS cm&lt;br /&gt;
 JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
 JOIN prefix_forum AS f ON cm.instance = f.id&lt;br /&gt;
 WHERE m.name = &#039;forum&#039;&lt;br /&gt;
 AND f.type = &#039;news&#039;)&lt;br /&gt;
  AND c.id IN (SELECT c.id&lt;br /&gt;
   FROM prefix_course AS c&lt;br /&gt;
   JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
   JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
   JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
   WHERE u.id = 26) ORDER BY `fd`.`timemodified` DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===News Forum - Discussions COUNT===&lt;br /&gt;
Which is actually... How much instructions students get from their teachers&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname ,&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user AS u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = c.id AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/forum/view.php?f=&#039;,fd.forum,&#039;&amp;quot;&amp;gt;&#039;,count(fd.id),&#039;&amp;lt;/a&amp;gt;&#039;) AS DiscussionsSum&lt;br /&gt;
FROM prefix_forum_discussions AS fd&lt;br /&gt;
INNER JOIN prefix_forum AS f ON f.id = fd.forum&lt;br /&gt;
INNER JOIN prefix_course AS c ON c.id = f.course&lt;br /&gt;
WHERE f.type = &#039;news&#039; AND c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY fd.forum&lt;br /&gt;
ORDER BY count(fd.id) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quiz Module Reports==&lt;br /&gt;
===Generate a list of instructors and their email addresses for those courses that has &amp;quot;essay questions&amp;quot; in their quizzes===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT qu.id AS quiz_id, qu.course AS course_id, qu.questions,&lt;br /&gt;
                co.fullname AS course_fullname, co.shortname AS course_shortname,&lt;br /&gt;
                qu.name AS quiz_name, FROM_UNIXTIME(qu.timeopen) AS quiz_timeopen, FROM_UNIXTIME(qu.timeclose) AS quiz_timeclose,&lt;br /&gt;
                u.firstname, u.lastname, u.email,&lt;br /&gt;
FROM mdl_quiz qu, mdl_course co, mdl_role re, mdl_context ct, mdl_role_assignments ra, mdl_user u&lt;br /&gt;
WHERE FROM_UNIXTIME(timeopen) &amp;gt; &#039;2008-05-14&#039; AND&lt;br /&gt;
                qu.course = co.id AND&lt;br /&gt;
                co.id = ct.instanceid AND&lt;br /&gt;
                ra.roleid = re.id AND&lt;br /&gt;
                re.name = &#039;Teacher&#039; AND&lt;br /&gt;
                ra.contextid = ct.id AND&lt;br /&gt;
                ra.userid = u.id&lt;br /&gt;
 &lt;br /&gt;
SELECT Count(&#039;x&#039;) As NumOfStudents&lt;br /&gt;
                                FROM mdl_role_assignments a&lt;br /&gt;
                                JOIN mdl_user u ON userid = u.id&lt;br /&gt;
                                WHERE roleid = 5 AND contextid = (SELECT id FROM mdl_context WHERE instanceid = 668 AND contextlevel = 50)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Number of Quizes per Course===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT count(*)&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/quiz/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;Link&amp;lt;/a&amp;gt;&#039;) AS Quizes&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course_modules cm&lt;br /&gt;
JOIN prefix_course c ON c.id = cm.course&lt;br /&gt;
JOIN prefix_modules as m ON m.id = cm.module&lt;br /&gt;
WHERE m.name LIKE &#039;quiz&#039;&lt;br /&gt;
GROUP BY c.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=ad-hoc_contributed_reports&amp;diff=97460</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=ad-hoc_contributed_reports&amp;diff=97460"/>
		<updated>2012-05-03T12:57:30Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* List all Courses in and below a certain category */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==User and Role Report==&lt;br /&gt;
===Detailed ACTIONs for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT r.name,l.action, count( l.userid ) as counter&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE ra.roleid IN (3,4,5)&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
ORDER BY counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 1.9.x)===&lt;br /&gt;
&lt;br /&gt;
Reports a site global list of all users enroled in each course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user.firstname AS Firstname,&lt;br /&gt;
user.lastname AS Lastname,&lt;br /&gt;
user.email AS Email,&lt;br /&gt;
user.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=asg.roleid)&lt;br /&gt;
FROM&lt;br /&gt;
prefix_user AS user,&lt;br /&gt;
prefix_course AS course,&lt;br /&gt;
prefix_role_assignments AS asg&lt;br /&gt;
INNER JOIN prefix_context AS context ON asg.contextid=context.id   &lt;br /&gt;
WHERE&lt;br /&gt;
context.contextlevel = 50&lt;br /&gt;
AND&lt;br /&gt;
user.id=asg.userid&lt;br /&gt;
AND&lt;br /&gt;
context.instanceid=course.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 2.x)===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user2.firstname AS Firstname,&lt;br /&gt;
user2.lastname AS Lastname,&lt;br /&gt;
user2.email AS Email,&lt;br /&gt;
user2.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT shortname FROM prefix_role WHERE id=en.roleid) as Role&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=en.roleid) as RoleName&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course as course &lt;br /&gt;
JOIN prefix_enrol AS en ON en.courseid = course.id&lt;br /&gt;
JOIN prefix_user_enrolments AS ue ON ue.enrolid = en.id&lt;br /&gt;
JOIN prefix_user AS user2 ON ue.userid = user2.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Permissions Overides on Categories===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712834 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT rc.id, ct.instanceid, ccat.name, rc.roleid, rc.capability, rc.permission, &lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( rc.timemodified ) , &#039;%Y-%m-%d&#039; ) AS timemodified, rc.modifierid, ct.instanceid, ct.path, ct.depth&lt;br /&gt;
FROM `prefix_role_capabilities` AS rc&lt;br /&gt;
INNER JOIN `prefix_context` AS ct ON rc.contextid = ct.id&lt;br /&gt;
INNER JOIN `prefix_course_categories` AS ccat ON ccat.id = ct.instanceid&lt;br /&gt;
AND `contextlevel` =40&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;Totally Opened Courses&amp;quot; (visible, opened to guests, with no password)===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712837 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id , category , fullname , shortname , enrollable&lt;br /&gt;
FROM `prefix_course`&lt;br /&gt;
WHERE `guest` =1&lt;br /&gt;
AND `password` = &amp;quot;&amp;quot;&lt;br /&gt;
AND `visible` =1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;loggedin users&amp;quot; from the last 120 days===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id,username,FROM_UNIXTIME(`lastlogin`) as days &lt;br /&gt;
FROM `prefix_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;and user count for that same population:&#039;&#039;&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(id) as Users  FROM `prefix_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Students in all courses of some institute===&lt;br /&gt;
What is the status (deleted or not) of all Students (roleid = 5) in all courses of some Institute&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname, u.firstname, u.lastname, u.deleted&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
AND u.institution = &#039;please enter school name here&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Full User info (for deleted users)===&lt;br /&gt;
Including extra custom profile fields (from mdl_user_info_data)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT * &lt;br /&gt;
FROM prefix_user as u &lt;br /&gt;
JOIN prefix_user_info_data as uid ON uid.userid = u.id &lt;br /&gt;
JOIN prefix_user_info_field as uif ON (uid.fieldid = uif.id AND uif.shortname = &#039;class&#039;)&lt;br /&gt;
WHERE `deleted` = &amp;quot;1&amp;quot; and `institution`=&amp;quot;your school name&amp;quot; and `department` = &amp;quot;your department&amp;quot; and `data` = &amp;quot;class level and number&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===User&#039;s courses===&lt;br /&gt;
change &amp;quot;u.id = 2&amp;quot; with a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname, u.lastname, c.id, c.fullname&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE u.id = 2&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Special Roles===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.roleid,r.name&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,ra.userid,&#039;&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Username&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_context AS ctx ON (ctx.id = ra.contextid AND ctx.contextlevel = 50)&lt;br /&gt;
JOIN prefix_course AS c ON ctx.instanceid = c.id&lt;br /&gt;
WHERE ra.roleid &amp;gt; 6&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Courses without Teachers===&lt;br /&gt;
Actually, shows the number of Teachers in a course.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id) AS Teachers&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
ORDER BY Teachers ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List of users who have been enrolled for more than 4 weeks===&lt;br /&gt;
For Moodle 2.2 , by  Isuru Madushanka Weerarathna &lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT uenr.userid As User, IF(enr.courseid=enr.courseid ,&#039;Y&#039;,&#039;N&#039;) As Enrolled, &lt;br /&gt;
IF(DATEDIFF(NOW(), FROM_UNIXTIME(uenr.timecreated))&amp;gt;=28,&#039;Y&#039;,&#039;N&#039;) As EnrolledMoreThan4Weeks&lt;br /&gt;
FROM mdl_enrol As enr, mdl_user_enrolments AS uenr&lt;br /&gt;
WHERE enr.id = uenr.enrolid AND enr.status = uenr.statu&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Log Acivity Reports==&lt;br /&gt;
===Detailed &amp;quot;VIEW&amp;quot; ACTION for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT l.action, count( l.userid ) as counter , r.name&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN `prefix_role` AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE (ra.roleid IN (3,4,5)) AND (l.action LIKE &#039;%view%&#039; )&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
order by r.name,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Total Activity of Roles:&amp;quot;Teacher&amp;quot; and &amp;quot;None-Editing Teacher&amp;quot; by Dates and by Hours===&lt;br /&gt;
The output columns of this report table can be used as base for a Pivot-Table&lt;br /&gt;
which will show the amount of &#039;&#039;&#039;activity&#039;&#039;&#039; per &#039;&#039;&#039;hour&#039;&#039;&#039; per &#039;&#039;&#039;days&#039;&#039;&#039; in 3D graph view.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%Y/%m/%d&#039; ) AS grptimed ,&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%k&#039; ) AS grptimeh  , count( l.userid ) AS counter &lt;br /&gt;
FROM `prefix_log` AS l&lt;br /&gt;
JOIN prefix_user AS u ON u.id = l.userid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
WHERE ra.roleid IN (3,4)&lt;br /&gt;
GROUP BY grptimed,grptimeh&lt;br /&gt;
ORDER BY grptimed,grptimeh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===How many LOGINs per user and user&#039;s Activity===&lt;br /&gt;
+ link username to a user activity graph report&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,u.id,&#039;&amp;amp;mode=alllogs&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) as Username&lt;br /&gt;
,count(*) as logins&lt;br /&gt;
,(SELECT count(*) FROM prefix_log WHERE userid = l.userid GROUP BY userid) as Activity &lt;br /&gt;
FROM prefix_log as l JOIN prefix_user as u ON l.userid = u.id &lt;br /&gt;
WHERE `action` LIKE &#039;%login%&#039; group by userid&lt;br /&gt;
ORDER BY Activity DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Course Reports==&lt;br /&gt;
===Most Active courses===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, l.course courseId, c.fullname coursename&lt;br /&gt;
FROM prefix_log l INNER JOIN prefix_course c ON l.course = c.id&lt;br /&gt;
GROUP BY courseId&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Active courses, advanced===&lt;br /&gt;
Including: Teacher&#039;s name, link to the course, All types of log activities, special YEAR generated field, Activities and Resource count, enrolled Student count&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course &lt;br /&gt;
&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher&lt;br /&gt;
&lt;br /&gt;
,CASE &lt;br /&gt;
  WHEN c.fullname LIKE &#039;%תשע&#039; THEN &#039;תשע&#039;&lt;br /&gt;
  WHEN c.fullname LIKE &#039;%תשעא&#039; THEN &#039;תשעא&#039;&lt;br /&gt;
  WHEN c.fullname LIKE &#039;%תשעב&#039; THEN &#039;תשעב&#039;&lt;br /&gt;
END AS Year&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_course_modules cm WHERE cm.course = l.course) Modules&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_log l &lt;br /&gt;
INNER JOIN prefix_course c ON l.course = c.id&lt;br /&gt;
GROUP BY c.id&lt;br /&gt;
HAVING Modules &amp;gt; 2&lt;br /&gt;
ORDER BY Year DESC, hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===RESOURCE count for each COURSE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) count, l.course, c.fullname coursename&lt;br /&gt;
FROM prefix_resource l INNER JOIN prefix_course c on l.course = c.id&lt;br /&gt;
GROUP BY course&lt;br /&gt;
ORDER BY count DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Courses that are defined as using GROUPs===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/group/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,(SELECT count(*) FROM prefix_course_modules cm WHERE cm.course = c.id) Modules&lt;br /&gt;
 FROM `prefix_course` AS c&lt;br /&gt;
WHERE groupmode &amp;gt; 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List all Courses in and below a certain category===&lt;br /&gt;
Use this SQL code to retrieve all courses that exist in or under a set category.&lt;br /&gt;
&lt;br /&gt;
$s should be the id of the category you want to know about...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course. * , prefix_course_categories. *&lt;br /&gt;
FROM prefix_course, prefix_course_categories&lt;br /&gt;
WHERE prefix_course.category = prefix_course_categories.id&lt;br /&gt;
AND (&lt;br /&gt;
prefix_course_categories.path LIKE &#039;/$s/%&#039;&lt;br /&gt;
OR prefix_course_categories.path LIKE &#039;/$s&#039;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
===List all Categories in one level below a certain category===&lt;br /&gt;
Use this PHP code to retrieve a list of all categories below a certain category.&lt;br /&gt;
&lt;br /&gt;
$s should be the id of the top level category you are interested in.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once(&#039;./config.php&#039;);&lt;br /&gt;
&lt;br /&gt;
$parent_id = $s;&lt;br /&gt;
&lt;br /&gt;
$categories= array();&lt;br /&gt;
&lt;br /&gt;
$categories = get_categories($parent_id);&lt;br /&gt;
&lt;br /&gt;
echo &#039;&amp;lt;ol&amp;gt;&#039;;&lt;br /&gt;
foreach ($categories as $category)&lt;br /&gt;
        {&lt;br /&gt;
        echo &#039;&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;&#039;.$CFG-&amp;gt;wwwroot.&#039;/course/category.php?id=&#039;.$category-&amp;gt;id.&#039;&amp;quot;&amp;gt;&#039;.$category-&amp;gt;name.&#039;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#039;;&lt;br /&gt;
        }&lt;br /&gt;
echo &#039;&amp;lt;/ol&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Blog activity per Course (not including VIEW)===&lt;br /&gt;
Filter activity logging to some specific Course Categories!&lt;br /&gt;
+ link course name to actual course (for quick reference)&lt;br /&gt;
(you can change %blog% to %wiki% to filter down all wiki activity or any other module you wish)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID&lt;br /&gt;
,m.name ,count(cm.id) as counter &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS Students&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE `module` LIKE &#039;%blog%&#039; AND course = c.id AND action NOT LIKE &#039;%view%&#039; ) as BlogActivity&lt;br /&gt;
FROM `prefix_course_modules` as cm JOIN prefix_modules as m ON cm.module=m.id JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%blog%&#039; AND c.category IN ( 8,13,15)&lt;br /&gt;
GROUP BY cm.course,cm.module order by counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Courses which uploaded a Syllabus file===&lt;br /&gt;
+ under specific Category&lt;br /&gt;
+ show first Teacher in that course&lt;br /&gt;
+ link Course&#039;s fullname to actual course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) as Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user as u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) as Teacher&lt;br /&gt;
FROM prefix_resource as r &lt;br /&gt;
JOIN prefix_course as c ON r.course = c.id&lt;br /&gt;
WHERE ( r.name LIKE &#039;%סילבוס%&#039; OR r.name LIKE &#039;%סילאבוס%&#039; OR r.name LIKE &#039;%syllabus%&#039; OR r.name LIKE &#039;%תכנית הקורס%&#039; ) &lt;br /&gt;
AND c.category IN (10,18,26,13,28)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grade Reports==&lt;br /&gt;
===Site-Wide Grade Report with All Items===&lt;br /&gt;
Shows grades for all course items along with course totals for each student.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
c.fullname AS &#039;Course&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id &lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Site-Wide Grade Report with Just Course Totals===&lt;br /&gt;
A second site-wide grade report for all students that just shows course totals.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id AND gi.itemtype = &#039;course&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Learner report by Learner with grades===&lt;br /&gt;
Which Learners in which course and what are the grades&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;Name&#039; , u.lastname AS &#039;Surname&#039;, c.fullname AS &#039;Course&#039;, cc.name AS &#039;Category&#039;, &lt;br /&gt;
CASE WHEN gi.itemtype = &#039;Course&#039;    &lt;br /&gt;
THEN c.fullname + &#039; Course Total&#039;  &lt;br /&gt;
ELSE gi.itemname &lt;br /&gt;
END AS &#039;Item Name&#039;, ROUND(gg.finalgrade,2) AS Score,ROUND(gg.rawgrademax,2) AS Max, ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) as Percentage,&lt;br /&gt;
&lt;br /&gt;
if (ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) &amp;gt; 79,&#039;Yes&#039; , &#039;No&#039;) as Pass&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c &lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid &lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id &lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid &lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id &lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid &lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category &lt;br /&gt;
WHERE  gi.courseid = c.id and gi.itemname != &#039;Attendance&#039;&lt;br /&gt;
ORDER BY `Name` ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Activity Module Reports==&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each MODULE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT module,action,count(id) as counter&lt;br /&gt;
FROM prefix_log&lt;br /&gt;
GROUP BY module,action&lt;br /&gt;
ORDER BY module,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Most popular ACTIVITY===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, module&lt;br /&gt;
FROM prefix_log l&lt;br /&gt;
WHERE module != &#039;login&#039; AND module != &#039;course&#039; AND module != &#039;role&#039;&lt;br /&gt;
GROUP BY module&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===System wide use of ACTIVITIES and RESOURCES===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT count( cm.id ) AS counter, m.name&lt;br /&gt;
FROM `prefix_course_modules` AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
GROUP BY cm.module&lt;br /&gt;
ORDER BY counter DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LOG file ACTIONS per MODULE per COURSE (IDs)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select course,module,action,count(action) as summa from prefix_log&lt;br /&gt;
where action &amp;lt;&amp;gt; &#039;new&#039;&lt;br /&gt;
group by course,action,module&lt;br /&gt;
order by course,module,action&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===System Wide usage count of various course Activities===&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
Like: Forum, Wiki, Blog, Assignment, Database,&lt;br /&gt;
#Within specific category&lt;br /&gt;
#Teacher name in course&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher &lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%blog%&#039;) AS Blogs&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM &lt;br /&gt;
prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%forum%&#039;) AS Forums&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%data%&#039;) AS Databses&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%assignment%&#039;) AS Assignments&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 18)&lt;br /&gt;
ORDER BY Wikis DESC,Blogs DESC, Forums DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Detailed WIKI activity (per wiki per course)===&lt;br /&gt;
Including Number of Students in course (for reference)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID  &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id ) AS Students&lt;br /&gt;
,m.name&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%updat%&#039; ) as &#039;UPDAT E&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%annotate%&#039; ) as ANNOTATE&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%comment%&#039; ) as COMMENT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%add%&#039; ) as &#039;A DD&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%edit%&#039; ) as EDIT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action NOT LIKE &#039;%view%&#039; ) as &#039;All (NO View)&#039;&lt;br /&gt;
FROM `prefix_course_modules` as cm &lt;br /&gt;
JOIN prefix_modules as m ON cm.module=m.id &lt;br /&gt;
JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
GROUP BY cm.course,cm.module&lt;br /&gt;
ORDER BY &#039;All (NO View)&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Wiki usage, system wide===&lt;br /&gt;
(you can filter the output by selecting some specific course categories : &amp;quot;WHERE c.category IN ( 8,13,15)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039;) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%add%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ADD&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%edit%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;EDIT&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%annotate%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ANNOTATE&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%comments%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;Comments&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_ouwiki_pages as ouwp&lt;br /&gt;
JOIN prefix_ouwiki as ouw ON ouw.id = ouwp.subwikiid&lt;br /&gt;
WHERE ouw.course = c.id GROUP BY ouw.course  ) as OUWikiPages&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( DISTINCT nwp.pagename ) FROM prefix_wiki_pages AS nwp&lt;br /&gt;
JOIN prefix_wiki AS nw ON nw.id = nwp.dfwiki WHERE nw.course = c.id ) As NWikiPages&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 8,13,15)&lt;br /&gt;
HAVING Wikis &amp;gt; 0&lt;br /&gt;
ORDER BY &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Aggregated Teacher activity by &amp;quot;WEB2&amp;quot; Modules===&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
The NV column shows activity without VIEW log activity&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.userid, u.firstname,u.lastname&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039;) AS Wiki&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Wiki_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039;) AS Forum&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Forum_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039;) AS Blog&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Blog_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039;) AS Assignment&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Assignment_NV&lt;br /&gt;
FROM prefix_role_assignments AS ra &lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid &lt;br /&gt;
WHERE ra.roleid = 3 &lt;br /&gt;
GROUP BY ra.userid&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List all the certificates issued, sort by variables in the custom profile fields===&lt;br /&gt;
Note: The SQL queries look intimidating at first, but isn&#039;t really that difficult to learn. I&#039;ve seen in the forums that users wanted to do &#039;site-wide&#039; groups in 1.9x. This is sort of the idea. It pulls all the certificates issued to all users sorted by the custom profile fields, which in my case is the Units or Depts (i.e. my site wide groups). Why certificates? I&#039;ve explored with both grades and quizzes, the course admins are not really interested in the actual grades but whether the learner received a certificate (i.e. passed the course with x, y, z activities). It also saves me from creating groups and assigning them into the right groups. Even assigning in bulk is not efficient, since I have upward of 25 groups per course and constantly new learners enrolling in courses. The limitation is something to do with the server? as it only pull 5000 rows of data. If anyone figured out how to change this, please let me know. In the meantime, the work around is to pull only a few units/depts at a time to limit the number of rows. This is fine at the moment, since each course admin are only responsible for certain units/depts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME(prefix_certificate_issues.timecreated), &#039;%Y/%m/%d&#039; ) AS Date,&lt;br /&gt;
prefix_certificate_issues.classname AS Topic,&lt;br /&gt;
prefix_certificate.name AS Certificate,&lt;br /&gt;
prefix_certificate_issues.studentname as Name,&lt;br /&gt;
prefix_user_info_data.data AS Units&lt;br /&gt;
&lt;br /&gt;
FROM&lt;br /&gt;
prefix_certificate_issues&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_user_info_data&lt;br /&gt;
on prefix_certificate_issues.userid = prefix_user_info_data.userid&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_certificate&lt;br /&gt;
on prefix_certificate_issues.certificateid = prefix_certificate.id&lt;br /&gt;
&lt;br /&gt;
WHERE prefix_user_info_data.data=&#039;Unit 1&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 2&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 3&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY Units, Name, Topic ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Counter Blog usage in Courses,system wide===&lt;br /&gt;
What teachers in what courses, uses blogs and how many + student count in that course.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT ( @counter := @counter+1) as counter, &lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user AS u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = c.id AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%blog%&#039;) AS Blogs&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c, (SELECT @counter := 0) as s_init&lt;br /&gt;
WHERE c.category IN ( 8,13,15)&lt;br /&gt;
HAVING Blogs &amp;gt; 0&lt;br /&gt;
ORDER BY Blogs DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Assignment Module Reports==&lt;br /&gt;
===All Ungraded Assignments===&lt;br /&gt;
Returns all the submitted assignments that still need grading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id&lt;br /&gt;
and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Ungraded Assignments w/ Link===&lt;br /&gt;
Returns all the submitted assignments that still need grading, along with a link that goes directly to the submission to grade it. The links work if you view the report within Moodle.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
&#039;&amp;lt;a href=&amp;quot;http://education.varonis.com/mod/assignment/submissions.php&#039; + char(63) +&lt;br /&gt;
+ &#039;id=&#039; + cast(cm.id as varchar) + &#039;&amp;amp;userid=&#039; + cast(u.id as varchar) &lt;br /&gt;
+ &#039;&amp;amp;mode=single&amp;amp;filter=0&amp;amp;offset=2&amp;quot;&amp;gt;&#039; + a.name + &#039;&amp;lt;/a&amp;gt;&#039;&lt;br /&gt;
AS &amp;quot;Assignmentlink&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Who is using &amp;quot;Single File Upload&amp;quot; assignment===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
 &lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher &lt;br /&gt;
&lt;br /&gt;
,ass.name as &amp;quot;Assignment Name&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM &lt;br /&gt;
prefix_assignment as ass&lt;br /&gt;
&lt;br /&gt;
JOIN &lt;br /&gt;
prefix_course as c ON c.id = ass.course&lt;br /&gt;
&lt;br /&gt;
WHERE `assignmenttype` LIKE &#039;uploadsingle&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Resource Module Reports==&lt;br /&gt;
===List &amp;quot;Recently uploaded files&amp;quot;===&lt;br /&gt;
see what users are uploading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT FROM_UNIXTIME(time,&#039;%Y %M %D %h:%i:%s&#039;) as time ,ip,userid,url,info  &lt;br /&gt;
FROM `prefix_log` &lt;br /&gt;
WHERE `action` LIKE &#039;upload&#039; &lt;br /&gt;
ORDER BY `prefix_log`.`time`  DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List Courses that loaded a specific file: &amp;quot;X&amp;quot;===&lt;br /&gt;
Did the Teacher (probably) uploaded course&#039;s Syllabus ?&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname  FROM `prefix_log` as l &lt;br /&gt;
JOIN prefix_course as c ON c.id = l.course &lt;br /&gt;
WHERE `action` LIKE &#039;%upload%&#039; AND ( info LIKE &#039;%Syllabus%&#039; OR info LIKE &#039;%Sylabus%&#039; ) GROUP BY c.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All resources that link to some specific external website===&lt;br /&gt;
+ link to course&lt;br /&gt;
+ who&#039;s the teacher&lt;br /&gt;
+ link to external resource&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/resource/view.php?id=&#039;,r.id,&#039;&amp;quot;&amp;gt;&#039;,r.name,&#039;&amp;lt;/a&amp;gt;&#039;) AS Resource&lt;br /&gt;
FROM prefix_resource AS r &lt;br /&gt;
JOIN prefix_course AS c ON r.course = c.id&lt;br /&gt;
WHERE r.reference LIKE &#039;http://info.oranim.ac.il/home%&#039; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Compose Web Page&amp;quot; RESOURCE count===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT course,prefix_course.fullname, COUNT(*) AS Total&lt;br /&gt;
FROM `prefix_resource`&lt;br /&gt;
JOIN `prefix_course` ON prefix_course.id = prefix_resource.course&lt;br /&gt;
WHERE type=&#039;html&#039;&lt;br /&gt;
GROUP BY course&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Resource count in courses===&lt;br /&gt;
+ (First)Teacher name&lt;br /&gt;
+ Where course is inside some specific Categories&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
COUNT(*) AS count&lt;br /&gt;
,r.course &lt;br /&gt;
,c.shortname shortname&lt;br /&gt;
,c.fullname coursename&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user as u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = r.course AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
FROM prefix_resource r &lt;br /&gt;
JOIN prefix_course c ON r.course = c.id&lt;br /&gt;
WHERE c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY r.course&lt;br /&gt;
ORDER BY COUNT(*) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Forum Module Reports==&lt;br /&gt;
===FORUM use Count per COURSE -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===FORUM use Count per COURSE by type -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, prefix_forum.type, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course,prefix_forum.type&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Activity In Forums===&lt;br /&gt;
Trying to figure out how much real activity we have in Forums by aggregating:&lt;br /&gt;
Users in Course, Number of Posts, Number of Discussions, Unique student post, Unique student discussions, Number of Teachers , Number of Students, ratio between unique Student posts and the number of students in the Course...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.fullname,f.name,f.type &lt;br /&gt;
,(SELECT count(id) FROM prefix_forum_discussions as fd WHERE f.id = fd.forum) as Discussions&lt;br /&gt;
,(SELECT count(distinct fd.userid) FROM prefix_forum_discussions as fd WHERE fd.forum = f.id) as UniqueUsersDiscussions&lt;br /&gt;
,(SELECT count(fp.id) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as Posts&lt;br /&gt;
,(SELECT count(distinct fp.userid) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as UniqueUsersPosts&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Students&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS StudentsCount&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Teachers&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =3&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS &#039;Teacher&amp;lt;br/&amp;gt;Count&#039;&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid IN (3,5)&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS UserCount&lt;br /&gt;
, (SELECT (UniqueUsersDiscussions / StudentsCount )) as StudentDissUsage&lt;br /&gt;
, (SELECT (UniqueUsersPosts /StudentsCount)) as StudentPostUsage&lt;br /&gt;
FROM prefix_forum as f &lt;br /&gt;
JOIN prefix_course as c ON f.course = c.id&lt;br /&gt;
WHERE `type` != &#039;news&#039;&lt;br /&gt;
ORDER BY StudentPostUsage DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Forum type:NEWS===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT f.id, f.name&lt;br /&gt;
FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
JOIN prefix_forum AS f ON cm.instance = f.id&lt;br /&gt;
WHERE m.name = &#039;forum&#039;&lt;br /&gt;
AND f.type = &#039;news&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All new forum NEWS items (discussions) from all my Courses===&lt;br /&gt;
change &amp;quot;userid = 26&amp;quot; and &amp;quot;id = 26&amp;quot; to a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname,f.name,fd.name,FROM_UNIXTIME(fd.timemodified ,&amp;quot;%d %M %Y &amp;quot;) as Date&lt;br /&gt;
FROM prefix_forum_discussions as fd &lt;br /&gt;
JOIN prefix_forum as f ON f.id = fd.forum &lt;br /&gt;
JOIN prefix_course as c ON c.id = f.course &lt;br /&gt;
JOIN prefix_user_lastaccess as ul ON (c.id = ul.courseid AND ul.userid = 26)&lt;br /&gt;
WHERE fd.timemodified &amp;gt; ul.timeaccess  &lt;br /&gt;
 AND fd.forum IN (SELECT f.id&lt;br /&gt;
 FROM prefix_course_modules AS cm&lt;br /&gt;
 JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
 JOIN prefix_forum AS f ON cm.instance = f.id&lt;br /&gt;
 WHERE m.name = &#039;forum&#039;&lt;br /&gt;
 AND f.type = &#039;news&#039;)&lt;br /&gt;
  AND c.id IN (SELECT c.id&lt;br /&gt;
   FROM prefix_course AS c&lt;br /&gt;
   JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
   JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
   JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
   WHERE u.id = 26) ORDER BY `fd`.`timemodified` DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===News Forum - Discussions COUNT===&lt;br /&gt;
Which is actually... How much instructions students get from their teachers&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname ,&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user AS u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = c.id AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/forum/view.php?f=&#039;,fd.forum,&#039;&amp;quot;&amp;gt;&#039;,count(fd.id),&#039;&amp;lt;/a&amp;gt;&#039;) AS DiscussionsSum&lt;br /&gt;
FROM prefix_forum_discussions AS fd&lt;br /&gt;
INNER JOIN prefix_forum AS f ON f.id = fd.forum&lt;br /&gt;
INNER JOIN prefix_course AS c ON c.id = f.course&lt;br /&gt;
WHERE f.type = &#039;news&#039; AND c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY fd.forum&lt;br /&gt;
ORDER BY count(fd.id) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quiz Module Reports==&lt;br /&gt;
===Generate a list of instructors and their email addresses for those courses that has &amp;quot;essay questions&amp;quot; in their quizzes===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT qu.id AS quiz_id, qu.course AS course_id, qu.questions,&lt;br /&gt;
                co.fullname AS course_fullname, co.shortname AS course_shortname,&lt;br /&gt;
                qu.name AS quiz_name, FROM_UNIXTIME(qu.timeopen) AS quiz_timeopen, FROM_UNIXTIME(qu.timeclose) AS quiz_timeclose,&lt;br /&gt;
                u.firstname, u.lastname, u.email,&lt;br /&gt;
FROM mdl_quiz qu, mdl_course co, mdl_role re, mdl_context ct, mdl_role_assignments ra, mdl_user u&lt;br /&gt;
WHERE FROM_UNIXTIME(timeopen) &amp;gt; &#039;2008-05-14&#039; AND&lt;br /&gt;
                qu.course = co.id AND&lt;br /&gt;
                co.id = ct.instanceid AND&lt;br /&gt;
                ra.roleid = re.id AND&lt;br /&gt;
                re.name = &#039;Teacher&#039; AND&lt;br /&gt;
                ra.contextid = ct.id AND&lt;br /&gt;
                ra.userid = u.id&lt;br /&gt;
 &lt;br /&gt;
SELECT Count(&#039;x&#039;) As NumOfStudents&lt;br /&gt;
                                FROM mdl_role_assignments a&lt;br /&gt;
                                JOIN mdl_user u ON userid = u.id&lt;br /&gt;
                                WHERE roleid = 5 AND contextid = (SELECT id FROM mdl_context WHERE instanceid = 668 AND contextlevel = 50)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Talk:File_upload_size&amp;diff=96283</id>
		<title>Talk:File upload size</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Talk:File_upload_size&amp;diff=96283"/>
		<updated>2012-03-05T17:13:50Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* This is in the FAQ but is not in the &amp;quot;style of&amp;quot; FAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==This is in the FAQ but is not in the &amp;quot;style of&amp;quot; FAQ==&lt;br /&gt;
I&#039;ve been going through the FAQ pages and spotted this one - it&#039;s in the list but doesn&#039;t actually follow the FAQ format. Shall I restyle it,  making some questions out of the long paragraphs (of the bits I understand) so it looks like the others? OR.. is it here by error?? --[[User:Mary Cooch|Mary Cooch]] 21:08, 5 March 2012 (WST)&lt;br /&gt;
===My thoughts...===&lt;br /&gt;
I don&#039;t think this one should really been seen as an FAQ page Mary. I appreciate it starts with the line &amp;quot;Probably the most frequently asked question in the Moodle.org Using Moodle forums is&amp;quot; but it needs an in-depth technical page to be able to cope with all of the different ways there are of making this change.&lt;br /&gt;
&lt;br /&gt;
Maybe take it out of the FAQ group of pages and just ensure there is a link from a relevant FAQ page back to this one... [[User:Jon Witts|Jon Witts]] 01:13, 6 March 2012 (WST)&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Talk:File_upload_size&amp;diff=96282</id>
		<title>Talk:File upload size</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Talk:File_upload_size&amp;diff=96282"/>
		<updated>2012-03-05T17:13:21Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==This is in the FAQ but is not in the &amp;quot;style of&amp;quot; FAQ==&lt;br /&gt;
I&#039;ve been going through the FAQ pages and spotted this one - it&#039;s in the list but doesn&#039;t actually follow the FAQ format. Shall I restyle it,  making some questions out of the long paragraphs (of the bits I understand) so it looks like the others? OR.. is it here by error?? --[[User:Mary Cooch|Mary Cooch]] 21:08, 5 March 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
I don&#039;t think this one should really been seen as an FAQ page Mary. I appreciate it starts with the line &amp;quot;Probably the most frequently asked question in the Moodle.org Using Moodle forums is&amp;quot; but it needs an in-depth technical page to be able to cope with all of the different ways there are of making this change.&lt;br /&gt;
&lt;br /&gt;
Maybe take it out of the FAQ group of pages and just ensure there is a link from a relevant FAQ page back to this one... [[User:Jon Witts|Jon Witts]] 01:13, 6 March 2012 (WST)&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Performance_FAQ&amp;diff=92364</id>
		<title>Performance FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Performance_FAQ&amp;diff=92364"/>
		<updated>2011-10-19T17:21:49Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Should I go for 64 bit or is 32 bit OK? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Performance}}&lt;br /&gt;
==How do you define &amp;quot;concurrent users&amp;quot;?==&lt;br /&gt;
As has been repeatedly stressed in the [http://moodle.org/mod/forum/view.php?f=94 Hardware and performance] forum, the load on the server at a particular time depends on the number of concurrent users, not on the total number of users neither on the number of users logged-in. The term &amp;quot;concurrent users&amp;quot; is used to mean those users for whom the server is actively doing something . It may by processing a webpage written in PHP, querying the database or simply transferring a file. (see also Wikipedia [http://en.wikipedia.org/wiki/Concurrency_(computer_science) Concurrency])&lt;br /&gt;
&lt;br /&gt;
==How do I benchmark a Moodle-site?==&lt;br /&gt;
You can of course benchmark parts of the system separately: the hardware as seen by the operating system (eg. CPU, disk access), web server performance, database server performance, execution on PHP operations, etc. For further details see [[Performance#Obtain_a_baseline_benchmark]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But there is no easy formula to deduce the maximum number of concurrent users from those results. There is a PHP-script, the [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script], circulating amoung the Moodle-community which calculates a ballpark figure. The current version is attached to [http://moodle.org/mod/forum/discuss.php?d=57028&amp;amp;parent=772267|the posting on 25. March 2011].&lt;br /&gt;
&lt;br /&gt;
Warning: Note that running this script on a production server may have unwanted side-effects. You are strongly adviced to run it on a test-site.&lt;br /&gt;
&lt;br /&gt;
==What are PHP-accelerators?==&lt;br /&gt;
See Wikipedia [http://en.wikipedia.org/wiki/PHP_accelerator PHP accelerator].&lt;br /&gt;
&lt;br /&gt;
Available software are documented under [[Performance#PHP_performance]]. &lt;br /&gt;
&lt;br /&gt;
You find some user suggestions here [http://moodle.org/mod/forum/discuss.php?d=168965 Update on PHP-accelerators].&lt;br /&gt;
&lt;br /&gt;
==How do I cluster Moodle?==&lt;br /&gt;
&lt;br /&gt;
See [[Performance#Scalability]]&lt;br /&gt;
&lt;br /&gt;
[[Moodle_Clusters]]&lt;br /&gt;
&lt;br /&gt;
==How do I replicate Moodle?==&lt;br /&gt;
&lt;br /&gt;
[[Mirroring_Moodle]]&lt;br /&gt;
&lt;br /&gt;
[http://moodle.org/mod/forum/discuss.php?d=173408&amp;amp;parent=760514  How to Replicate MOODLE ??!!]&lt;br /&gt;
&lt;br /&gt;
==My site is very slow, what should I do?==&lt;br /&gt;
&lt;br /&gt;
First find out &amp;quot;how slow&amp;quot;. (The theme-trick here).&lt;br /&gt;
&lt;br /&gt;
The next question is, whether the performance is normal or something malfunctions. There are many things which can malfunction:&lt;br /&gt;
* hardware&lt;br /&gt;
* crashed filesystems, specially network filesystems&lt;br /&gt;
* memory leaks or other crashes in the system&lt;br /&gt;
* bug in Moodle&lt;br /&gt;
* corrupted database&lt;br /&gt;
* networking issues (DNS, firewalls, ...)&lt;br /&gt;
&lt;br /&gt;
Or your performance could be &amp;quot;normal&amp;quot; under the given circumstances:&lt;br /&gt;
* Are you on a dedicated server or a shared (virtual) server?&lt;br /&gt;
* How much RAM, processing power do you have?&lt;br /&gt;
* What is the software stack you use? (Unix or Windows, Apache or IIS, MySQL, PostgreSQL or SQL-Server, ...?)&lt;br /&gt;
* how many concurrent users can you support&lt;br /&gt;
* what modules/activities you use? Check [[Performance#Performance of different Moodle modules]]&lt;br /&gt;
&lt;br /&gt;
[[Performance#Obtain a baseline benchmark]] and compare it with the published figures.&lt;br /&gt;
&lt;br /&gt;
==What are the requirements for N users?==&lt;br /&gt;
&lt;br /&gt;
[http://moodle.org/mod/forum/discuss.php?d=111847 A moodle setup for 10K simultaneous users]&lt;br /&gt;
&lt;br /&gt;
==How many users will my installation support?==&lt;br /&gt;
&lt;br /&gt;
This is another way of asking the same question as above. Please move up.&lt;br /&gt;
&lt;br /&gt;
==What is the best webserver?==&lt;br /&gt;
&lt;br /&gt;
==Should I go for 64 bit or is 32 bit OK?==&lt;br /&gt;
&lt;br /&gt;
==What hosting provider do you recommend?==&lt;br /&gt;
http://moodle.org/mod/forum/discuss.php?d=99405&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions&lt;br /&gt;
* [http://moodle.org/mod/forum/search.php?notwords=Re:&amp;amp;id=5&amp;amp;subject=performance All performance related discussions]&lt;br /&gt;
* [http://moodle.org/mod/forum/search.php?notwords=Re:&amp;amp;id=5&amp;amp;forumid=33&amp;amp;&amp;amp;subject=performance Performance related discussions in the General Developer forum]&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=102978 1000 concurrent users]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=103040 Tool to estimate server&#039;s maximum concurrent users]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=144718 Handling Moodle database load - a solution!]&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=ad-hoc_contributed_reports&amp;diff=89534</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=ad-hoc_contributed_reports&amp;diff=89534"/>
		<updated>2011-09-14T12:27:41Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* List all Courses in and below a certain category */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These are community contributed reports for the [[Custom_SQL_queries_report]] site-wide report plugin (module) &amp;lt;br/&amp;gt;&lt;br /&gt;
Everyone is welcome to add their own. until we find a better way to exchange reports between us.&amp;lt;br/&amp;gt;&lt;br /&gt;
Enjoy :-)&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each MODULE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT module,action,count(id) as counter&lt;br /&gt;
FROM prefix_log&lt;br /&gt;
GROUP BY module,action&lt;br /&gt;
ORDER BY module,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT r.name,l.action, count( l.userid ) as counter&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE ra.roleid IN (3,4,5)&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
ORDER BY counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed &amp;quot;VIEW&amp;quot; ACTION for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT l.action, count( l.userid ) as counter , r.name&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN `prefix_role` AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE (ra.roleid IN (3,4,5)) AND (l.action LIKE &#039;%view%&#039; )&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
order by r.name,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Most Active courses===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, l.course courseId, c.fullname coursename&lt;br /&gt;
FROM prefix_log l INNER JOIN prefix_course c ON l.course = c.id&lt;br /&gt;
GROUP BY courseId&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===RESOURCE count for each COURSE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) count, l.course, c.fullname coursename&lt;br /&gt;
FROM prefix_resource l INNER JOIN prefix_course c on l.course = c.id&lt;br /&gt;
GROUP BY course&lt;br /&gt;
ORDER BY count DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Most popular ACTIVITY===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, module&lt;br /&gt;
FROM prefix_log l&lt;br /&gt;
WHERE module != &#039;login&#039; AND module != &#039;course&#039; AND module != &#039;role&#039;&lt;br /&gt;
GROUP BY module&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===System wide use of ACTIVITIES and RESOURCES===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT count( cm.id ) AS counter, m.name&lt;br /&gt;
FROM `prefix_course_modules` AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
GROUP BY cm.module&lt;br /&gt;
ORDER BY counter DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LOG file ACTIONS per MODULE per COURSE (IDs)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select course,module,action,count(action) as summa from prefix_log&lt;br /&gt;
where action &amp;lt;&amp;gt; &#039;new&#039;&lt;br /&gt;
group by course,action,module&lt;br /&gt;
order by course,module,action&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Compose Web Page&amp;quot; RESOURCE count===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT course,prefix_course.fullname, COUNT(*) AS Total&lt;br /&gt;
FROM `prefix_resource`&lt;br /&gt;
JOIN `prefix_course` ON prefix_course.id = prefix_resource.course&lt;br /&gt;
WHERE type=&#039;html&#039;&lt;br /&gt;
GROUP BY course&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Total Activity of Roles:&amp;quot;Teacher&amp;quot; and &amp;quot;None-Editing Teacher&amp;quot; by Dates and by Hours===&lt;br /&gt;
The output columns of this report table can be used as base for a Pivot-Table&lt;br /&gt;
which will show the amount of &#039;&#039;&#039;activity&#039;&#039;&#039; per &#039;&#039;&#039;hour&#039;&#039;&#039; per &#039;&#039;&#039;days&#039;&#039;&#039; in 3D graph view.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%Y/%m/%d&#039; ) AS grptimed ,&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%k&#039; ) AS grptimeh  , count( l.userid ) AS counter &lt;br /&gt;
FROM `prefix_log` AS l&lt;br /&gt;
JOIN prefix_user AS u ON u.id = l.userid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
WHERE ra.roleid IN (3,4)&lt;br /&gt;
GROUP BY grptimed,grptimeh&lt;br /&gt;
ORDER BY grptimed,grptimeh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===FORUM use Count per COURSE -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===FORUM use Count per COURSE by type -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, prefix_forum.type, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course,prefix_forum.type&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 1.9.x)===&lt;br /&gt;
&lt;br /&gt;
Reports a site global list of all users enroled in each course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user.firstname AS Firstname,&lt;br /&gt;
user.lastname AS Lastname,&lt;br /&gt;
user.email AS Email,&lt;br /&gt;
user.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=asg.roleid)&lt;br /&gt;
FROM&lt;br /&gt;
prefix_user AS user,&lt;br /&gt;
prefix_course AS course,&lt;br /&gt;
prefix_role_assignments AS asg&lt;br /&gt;
INNER JOIN prefix_context AS context ON asg.contextid=context.id   &lt;br /&gt;
WHERE&lt;br /&gt;
context.contextlevel = 50&lt;br /&gt;
AND&lt;br /&gt;
user.id=asg.userid&lt;br /&gt;
AND&lt;br /&gt;
context.instanceid=course.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 2.x)===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user2.firstname AS Firstname,&lt;br /&gt;
user2.lastname AS Lastname,&lt;br /&gt;
user2.email AS Email,&lt;br /&gt;
user2.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT shortname FROM prefix_role WHERE id=en.roleid) as Role&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=en.roleid) as RoleName&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course as course &lt;br /&gt;
JOIN prefix_enrol AS en ON en.courseid = course.id&lt;br /&gt;
JOIN prefix_user_enrolments AS ue ON ue.enrolid = en.id&lt;br /&gt;
JOIN prefix_user AS user2 ON ue.userid = user2.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Permissions Overides on Categories===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712834 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT rc.id, ct.instanceid, ccat.name, rc.roleid, rc.capability, rc.permission, &lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( rc.timemodified ) , &#039;%Y-%m-%d&#039; ) AS timemodified, rc.modifierid, ct.instanceid, ct.path, ct.depth&lt;br /&gt;
FROM `prefix_role_capabilities` AS rc&lt;br /&gt;
INNER JOIN `prefix_context` AS ct ON rc.contextid = ct.id&lt;br /&gt;
INNER JOIN `prefix_course_categories` AS ccat ON ccat.id = ct.instanceid&lt;br /&gt;
AND `contextlevel` =40&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;Totally Opened Courses&amp;quot; (visible, opened to guests, with no password)===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712837 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id , category , fullname , shortname , enrollable&lt;br /&gt;
FROM `prefix_course`&lt;br /&gt;
WHERE `guest` =1&lt;br /&gt;
AND `password` = &amp;quot;&amp;quot;&lt;br /&gt;
AND `visible` =1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;loggedin users&amp;quot; from the last 120 days===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id,username,FROM_UNIXTIME(`lastlogin`) as days &lt;br /&gt;
FROM `mdl_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;and user count for that same population:&#039;&#039;&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(id) as Users  FROM `mdl_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List &amp;quot;Recently uploaded files&amp;quot;===&lt;br /&gt;
see what users are uploading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT FROM_UNIXTIME(time,&#039;%Y %M %D %h:%i:%s&#039;) as time ,ip,userid,url,info  &lt;br /&gt;
FROM `prefix_log` &lt;br /&gt;
WHERE `action` LIKE &#039;upload&#039; &lt;br /&gt;
ORDER BY `prefix_log`.`time`  DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List Courses that loaded a specific file: &amp;quot;X&amp;quot;===&lt;br /&gt;
Did the Teacher (probably) uploaded course&#039;s Syllabus ?&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname  FROM `prefix_log` as l &lt;br /&gt;
JOIN prefix_course as c ON c.id = l.course &lt;br /&gt;
WHERE `action` LIKE &#039;%upload%&#039; AND ( info LIKE &#039;%Syllabus%&#039; OR info LIKE &#039;%Sylabus%&#039; ) GROUP BY c.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Students in all courses of some institute===&lt;br /&gt;
What is the status (deleted or not) of all Students (roleid = 5) in all courses of some Institute&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname, u.firstname, u.lastname, u.deleted&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
AND u.institution = &#039;please enter school name here&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Full User info (for deleted users)===&lt;br /&gt;
Including extra custom profile fields (from mdl_user_info_data)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT * &lt;br /&gt;
FROM mdl_user as u &lt;br /&gt;
JOIN mdl_user_info_data as uid ON uid.userid = u.id &lt;br /&gt;
JOIN mdl_user_info_field as uif ON (uid.fieldid = uif.id AND uif.shortname = &#039;class&#039;)&lt;br /&gt;
WHERE `deleted` = &amp;quot;1&amp;quot; and `institution`=&amp;quot;your school name&amp;quot; and `department` = &amp;quot;your department&amp;quot; and `data` = &amp;quot;class level and number&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Activity In Forums===&lt;br /&gt;
Trying to figure out how much real activity we have in Forums by aggregating:&lt;br /&gt;
Users in Course, Number of Posts, Number of Discussions, Unique student post, Unique student discussions, Number of Teachers , Number of Students, ratio between unique Student posts and the number of students in the Course...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.fullname,f.name,f.type &lt;br /&gt;
,(SELECT count(id) FROM prefix_forum_discussions as fd WHERE f.id = fd.forum) as Discussions&lt;br /&gt;
,(SELECT count(distinct fd.userid) FROM prefix_forum_discussions as fd WHERE fd.forum = f.id) as UniqueUsersDiscussions&lt;br /&gt;
,(SELECT count(fp.id) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as Posts&lt;br /&gt;
,(SELECT count(distinct fp.userid) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as UniqueUsersPosts&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Students&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS StudentsCount&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Teachers&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =3&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS &#039;Teacher&amp;lt;br/&amp;gt;Count&#039;&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid IN (3,5)&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS UserCount&lt;br /&gt;
, (SELECT (UniqueUsersDiscussions / StudentsCount )) as StudentDissUsage&lt;br /&gt;
, (SELECT (UniqueUsersPosts /StudentsCount)) as StudentPostUsage&lt;br /&gt;
FROM prefix_forum as f &lt;br /&gt;
JOIN prefix_course as c ON f.course = c.id&lt;br /&gt;
WHERE `type` != &#039;news&#039;&lt;br /&gt;
ORDER BY StudentPostUsage DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Blog activity per Course (not including VIEW)===&lt;br /&gt;
Filter activity logging to some specific Course Categories!&lt;br /&gt;
+ link course name to actual course (for quick reference)&lt;br /&gt;
(you can change %blog% to %wiki% to filter down all wiki activity or any other module you wish)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID&lt;br /&gt;
,m.name ,count(cm.id) as counter &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS Students&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE `module` LIKE &#039;%blog%&#039; AND course = c.id AND action NOT LIKE &#039;%view%&#039; ) as BlogActivity&lt;br /&gt;
FROM `prefix_course_modules` as cm JOIN prefix_modules as m ON cm.module=m.id JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%blog%&#039; AND c.category IN ( 8,13,15)&lt;br /&gt;
GROUP BY cm.course,cm.module order by counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed WIKI activity (per wiki per course)===&lt;br /&gt;
Including Number of Students in course (for reference)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID  &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id ) AS Students&lt;br /&gt;
,m.name&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%updat%&#039; ) as &#039;UPDAT E&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%annotate%&#039; ) as ANNOTATE&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%comment%&#039; ) as COMMENT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%add%&#039; ) as &#039;A DD&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%edit%&#039; ) as EDIT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action NOT LIKE &#039;%view%&#039; ) as &#039;All (NO View)&#039;&lt;br /&gt;
FROM `prefix_course_modules` as cm &lt;br /&gt;
JOIN prefix_modules as m ON cm.module=m.id &lt;br /&gt;
JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
GROUP BY cm.course,cm.module&lt;br /&gt;
ORDER BY &#039;All (NO View)&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Courses which uploaded a Syllabus file===&lt;br /&gt;
+ under specific Category&lt;br /&gt;
+ show first Teacher in that course&lt;br /&gt;
+ link Course&#039;s fullname to actual course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) as Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user as u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) as Teacher&lt;br /&gt;
FROM prefix_resource as r &lt;br /&gt;
JOIN prefix_course as c ON r.course = c.id&lt;br /&gt;
WHERE ( r.name LIKE &#039;%סילבוס%&#039; OR r.name LIKE &#039;%סילאבוס%&#039; OR r.name LIKE &#039;%syllabus%&#039; OR r.name LIKE &#039;%תכנית הקורס%&#039; ) &lt;br /&gt;
AND c.category IN (10,18,26,13,28)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All resources that link to some specific external website===&lt;br /&gt;
+ link to course&lt;br /&gt;
+ who&#039;s the teacher&lt;br /&gt;
+ link to external resource&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/resource/view.php?id=&#039;,r.id,&#039;&amp;quot;&amp;gt;&#039;,r.name,&#039;&amp;lt;/a&amp;gt;&#039;) AS Resource&lt;br /&gt;
FROM prefix_resource AS r &lt;br /&gt;
JOIN prefix_course AS c ON r.course = c.id&lt;br /&gt;
WHERE r.reference LIKE &#039;http://info.oranim.ac.il/home%&#039; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===How many LOGINs per user and user&#039;s Activity===&lt;br /&gt;
+ link username to a user activity graph report&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,u.id,&#039;&amp;amp;mode=alllogs&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) as Username&lt;br /&gt;
,count(*) as logins&lt;br /&gt;
,(SELECT count(*) FROM prefix_log WHERE userid = l.userid GROUP BY userid) as Activity &lt;br /&gt;
FROM prefix_log as l JOIN prefix_user as u ON l.userid = u.id &lt;br /&gt;
WHERE `action` LIKE &#039;%login%&#039; group by userid&lt;br /&gt;
ORDER BY Activity DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===User&#039;s courses===&lt;br /&gt;
change &amp;quot;u.id = 2&amp;quot; with a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname, u.lastname, c.id, c.fullname&lt;br /&gt;
FROM mdl_course AS c&lt;br /&gt;
JOIN mdl_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN mdl_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE u.id = 2&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Forum type:NEWS===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT f.id, f.name&lt;br /&gt;
FROM mdl_course_modules AS cm&lt;br /&gt;
JOIN mdl_modules AS m ON cm.module = m.id&lt;br /&gt;
JOIN mdl_forum AS f ON cm.instance = f.id&lt;br /&gt;
WHERE m.name = &#039;forum&#039;&lt;br /&gt;
AND f.type = &#039;news&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All new forum NEWS items (discussions) from all my Courses===&lt;br /&gt;
change &amp;quot;userid = 26&amp;quot; and &amp;quot;id = 26&amp;quot; to a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname,f.name,fd.name,FROM_UNIXTIME(fd.timemodified ,&amp;quot;%d %M %Y &amp;quot;) as Date&lt;br /&gt;
FROM mdl_forum_discussions as fd &lt;br /&gt;
JOIN mdl_forum as f ON f.id = fd.forum &lt;br /&gt;
JOIN mdl_course as c ON c.id = f.course &lt;br /&gt;
JOIN mdl_user_lastaccess as ul ON (c.id = ul.courseid AND ul.userid = 26)&lt;br /&gt;
WHERE fd.timemodified &amp;gt; ul.timeaccess  &lt;br /&gt;
 AND fd.forum IN (SELECT f.id&lt;br /&gt;
 FROM mdl_course_modules AS cm&lt;br /&gt;
 JOIN mdl_modules AS m ON cm.module = m.id&lt;br /&gt;
 JOIN mdl_forum AS f ON cm.instance = f.id&lt;br /&gt;
 WHERE m.name = &#039;forum&#039;&lt;br /&gt;
 AND f.type = &#039;news&#039;)&lt;br /&gt;
  AND c.id IN (SELECT c.id&lt;br /&gt;
   FROM mdl_course AS c&lt;br /&gt;
   JOIN mdl_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
   JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
   JOIN mdl_user AS u ON u.id = ra.userid&lt;br /&gt;
   WHERE u.id = 26) ORDER BY `fd`.`timemodified` DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Resource count in courses==&lt;br /&gt;
+ (First)Teacher name&lt;br /&gt;
+ Where course is inside some specific Categories&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
COUNT(*) AS count&lt;br /&gt;
,r.course &lt;br /&gt;
,c.shortname shortname&lt;br /&gt;
,c.fullname coursename&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user as u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = r.course AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
FROM prefix_resource r &lt;br /&gt;
JOIN prefix_course c ON r.course = c.id&lt;br /&gt;
WHERE c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY r.course&lt;br /&gt;
ORDER BY COUNT(*) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==News Forum - Discussions COUNT==&lt;br /&gt;
Which is actually... How much instructions students get from their teachers&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname ,&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user AS u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = c.id AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/forum/view.php?f=&#039;,fd.forum,&#039;&amp;quot;&amp;gt;&#039;,count(fd.id),&#039;&amp;lt;/a&amp;gt;&#039;) AS DiscussionsSum&lt;br /&gt;
FROM prefix_forum_discussions AS fd&lt;br /&gt;
INNER JOIN prefix_forum AS f ON f.id = fd.forum&lt;br /&gt;
INNER JOIN prefix_course AS c ON c.id = f.course&lt;br /&gt;
WHERE f.type = &#039;news&#039; AND c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY fd.forum&lt;br /&gt;
ORDER BY count(fd.id) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Special Roles==&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.roleid,r.name&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,ra.userid,&#039;&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Username&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_context AS ctx ON (ctx.id = ra.contextid AND ctx.contextlevel = 50)&lt;br /&gt;
JOIN prefix_course AS c ON ctx.instanceid = c.id&lt;br /&gt;
WHERE ra.roleid &amp;gt; 6&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Courses without Teachers==&lt;br /&gt;
Actually, shows the number of Teachers in a course.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id) AS Teachers&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
ORDER BY Teachers ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Site-Wide Grade Report with All Items==&lt;br /&gt;
Shows grades for all course items along with course totals for each student.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
c.fullname AS &#039;Course&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id &lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Site-Wide Grade Report with Just Course Totals==&lt;br /&gt;
A second site-wide grade report for all students that just shows course totals.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id AND gi.itemtype = &#039;course&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
==All Ungraded Assignments==&lt;br /&gt;
Returns all the submitted assignments that still need grading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id&lt;br /&gt;
and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==All Ungraded Assignments w/ Link==&lt;br /&gt;
Returns all the submitted assignments that still need grading, along with a link that goes directly to the submission to grade it. The links work if you view the report within Moodle.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
&#039;&amp;lt;a href=&amp;quot;http://education.varonis.com/mod/assignment/submissions.php&#039; + char(63) +&lt;br /&gt;
+ &#039;id=&#039; + cast(cm.id as varchar) + &#039;&amp;amp;userid=&#039; + cast(u.id as varchar) &lt;br /&gt;
+ &#039;&amp;amp;mode=single&amp;amp;filter=0&amp;amp;offset=2&amp;quot;&amp;gt;&#039; + a.name + &#039;&amp;lt;/a&amp;gt;&#039;&lt;br /&gt;
AS &amp;quot;Assignmentlink&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Wiki usage, system wide==&lt;br /&gt;
(you can filter the output by selecting some specific course categories : &amp;quot;WHERE c.category IN ( 8,13,15)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039;) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%add%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ADD&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%edit%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;EDIT&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%annotate%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ANNOTATE&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%comments%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;Comments&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_ouwiki_pages as ouwp&lt;br /&gt;
JOIN prefix_ouwiki as ouw ON ouw.id = ouwp.subwikiid&lt;br /&gt;
WHERE ouw.course = c.id GROUP BY ouw.course  ) as OUWikiPages&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( DISTINCT nwp.pagename ) FROM prefix_wiki_pages AS nwp&lt;br /&gt;
JOIN prefix_wiki AS nw ON nw.id = nwp.dfwiki WHERE nw.course = c.id ) As NWikiPages&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 8,13,15)&lt;br /&gt;
HAVING Wikis &amp;gt; 0&lt;br /&gt;
ORDER BY &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Aggregated Teacher activity by &amp;quot;WEB2&amp;quot; Modules==&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
The NV column shows activity without VIEW log activity&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.userid, u.firstname,u.lastname&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039;) AS Wiki&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Wiki_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039;) AS Forum&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Forum_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039;) AS Blog&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Blog_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039;) AS Assignment&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Assignment_NV&lt;br /&gt;
FROM prefix_role_assignments AS ra &lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid &lt;br /&gt;
WHERE ra.roleid = 3 &lt;br /&gt;
GROUP BY ra.userid&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Courses that are defined as using GROUPs==&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/group/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
 FROM `prefix_course` AS c&lt;br /&gt;
WHERE groupmode &amp;gt; 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==System Wide usage count of various course Activities==&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
Like: Forum, Wiki, Blog, Assignment, Database,&lt;br /&gt;
#Within specific category&lt;br /&gt;
#Teacher name in course&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher &lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%blog%&#039;) AS Blogs&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM &lt;br /&gt;
prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%forum%&#039;) AS Forums&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%data%&#039;) AS Databses&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%assignment%&#039;) AS Assignments&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 18)&lt;br /&gt;
ORDER BY Wikis DESC,Blogs DESC, Forums DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==List all the certificates issued, sort by variables in the custom profile fields==&lt;br /&gt;
Note: The SQL queries look intimidating at first, but isn&#039;t really that difficult to learn. I&#039;ve seen in the forums that users wanted to do &#039;site-wide&#039; groups in 1.9x. This is sort of the idea. It pulls all the certificates issued to all users sorted by the custom profile fields, which in my case is the Units or Depts (i.e. my site wide groups). Why certificates? I&#039;ve explored with both grades and quizzes, the course admins are not really interested in the actual grades but whether the learner received a certificate (i.e. passed the course with x, y, z activities). It also saves me from creating groups and assigning them into the right groups. Even assigning in bulk is not efficient, since I have upward of 25 groups per course and constantly new learners enrolling in courses. The limitation is something to do with the server? as it only pull 5000 rows of data. If anyone figured out how to change this, please let me know. In the meantime, the work around is to pull only a few units/depts at a time to limit the number of rows. This is fine at the moment, since each course admin are only responsible for certain units/depts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME(prefix_certificate_issues.timecreated), &#039;%Y/%m/%d&#039; ) AS Date,&lt;br /&gt;
prefix_certificate_issues.classname AS Topic,&lt;br /&gt;
prefix_certificate.name AS Certificate,&lt;br /&gt;
prefix_certificate_issues.studentname as Name,&lt;br /&gt;
prefix_user_info_data.data AS Units&lt;br /&gt;
&lt;br /&gt;
FROM&lt;br /&gt;
prefix_certificate_issues&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_user_info_data&lt;br /&gt;
on prefix_certificate_issues.userid = prefix_user_info_data.userid&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_certificate&lt;br /&gt;
on prefix_certificate_issues.certificateid = prefix_certificate.id&lt;br /&gt;
&lt;br /&gt;
WHERE prefix_user_info_data.data=&#039;Unit 1&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 2&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 3&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY Units, Name, Topic ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
==List all Courses in and below a certain category==&lt;br /&gt;
Use this SQL code to retrieve all courses that exist in or under a set category.&lt;br /&gt;
&lt;br /&gt;
$s should be the id of the category you want to know about...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course. * , prefix_course_categories. *&lt;br /&gt;
FROM prefix_course, prefix_course_categories&lt;br /&gt;
WHERE prefix_course.category = prefix_course_categories.id&lt;br /&gt;
AND (&lt;br /&gt;
prefix_course_categories.path LIKE &#039;/$s/%&#039;&lt;br /&gt;
OR prefix_course_categories.path LIKE &#039;/$s&#039;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=ad-hoc_contributed_reports&amp;diff=89533</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=ad-hoc_contributed_reports&amp;diff=89533"/>
		<updated>2011-09-14T12:27:15Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These are community contributed reports for the [[Custom_SQL_queries_report]] site-wide report plugin (module) &amp;lt;br/&amp;gt;&lt;br /&gt;
Everyone is welcome to add their own. until we find a better way to exchange reports between us.&amp;lt;br/&amp;gt;&lt;br /&gt;
Enjoy :-)&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each MODULE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT module,action,count(id) as counter&lt;br /&gt;
FROM prefix_log&lt;br /&gt;
GROUP BY module,action&lt;br /&gt;
ORDER BY module,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT r.name,l.action, count( l.userid ) as counter&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE ra.roleid IN (3,4,5)&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
ORDER BY counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed &amp;quot;VIEW&amp;quot; ACTION for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT l.action, count( l.userid ) as counter , r.name&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN `prefix_role` AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE (ra.roleid IN (3,4,5)) AND (l.action LIKE &#039;%view%&#039; )&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
order by r.name,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Most Active courses===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, l.course courseId, c.fullname coursename&lt;br /&gt;
FROM prefix_log l INNER JOIN prefix_course c ON l.course = c.id&lt;br /&gt;
GROUP BY courseId&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===RESOURCE count for each COURSE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) count, l.course, c.fullname coursename&lt;br /&gt;
FROM prefix_resource l INNER JOIN prefix_course c on l.course = c.id&lt;br /&gt;
GROUP BY course&lt;br /&gt;
ORDER BY count DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Most popular ACTIVITY===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, module&lt;br /&gt;
FROM prefix_log l&lt;br /&gt;
WHERE module != &#039;login&#039; AND module != &#039;course&#039; AND module != &#039;role&#039;&lt;br /&gt;
GROUP BY module&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===System wide use of ACTIVITIES and RESOURCES===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT count( cm.id ) AS counter, m.name&lt;br /&gt;
FROM `prefix_course_modules` AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
GROUP BY cm.module&lt;br /&gt;
ORDER BY counter DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LOG file ACTIONS per MODULE per COURSE (IDs)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select course,module,action,count(action) as summa from prefix_log&lt;br /&gt;
where action &amp;lt;&amp;gt; &#039;new&#039;&lt;br /&gt;
group by course,action,module&lt;br /&gt;
order by course,module,action&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Compose Web Page&amp;quot; RESOURCE count===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT course,prefix_course.fullname, COUNT(*) AS Total&lt;br /&gt;
FROM `prefix_resource`&lt;br /&gt;
JOIN `prefix_course` ON prefix_course.id = prefix_resource.course&lt;br /&gt;
WHERE type=&#039;html&#039;&lt;br /&gt;
GROUP BY course&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Total Activity of Roles:&amp;quot;Teacher&amp;quot; and &amp;quot;None-Editing Teacher&amp;quot; by Dates and by Hours===&lt;br /&gt;
The output columns of this report table can be used as base for a Pivot-Table&lt;br /&gt;
which will show the amount of &#039;&#039;&#039;activity&#039;&#039;&#039; per &#039;&#039;&#039;hour&#039;&#039;&#039; per &#039;&#039;&#039;days&#039;&#039;&#039; in 3D graph view.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%Y/%m/%d&#039; ) AS grptimed ,&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%k&#039; ) AS grptimeh  , count( l.userid ) AS counter &lt;br /&gt;
FROM `prefix_log` AS l&lt;br /&gt;
JOIN prefix_user AS u ON u.id = l.userid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
WHERE ra.roleid IN (3,4)&lt;br /&gt;
GROUP BY grptimed,grptimeh&lt;br /&gt;
ORDER BY grptimed,grptimeh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===FORUM use Count per COURSE -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===FORUM use Count per COURSE by type -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, prefix_forum.type, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course,prefix_forum.type&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 1.9.x)===&lt;br /&gt;
&lt;br /&gt;
Reports a site global list of all users enroled in each course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user.firstname AS Firstname,&lt;br /&gt;
user.lastname AS Lastname,&lt;br /&gt;
user.email AS Email,&lt;br /&gt;
user.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=asg.roleid)&lt;br /&gt;
FROM&lt;br /&gt;
prefix_user AS user,&lt;br /&gt;
prefix_course AS course,&lt;br /&gt;
prefix_role_assignments AS asg&lt;br /&gt;
INNER JOIN prefix_context AS context ON asg.contextid=context.id   &lt;br /&gt;
WHERE&lt;br /&gt;
context.contextlevel = 50&lt;br /&gt;
AND&lt;br /&gt;
user.id=asg.userid&lt;br /&gt;
AND&lt;br /&gt;
context.instanceid=course.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 2.x)===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user2.firstname AS Firstname,&lt;br /&gt;
user2.lastname AS Lastname,&lt;br /&gt;
user2.email AS Email,&lt;br /&gt;
user2.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT shortname FROM prefix_role WHERE id=en.roleid) as Role&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=en.roleid) as RoleName&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course as course &lt;br /&gt;
JOIN prefix_enrol AS en ON en.courseid = course.id&lt;br /&gt;
JOIN prefix_user_enrolments AS ue ON ue.enrolid = en.id&lt;br /&gt;
JOIN prefix_user AS user2 ON ue.userid = user2.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Permissions Overides on Categories===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712834 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT rc.id, ct.instanceid, ccat.name, rc.roleid, rc.capability, rc.permission, &lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( rc.timemodified ) , &#039;%Y-%m-%d&#039; ) AS timemodified, rc.modifierid, ct.instanceid, ct.path, ct.depth&lt;br /&gt;
FROM `prefix_role_capabilities` AS rc&lt;br /&gt;
INNER JOIN `prefix_context` AS ct ON rc.contextid = ct.id&lt;br /&gt;
INNER JOIN `prefix_course_categories` AS ccat ON ccat.id = ct.instanceid&lt;br /&gt;
AND `contextlevel` =40&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;Totally Opened Courses&amp;quot; (visible, opened to guests, with no password)===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712837 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id , category , fullname , shortname , enrollable&lt;br /&gt;
FROM `prefix_course`&lt;br /&gt;
WHERE `guest` =1&lt;br /&gt;
AND `password` = &amp;quot;&amp;quot;&lt;br /&gt;
AND `visible` =1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;loggedin users&amp;quot; from the last 120 days===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id,username,FROM_UNIXTIME(`lastlogin`) as days &lt;br /&gt;
FROM `mdl_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;and user count for that same population:&#039;&#039;&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(id) as Users  FROM `mdl_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List &amp;quot;Recently uploaded files&amp;quot;===&lt;br /&gt;
see what users are uploading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT FROM_UNIXTIME(time,&#039;%Y %M %D %h:%i:%s&#039;) as time ,ip,userid,url,info  &lt;br /&gt;
FROM `prefix_log` &lt;br /&gt;
WHERE `action` LIKE &#039;upload&#039; &lt;br /&gt;
ORDER BY `prefix_log`.`time`  DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List Courses that loaded a specific file: &amp;quot;X&amp;quot;===&lt;br /&gt;
Did the Teacher (probably) uploaded course&#039;s Syllabus ?&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname  FROM `prefix_log` as l &lt;br /&gt;
JOIN prefix_course as c ON c.id = l.course &lt;br /&gt;
WHERE `action` LIKE &#039;%upload%&#039; AND ( info LIKE &#039;%Syllabus%&#039; OR info LIKE &#039;%Sylabus%&#039; ) GROUP BY c.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Students in all courses of some institute===&lt;br /&gt;
What is the status (deleted or not) of all Students (roleid = 5) in all courses of some Institute&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname, u.firstname, u.lastname, u.deleted&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
AND u.institution = &#039;please enter school name here&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Full User info (for deleted users)===&lt;br /&gt;
Including extra custom profile fields (from mdl_user_info_data)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT * &lt;br /&gt;
FROM mdl_user as u &lt;br /&gt;
JOIN mdl_user_info_data as uid ON uid.userid = u.id &lt;br /&gt;
JOIN mdl_user_info_field as uif ON (uid.fieldid = uif.id AND uif.shortname = &#039;class&#039;)&lt;br /&gt;
WHERE `deleted` = &amp;quot;1&amp;quot; and `institution`=&amp;quot;your school name&amp;quot; and `department` = &amp;quot;your department&amp;quot; and `data` = &amp;quot;class level and number&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Activity In Forums===&lt;br /&gt;
Trying to figure out how much real activity we have in Forums by aggregating:&lt;br /&gt;
Users in Course, Number of Posts, Number of Discussions, Unique student post, Unique student discussions, Number of Teachers , Number of Students, ratio between unique Student posts and the number of students in the Course...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.fullname,f.name,f.type &lt;br /&gt;
,(SELECT count(id) FROM prefix_forum_discussions as fd WHERE f.id = fd.forum) as Discussions&lt;br /&gt;
,(SELECT count(distinct fd.userid) FROM prefix_forum_discussions as fd WHERE fd.forum = f.id) as UniqueUsersDiscussions&lt;br /&gt;
,(SELECT count(fp.id) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as Posts&lt;br /&gt;
,(SELECT count(distinct fp.userid) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as UniqueUsersPosts&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Students&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS StudentsCount&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Teachers&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =3&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS &#039;Teacher&amp;lt;br/&amp;gt;Count&#039;&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid IN (3,5)&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS UserCount&lt;br /&gt;
, (SELECT (UniqueUsersDiscussions / StudentsCount )) as StudentDissUsage&lt;br /&gt;
, (SELECT (UniqueUsersPosts /StudentsCount)) as StudentPostUsage&lt;br /&gt;
FROM prefix_forum as f &lt;br /&gt;
JOIN prefix_course as c ON f.course = c.id&lt;br /&gt;
WHERE `type` != &#039;news&#039;&lt;br /&gt;
ORDER BY StudentPostUsage DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Blog activity per Course (not including VIEW)===&lt;br /&gt;
Filter activity logging to some specific Course Categories!&lt;br /&gt;
+ link course name to actual course (for quick reference)&lt;br /&gt;
(you can change %blog% to %wiki% to filter down all wiki activity or any other module you wish)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID&lt;br /&gt;
,m.name ,count(cm.id) as counter &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS Students&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE `module` LIKE &#039;%blog%&#039; AND course = c.id AND action NOT LIKE &#039;%view%&#039; ) as BlogActivity&lt;br /&gt;
FROM `prefix_course_modules` as cm JOIN prefix_modules as m ON cm.module=m.id JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%blog%&#039; AND c.category IN ( 8,13,15)&lt;br /&gt;
GROUP BY cm.course,cm.module order by counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed WIKI activity (per wiki per course)===&lt;br /&gt;
Including Number of Students in course (for reference)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID  &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id ) AS Students&lt;br /&gt;
,m.name&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%updat%&#039; ) as &#039;UPDAT E&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%annotate%&#039; ) as ANNOTATE&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%comment%&#039; ) as COMMENT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%add%&#039; ) as &#039;A DD&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%edit%&#039; ) as EDIT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action NOT LIKE &#039;%view%&#039; ) as &#039;All (NO View)&#039;&lt;br /&gt;
FROM `prefix_course_modules` as cm &lt;br /&gt;
JOIN prefix_modules as m ON cm.module=m.id &lt;br /&gt;
JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
GROUP BY cm.course,cm.module&lt;br /&gt;
ORDER BY &#039;All (NO View)&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Courses which uploaded a Syllabus file===&lt;br /&gt;
+ under specific Category&lt;br /&gt;
+ show first Teacher in that course&lt;br /&gt;
+ link Course&#039;s fullname to actual course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) as Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user as u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) as Teacher&lt;br /&gt;
FROM prefix_resource as r &lt;br /&gt;
JOIN prefix_course as c ON r.course = c.id&lt;br /&gt;
WHERE ( r.name LIKE &#039;%סילבוס%&#039; OR r.name LIKE &#039;%סילאבוס%&#039; OR r.name LIKE &#039;%syllabus%&#039; OR r.name LIKE &#039;%תכנית הקורס%&#039; ) &lt;br /&gt;
AND c.category IN (10,18,26,13,28)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All resources that link to some specific external website===&lt;br /&gt;
+ link to course&lt;br /&gt;
+ who&#039;s the teacher&lt;br /&gt;
+ link to external resource&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/resource/view.php?id=&#039;,r.id,&#039;&amp;quot;&amp;gt;&#039;,r.name,&#039;&amp;lt;/a&amp;gt;&#039;) AS Resource&lt;br /&gt;
FROM prefix_resource AS r &lt;br /&gt;
JOIN prefix_course AS c ON r.course = c.id&lt;br /&gt;
WHERE r.reference LIKE &#039;http://info.oranim.ac.il/home%&#039; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===How many LOGINs per user and user&#039;s Activity===&lt;br /&gt;
+ link username to a user activity graph report&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,u.id,&#039;&amp;amp;mode=alllogs&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) as Username&lt;br /&gt;
,count(*) as logins&lt;br /&gt;
,(SELECT count(*) FROM prefix_log WHERE userid = l.userid GROUP BY userid) as Activity &lt;br /&gt;
FROM prefix_log as l JOIN prefix_user as u ON l.userid = u.id &lt;br /&gt;
WHERE `action` LIKE &#039;%login%&#039; group by userid&lt;br /&gt;
ORDER BY Activity DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===User&#039;s courses===&lt;br /&gt;
change &amp;quot;u.id = 2&amp;quot; with a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname, u.lastname, c.id, c.fullname&lt;br /&gt;
FROM mdl_course AS c&lt;br /&gt;
JOIN mdl_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN mdl_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE u.id = 2&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Forum type:NEWS===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT f.id, f.name&lt;br /&gt;
FROM mdl_course_modules AS cm&lt;br /&gt;
JOIN mdl_modules AS m ON cm.module = m.id&lt;br /&gt;
JOIN mdl_forum AS f ON cm.instance = f.id&lt;br /&gt;
WHERE m.name = &#039;forum&#039;&lt;br /&gt;
AND f.type = &#039;news&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All new forum NEWS items (discussions) from all my Courses===&lt;br /&gt;
change &amp;quot;userid = 26&amp;quot; and &amp;quot;id = 26&amp;quot; to a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname,f.name,fd.name,FROM_UNIXTIME(fd.timemodified ,&amp;quot;%d %M %Y &amp;quot;) as Date&lt;br /&gt;
FROM mdl_forum_discussions as fd &lt;br /&gt;
JOIN mdl_forum as f ON f.id = fd.forum &lt;br /&gt;
JOIN mdl_course as c ON c.id = f.course &lt;br /&gt;
JOIN mdl_user_lastaccess as ul ON (c.id = ul.courseid AND ul.userid = 26)&lt;br /&gt;
WHERE fd.timemodified &amp;gt; ul.timeaccess  &lt;br /&gt;
 AND fd.forum IN (SELECT f.id&lt;br /&gt;
 FROM mdl_course_modules AS cm&lt;br /&gt;
 JOIN mdl_modules AS m ON cm.module = m.id&lt;br /&gt;
 JOIN mdl_forum AS f ON cm.instance = f.id&lt;br /&gt;
 WHERE m.name = &#039;forum&#039;&lt;br /&gt;
 AND f.type = &#039;news&#039;)&lt;br /&gt;
  AND c.id IN (SELECT c.id&lt;br /&gt;
   FROM mdl_course AS c&lt;br /&gt;
   JOIN mdl_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
   JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
   JOIN mdl_user AS u ON u.id = ra.userid&lt;br /&gt;
   WHERE u.id = 26) ORDER BY `fd`.`timemodified` DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Resource count in courses==&lt;br /&gt;
+ (First)Teacher name&lt;br /&gt;
+ Where course is inside some specific Categories&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
COUNT(*) AS count&lt;br /&gt;
,r.course &lt;br /&gt;
,c.shortname shortname&lt;br /&gt;
,c.fullname coursename&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user as u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = r.course AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
FROM prefix_resource r &lt;br /&gt;
JOIN prefix_course c ON r.course = c.id&lt;br /&gt;
WHERE c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY r.course&lt;br /&gt;
ORDER BY COUNT(*) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==News Forum - Discussions COUNT==&lt;br /&gt;
Which is actually... How much instructions students get from their teachers&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname ,&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user AS u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = c.id AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/forum/view.php?f=&#039;,fd.forum,&#039;&amp;quot;&amp;gt;&#039;,count(fd.id),&#039;&amp;lt;/a&amp;gt;&#039;) AS DiscussionsSum&lt;br /&gt;
FROM prefix_forum_discussions AS fd&lt;br /&gt;
INNER JOIN prefix_forum AS f ON f.id = fd.forum&lt;br /&gt;
INNER JOIN prefix_course AS c ON c.id = f.course&lt;br /&gt;
WHERE f.type = &#039;news&#039; AND c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY fd.forum&lt;br /&gt;
ORDER BY count(fd.id) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Special Roles==&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.roleid,r.name&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,ra.userid,&#039;&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Username&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_context AS ctx ON (ctx.id = ra.contextid AND ctx.contextlevel = 50)&lt;br /&gt;
JOIN prefix_course AS c ON ctx.instanceid = c.id&lt;br /&gt;
WHERE ra.roleid &amp;gt; 6&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Courses without Teachers==&lt;br /&gt;
Actually, shows the number of Teachers in a course.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id) AS Teachers&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
ORDER BY Teachers ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Site-Wide Grade Report with All Items==&lt;br /&gt;
Shows grades for all course items along with course totals for each student.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
c.fullname AS &#039;Course&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id &lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Site-Wide Grade Report with Just Course Totals==&lt;br /&gt;
A second site-wide grade report for all students that just shows course totals.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id AND gi.itemtype = &#039;course&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
==All Ungraded Assignments==&lt;br /&gt;
Returns all the submitted assignments that still need grading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id&lt;br /&gt;
and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==All Ungraded Assignments w/ Link==&lt;br /&gt;
Returns all the submitted assignments that still need grading, along with a link that goes directly to the submission to grade it. The links work if you view the report within Moodle.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
&#039;&amp;lt;a href=&amp;quot;http://education.varonis.com/mod/assignment/submissions.php&#039; + char(63) +&lt;br /&gt;
+ &#039;id=&#039; + cast(cm.id as varchar) + &#039;&amp;amp;userid=&#039; + cast(u.id as varchar) &lt;br /&gt;
+ &#039;&amp;amp;mode=single&amp;amp;filter=0&amp;amp;offset=2&amp;quot;&amp;gt;&#039; + a.name + &#039;&amp;lt;/a&amp;gt;&#039;&lt;br /&gt;
AS &amp;quot;Assignmentlink&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Wiki usage, system wide==&lt;br /&gt;
(you can filter the output by selecting some specific course categories : &amp;quot;WHERE c.category IN ( 8,13,15)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039;) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%add%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ADD&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%edit%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;EDIT&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%annotate%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ANNOTATE&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%comments%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;Comments&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_ouwiki_pages as ouwp&lt;br /&gt;
JOIN prefix_ouwiki as ouw ON ouw.id = ouwp.subwikiid&lt;br /&gt;
WHERE ouw.course = c.id GROUP BY ouw.course  ) as OUWikiPages&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( DISTINCT nwp.pagename ) FROM prefix_wiki_pages AS nwp&lt;br /&gt;
JOIN prefix_wiki AS nw ON nw.id = nwp.dfwiki WHERE nw.course = c.id ) As NWikiPages&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 8,13,15)&lt;br /&gt;
HAVING Wikis &amp;gt; 0&lt;br /&gt;
ORDER BY &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Aggregated Teacher activity by &amp;quot;WEB2&amp;quot; Modules==&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
The NV column shows activity without VIEW log activity&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.userid, u.firstname,u.lastname&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039;) AS Wiki&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Wiki_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039;) AS Forum&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Forum_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039;) AS Blog&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Blog_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039;) AS Assignment&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Assignment_NV&lt;br /&gt;
FROM prefix_role_assignments AS ra &lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid &lt;br /&gt;
WHERE ra.roleid = 3 &lt;br /&gt;
GROUP BY ra.userid&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Courses that are defined as using GROUPs==&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/group/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
 FROM `prefix_course` AS c&lt;br /&gt;
WHERE groupmode &amp;gt; 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==System Wide usage count of various course Activities==&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
Like: Forum, Wiki, Blog, Assignment, Database,&lt;br /&gt;
#Within specific category&lt;br /&gt;
#Teacher name in course&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher &lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%blog%&#039;) AS Blogs&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM &lt;br /&gt;
prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%forum%&#039;) AS Forums&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%data%&#039;) AS Databses&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%assignment%&#039;) AS Assignments&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 18)&lt;br /&gt;
ORDER BY Wikis DESC,Blogs DESC, Forums DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==List all the certificates issued, sort by variables in the custom profile fields==&lt;br /&gt;
Note: The SQL queries look intimidating at first, but isn&#039;t really that difficult to learn. I&#039;ve seen in the forums that users wanted to do &#039;site-wide&#039; groups in 1.9x. This is sort of the idea. It pulls all the certificates issued to all users sorted by the custom profile fields, which in my case is the Units or Depts (i.e. my site wide groups). Why certificates? I&#039;ve explored with both grades and quizzes, the course admins are not really interested in the actual grades but whether the learner received a certificate (i.e. passed the course with x, y, z activities). It also saves me from creating groups and assigning them into the right groups. Even assigning in bulk is not efficient, since I have upward of 25 groups per course and constantly new learners enrolling in courses. The limitation is something to do with the server? as it only pull 5000 rows of data. If anyone figured out how to change this, please let me know. In the meantime, the work around is to pull only a few units/depts at a time to limit the number of rows. This is fine at the moment, since each course admin are only responsible for certain units/depts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME(prefix_certificate_issues.timecreated), &#039;%Y/%m/%d&#039; ) AS Date,&lt;br /&gt;
prefix_certificate_issues.classname AS Topic,&lt;br /&gt;
prefix_certificate.name AS Certificate,&lt;br /&gt;
prefix_certificate_issues.studentname as Name,&lt;br /&gt;
prefix_user_info_data.data AS Units&lt;br /&gt;
&lt;br /&gt;
FROM&lt;br /&gt;
prefix_certificate_issues&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_user_info_data&lt;br /&gt;
on prefix_certificate_issues.userid = prefix_user_info_data.userid&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_certificate&lt;br /&gt;
on prefix_certificate_issues.certificateid = prefix_certificate.id&lt;br /&gt;
&lt;br /&gt;
WHERE prefix_user_info_data.data=&#039;Unit 1&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 2&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 3&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY Units, Name, Topic ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
==List all Courses in and below a certain category==&lt;br /&gt;
Use this SQL code to retrieve all courses that exist in or under a set category.&lt;br /&gt;
&lt;br /&gt;
$s should be the id of the category you want to know about...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course. * , prefix_course_categories. *&lt;br /&gt;
FROM prefix_course, prefix_course_categories&lt;br /&gt;
WHERE prefix_course.category = prefix_course_categories.id&lt;br /&gt;
AND (&lt;br /&gt;
prefix_course_categories.path LIKE &#039;/$v/%&#039;&lt;br /&gt;
OR prefix_course_categories.path LIKE &#039;/$s&#039;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Private_files&amp;diff=85211</id>
		<title>Private files</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Private_files&amp;diff=85211"/>
		<updated>2011-06-14T18:18:03Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Working with files and folders}}&lt;br /&gt;
{{Repositories}}&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Please refer to [[Page_notes#Private files|these notes]] before editing this page.&#039;&#039;&#039;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Moodle 2.0 onwards, each user has a private files area for uploading and managing a set of files.&lt;br /&gt;
&lt;br /&gt;
The private files area is accessible via &#039;&#039;Navigation &amp;gt; My home &amp;gt; My profile &amp;gt; My private files&#039;&#039; or the [[My private files block]]. It is available as a source within the filepicker when selecting files to use in a course.&lt;br /&gt;
&lt;br /&gt;
==Private files management==&lt;br /&gt;
&lt;br /&gt;
To add a file to your private files area&lt;br /&gt;
# On the Navigation menu, click My profile &amp;gt; My private files&lt;br /&gt;
# Click &amp;quot;Manage my private files&amp;quot; button&lt;br /&gt;
# The standard file picker Add-Create folder popup will appear.&lt;br /&gt;
# If desired, create or move to a folder,&lt;br /&gt;
#Click on the Add button &lt;br /&gt;
#Browse for and select a file&lt;br /&gt;
# Click the &#039;Save changes&#039; button&lt;br /&gt;
&lt;br /&gt;
[[Image:Files_standard_added_files_1.png|center|frame|Standard file add- create directory, showing 2 files]]&lt;br /&gt;
*Uploaded files may be downloaded, renamed, moved or deleted by clicking the icon next to the file. After making any changes, &#039;&#039;&#039;remember to click the &#039;Save changes&#039; button&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;br /&gt;
[[Category:Moodle 2.0]][[Category:Files]]&lt;br /&gt;
&lt;br /&gt;
[[eu:Fitxategi_pribatuak]]&lt;br /&gt;
[[fr:Fichiers personnels]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Legacy_course_files&amp;diff=85210</id>
		<title>Legacy course files</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Legacy_course_files&amp;diff=85210"/>
		<updated>2011-06-14T18:17:23Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Working with files and folders}}&lt;br /&gt;
{{Repositories}}&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Please refer to [[Page_notes#Legacy course files|these notes]] before editing this page.&#039;&#039;&#039;&amp;lt;/p&amp;gt;&lt;br /&gt;
In Moodle 2.0 onwards, files are stored in separate areas, rather than together in the course files area. See [[Course files]] for a detailed explanation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: It is recommended that teachers make use of the new [[Repositories|repositories]] in Moodle 2.0 for storing course files, rather than saving them in a course files area&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In Moodle 2.0 the course files area has been renamed &#039;Legacy course files&#039;. By default, this area is not available in new courses.&lt;br /&gt;
&lt;br /&gt;
==Enabling legacy course files areas==&lt;br /&gt;
&lt;br /&gt;
To enable a legacy course files area in a new course&lt;br /&gt;
&lt;br /&gt;
# Enable the legacy course files repository plugin in &#039;&#039;Administration &amp;gt; Plugins &amp;gt; Repositories &amp;gt; [[Manage repositories]]&#039;&#039;.&lt;br /&gt;
# Check the legacyfilesinnewcourses box in the Manage repositories common settings then click the &#039;Save changes&#039; button.&lt;br /&gt;
# Set &#039;Legacy course files&#039; to Yes in the course settings.&lt;br /&gt;
&lt;br /&gt;
A legacy course files link will then appear in the course administration block.&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Anti-virus&amp;diff=84915</id>
		<title>Anti-virus</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Anti-virus&amp;diff=84915"/>
		<updated>2011-06-10T17:40:11Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Security}}&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Please refer to [[Page_notes#Anti-Virus |these notes]] before editing this page.&#039;&#039;&#039;&amp;lt;/p&amp;gt;&lt;br /&gt;
Location: &#039;&#039;Administration &amp;gt; Security &amp;gt; Anti-Virus&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To make use of Moodle&#039;s anti-virus feature, the open source virus scanner ClamAV should be installed on your server. See http://www.clamav.net for more information.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=147820 ClamAV upgrade may be required] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[Category:Administrator]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
[[eu:Antibirusa]]&lt;br /&gt;
[[hu:Vírusölő]]&lt;br /&gt;
[[de:Anti-Virus]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Database_activity_FAQ&amp;diff=74109</id>
		<title>Database activity FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Database_activity_FAQ&amp;diff=74109"/>
		<updated>2010-07-21T23:26:10Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Database activity module}}&lt;br /&gt;
==Where can I download additional database presets?==&lt;br /&gt;
&lt;br /&gt;
See [[Database presets]] for discussion links with presets for download.&lt;br /&gt;
&lt;br /&gt;
==How can I create a database in which students can only view their own entries?==&lt;br /&gt;
&lt;br /&gt;
Either:&lt;br /&gt;
*Set up the database so that entries require approval. If the entries are never approved, then only the student that added a particular entry and the teachers can view it.&lt;br /&gt;
&lt;br /&gt;
Or:&lt;br /&gt;
*Set the group mode of the database to &amp;quot;Separate groups&amp;quot; and assign each student to a separate group.&lt;br /&gt;
&lt;br /&gt;
==How can I enable a sort function by clicking on the field headings?==&lt;br /&gt;
&lt;br /&gt;
For sorting, you need to manually create the link in the template around that heading.  To find the URL you need, you can do a sort using the menus and then look in the URLs. Take out everything but the d, sort and order parameters. For example,&lt;br /&gt;
&lt;br /&gt;
http://moodle.org/mod/data/view.php?d=13&amp;amp;sort=44&amp;amp;order=ASC&lt;br /&gt;
&lt;br /&gt;
http://moodle.org/mod/data/view.php?d=13&amp;amp;sort=44&amp;amp;order=DESC&lt;br /&gt;
&lt;br /&gt;
==How can I add highlighting like on the Module and plugins page?==&lt;br /&gt;
&lt;br /&gt;
In the repeated part of the template (note onmouseover and onmouseout to change the classes):&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;tr onmouseover=&amp;quot;this.className=&#039;trhighlight&#039;&amp;quot; onmouseout=&amp;quot;this.className=&#039;trnormal&#039;&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;td class=&amp;quot;c0&amp;quot;&amp;gt;&amp;lt;b&amp;gt;&amp;lt;a href=&amp;quot;##MoreURL##&amp;quot;&amp;gt;[[Name]]&amp;lt;/a&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;td class=&amp;quot;c1&amp;quot;&amp;gt;[[Type]]&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;td class=&amp;quot;c2&amp;quot;&amp;gt;[[Requirement]]&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;td class=&amp;quot;c3&amp;quot;&amp;gt;[[Status]]&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;td class=&amp;quot;c4&amp;quot;&amp;gt;[[Summary]]&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;td align=&amp;quot;center&amp;quot; class=&amp;quot;c5&amp;quot;&amp;gt;##Edit##&amp;amp;nbsp;##Delete##&amp;amp;nbsp;##More##&amp;amp;nbsp;##Approve## &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the CSS template there are two styles:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;.trnormal td {&lt;br /&gt;
   background-color: #FFFFFF;&lt;br /&gt;
 }&lt;br /&gt;
 .trhighlight td {&lt;br /&gt;
   background-color: #EEEEEE;&lt;br /&gt;
 }&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How can I list database information horizontally instead of vertically?==&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=74243 How can I list database information horizontally instead of vertically? Forum discussion]&lt;br /&gt;
&lt;br /&gt;
==Can&#039;t get columns to line up in list view==&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=84050 Can&#039;t get columns to line up in list view forum discussion] including moodle.org presets for download&lt;br /&gt;
&lt;br /&gt;
==How can I make an Encyclopedia database preset?==&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=87560 Encyclopedia database preset forum discussion] including encyclopedia-style preset for download&lt;br /&gt;
&lt;br /&gt;
==Is there a Time stamp for database entries?==&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=86927 Time stamp for database entries forum discussion]&lt;br /&gt;
&lt;br /&gt;
==How can I make the title of an entry into a link?==&lt;br /&gt;
&lt;br /&gt;
To make the title of an entry in list view link to the single view, add the following code to the list template:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;a href=&amp;quot;##moreurl##&amp;quot;&amp;gt;[[Title]]&amp;lt;/a&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How can I make email addresses clickable?==&lt;br /&gt;
&lt;br /&gt;
To make email addresses clickable, add the following code to the single template:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;a href=&amp;quot;mailto:[[Email]]&amp;quot;&amp;gt;[[Email]]&amp;lt;/a&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &#039;Email&#039; is the text field for inputting email addresses.&lt;br /&gt;
&lt;br /&gt;
==How can I delete a file attached to a database entry?==&lt;br /&gt;
&lt;br /&gt;
There is currently no user interface for deleting a file attached to a database entry, however a workaround would be to delete the entry completely and then create a new entry without the file attached.&lt;br /&gt;
&lt;br /&gt;
==How can I hide a database entry which was previously approved?==&lt;br /&gt;
&lt;br /&gt;
There is currently no user interface for hiding a database entry which was previously approved i.e. setting it to require approval again. However, an entry can be hidden using [[MySQL Admin]] by editing it in the &#039;&#039;data_records&#039;&#039; table and changing the approved value from 1 to 0.&lt;br /&gt;
&lt;br /&gt;
==How can I add a default sort order of entries?==&lt;br /&gt;
&lt;br /&gt;
In the Fields tab, select a default sort field, choose ascending or descending then click the Save button.&lt;br /&gt;
&lt;br /&gt;
==Why is my database so slow to show each page?==&lt;br /&gt;
&lt;br /&gt;
Try to go to &amp;quot;Administration &amp;gt; Miscellaneous &amp;gt; XMLDB editor&amp;quot; and choose &amp;quot;Check Indexes&amp;quot;. If you have any missing indexes found; upgrade your Moodle to the latest weekly build of your version; re-run the test; backup your site database and then run the suggested SQL from the test on your site database. This should speed up your database activity load times.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=87005 New preset, please review, and make suggestions!] including FAQ preset for download&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=88727 Design a Database Preset for Document Sharing] including preset for download&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=55338 Look of the database module]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=61179 For those who want the display of Moodle Site&#039;s Modules and plugins]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=94854#p457252 Looking for some stellar examples of Moodle courses] including book reviews preset for download&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[de:Datenbank FAQ]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Moodle_2.0_release_notes&amp;diff=73998</id>
		<title>Moodle 2.0 release notes</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Moodle_2.0_release_notes&amp;diff=73998"/>
		<updated>2010-07-18T07:31:51Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* System requirements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Work_in_progress}}&lt;br /&gt;
&lt;br /&gt;
Release date: &#039;&#039;&#039;July 20, 2010&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Before the final release we will have a series of rapidly improving Preview releases.  These are to allow a wider range of developers and contributors to test the code on copies of their production servers, help us tweak the interface and performance, and work on translations, modules and other third-party code (most of which will have to be rewritten significantly).&lt;br /&gt;
&lt;br /&gt;
* [[Moodle 2.0 Preview 1 release notes]] - May 4, 2010&lt;br /&gt;
* [[Moodle 2.0 Preview 2 release notes]] - May 17, 2010&lt;br /&gt;
* [[Moodle 2.0 Preview 3 release notes]] - May 31, 2010&lt;br /&gt;
* [[Moodle 2.0 Preview 4 release notes]] - June 30, 2010&lt;br /&gt;
* [[Moodle 2.0 Preview 5 release notes]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Moodle 2.0 contains a lot of large new features, some completely rewritten features, and hundreds of bug fixes.  For full details (more than you probably want!), see [http://tracker.moodle.org/browse/MDL/fixforversion/10122 the full list of fixed issues in 2.0].&lt;br /&gt;
&lt;br /&gt;
This page is a summary of the major things to look for (links and screenshots will be added over time).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Major new features==&lt;br /&gt;
&lt;br /&gt;
===Community hubs===&lt;br /&gt;
&lt;br /&gt;
* Anybody can set up a Community Hub, which is a directory of courses for public use or for private communities.  The code is implemented as separate GPL plugin for Moodle.&lt;br /&gt;
* Sites can register to any Community Hub (instead of just moodle.org)&lt;br /&gt;
* Teachers on registered sites can publish their full courses to Community Hubs, for download&lt;br /&gt;
* Teachers on registered sites can also advertise their courses on Community Hubs, for people to join&lt;br /&gt;
* Teachers on any site can search all public Community Hubs and download courses as templates for their own courses&lt;br /&gt;
* Users on any Moodle site can also search Community Hubs for courses (and communities of practice) to participate in.  Initially we are encouraging &#039;&#039;&#039;&#039;communities of teaching practice&#039;&#039;&#039;&#039; but any sort of course can be listed.&lt;br /&gt;
&lt;br /&gt;
===Repository support===&lt;br /&gt;
&lt;br /&gt;
* Moodle now supports integration with external repositories of content, making it really simple to bring documents and media into Moodle via an AJAX interface that looks like a standard &#039;&#039;&#039;Open&#039;&#039;&#039; dialogue in desktop applications.&lt;br /&gt;
* Initial plugins in 2.0 include: Alfresco, Amazon S3, Box.net, File system on Server, Flickr, Google Docs, Mahara, MERLOT, Picasa, Recent Files, Remote Moodle sites, WebDAV servers, Wikimedia, Youtube.  These are simple to develop, so many more are expected.&lt;br /&gt;
* You can also import files from your desktop or by specifying a URL.&lt;br /&gt;
&lt;br /&gt;
===Portfolio support===&lt;br /&gt;
&lt;br /&gt;
* Modules can now export their data to external systems, particularly useful for portfolios where snapshots of forums, assignments and other things in Moodle are useful to record in a journal or a portfolio of evidence&lt;br /&gt;
* Different formats are supported (currently LEAP2A, HTML, Images and Text, but others like PDF can be added)&lt;br /&gt;
* Initial plugins in 2.0 include: Box.net, Flickr, Google Docs, &#039;&#039;&#039;Mahara&#039;&#039;&#039; and Picasa.&lt;br /&gt;
&lt;br /&gt;
===Completion===&lt;br /&gt;
&lt;br /&gt;
* Teachers can now specify conditions that define when any &#039;&#039;&#039;activity&#039;&#039;&#039; is seen as completed by a student.  For example, when a certain number of posts have been made, or a grade has been reached, or a choice has been made.  &lt;br /&gt;
* Teachers can now specify conditions that define with any &#039;&#039;&#039;course&#039;&#039;&#039; is seen as completed by a student.  Conditions include activity completion, but could also be by grade, date or a number of other criteria.&lt;br /&gt;
* Teachers and students can see reports that show the progress of any user within a course, or through a series of courses.&lt;br /&gt;
&lt;br /&gt;
===Conditional activities===&lt;br /&gt;
&lt;br /&gt;
* Access to activities can be restricted based on certain criteria, such as dates, grade obtained, or the completion of another activity.  &lt;br /&gt;
* These can be chained together to enable progressive disclosure of the course content, if that is desired. &lt;br /&gt;
&lt;br /&gt;
===Cohorts===&lt;br /&gt;
* Also known as &amp;quot;Site-wide groups&amp;quot;, these are site-wide collections of users that can be enrolled into courses in one action, either manually or synchronised automatically&lt;br /&gt;
&lt;br /&gt;
===Web services support===&lt;br /&gt;
* Support for standards-based web services across the entire Moodle code base, allowing the admin to expose particular functions of Moodle for use by:&lt;br /&gt;
** Administrative systems such as HR or SIS applications&lt;br /&gt;
** Mobile clients&lt;br /&gt;
* Framework contains a very high-level of security with a detailed token system and complete control over the range of functions exposed&lt;br /&gt;
* All defined functions are automatically available via:&lt;br /&gt;
** SOAP&lt;br /&gt;
** XML-RPC&lt;br /&gt;
** REST&lt;br /&gt;
** AMF (Flash)&lt;br /&gt;
&lt;br /&gt;
===IMS Common Cartridge===&lt;br /&gt;
* Moodle can now import courses in IMS Common Cartridge format (commonly used by publishers)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===New blocks===&lt;br /&gt;
* Comments block - like a shoutbox, allows comments to be added to any page. Great for student feedback.&lt;br /&gt;
* Private files block - allows easy access to one&#039;s private file repository in Moodle (with quota support)&lt;br /&gt;
* Community block - keeps track of external courses one is interested in &lt;br /&gt;
* Completion block - reports on the completion status of your courses&lt;br /&gt;
&lt;br /&gt;
==Major improvements to existing core features==&lt;br /&gt;
&lt;br /&gt;
===Backup and restore===&lt;br /&gt;
&lt;br /&gt;
* Completely rewritten Backup/Restore framework, no longer bound by memory (can work with &#039;&#039;&#039;any size course&#039;&#039;&#039;).&lt;br /&gt;
* Completely new backup format.&lt;br /&gt;
* Improved interface.&lt;br /&gt;
* Backup can be made of whole courses, but also specific sections or activities.&lt;br /&gt;
&lt;br /&gt;
===Blocks===&lt;br /&gt;
* Blocks are now consistently implemented on every page in Moodle&lt;br /&gt;
* No longer any limit to the block regions (in addition to left and right, put them at the top, center or bottom of pages)&lt;br /&gt;
* Any block can be made sticky (appears in all the contexts below, eg throughout a course).&lt;br /&gt;
* Blocks can be &amp;quot;docked&amp;quot; on the side of the screen (if the theme supports it)&lt;br /&gt;
&lt;br /&gt;
===Blog===&lt;br /&gt;
* Support for comments on each blog entry&lt;br /&gt;
* Removal of group-level and course-level blogs (these are converted into forums on upgrade)&lt;br /&gt;
* Support for external blog feeds (synchronised to Moodle blog)&lt;br /&gt;
&lt;br /&gt;
===Comments===&lt;br /&gt;
* User comments (Glossaries, Databases, Blogs, etc) are now all consistently handled  and displayed throughout Moodle, using AJAX if available&lt;br /&gt;
* User activity reports will include all the comments made by that user&lt;br /&gt;
&lt;br /&gt;
===Enrolment plugins===&lt;br /&gt;
* Major improvements in the handling of guests and guest accounts &lt;br /&gt;
* Support for multiple forms of enrolment at the same time &lt;br /&gt;
* More detailed control over enrolment in courses &lt;br /&gt;
&lt;br /&gt;
===File handling===&lt;br /&gt;
&lt;br /&gt;
* Full support for Unicode file names on all operating systems.&lt;br /&gt;
* Metadata about each file (author, date, license, etc) and what the file is used for are stored in the database.&lt;br /&gt;
* Duplicate files (for example, a large video file use in two different courses) are only stored once, saving disk space.&lt;br /&gt;
* Files are no longer just &amp;quot;uploaded to the course&amp;quot;.  Files are connected to the particular bit of Moodle content that uses them. (For example, a file may belong to a file resource, a forum post or a wiki page). Access to these files is then controlled by the same rules as as that bit of Moodle, increasing security.&lt;br /&gt;
&lt;br /&gt;
===Gradebook===&lt;br /&gt;
* Details coming soon&lt;br /&gt;
&lt;br /&gt;
===HTML editor===&lt;br /&gt;
* New editor based on TinyMCE&lt;br /&gt;
* Works on more browsers&lt;br /&gt;
* Resizable editing area&lt;br /&gt;
* Cleaner XHTML output &lt;br /&gt;
* Full integration with configured external repositories to import and embed media into text&lt;br /&gt;
&lt;br /&gt;
===Messaging===&lt;br /&gt;
* All email sent by Moodle is now treated as a message&lt;br /&gt;
* A message overview panel allows users to control how messages are sent to them&lt;br /&gt;
* Initial message output plugins in Moodle 2.0 include: Email, Jabber and Popups&lt;br /&gt;
&lt;br /&gt;
===My Moodle page===&lt;br /&gt;
* More customisable My Moodle page with new blocks for showing relevant information &lt;br /&gt;
* Admin can design (and optionally force) site-wide layouts for My Moodle&lt;br /&gt;
* My Moodle page given more prominence as the main &amp;quot;home page&amp;quot; for users&lt;br /&gt;
&lt;br /&gt;
===Navigation===&lt;br /&gt;
* Standard &amp;quot;Navigation&amp;quot; block on every page showing contextual links, while allowing you to jump elsewhere quickly&lt;br /&gt;
* Standard &amp;quot;Settings&amp;quot; blocks on every page shows contextual settings as well as settings for anything else you have permissions for&lt;br /&gt;
&lt;br /&gt;
===Ratings===&lt;br /&gt;
* User ratings (Glossaries, Databases, Forums, etc) are now all consistently handled and displayed throughout Moodle, using AJAX if available&lt;br /&gt;
* Aggregation of using ratings into activity grades is now standardised in all activities&lt;br /&gt;
&lt;br /&gt;
===Roles and permissions===&lt;br /&gt;
* Improved and simplified AJAX interfaces for defining and assigning roles&lt;br /&gt;
* Improved and simplified interfaces for tweaking permissions in any given context &lt;br /&gt;
* New &amp;quot;Archetypes&amp;quot; concept replacing the &amp;quot;Legacy roles&amp;quot; concept.&lt;br /&gt;
* New archetype &amp;quot;manager&amp;quot; to define the role of most people with system-wide editing rights, separate from &amp;quot;admin&amp;quot; role.&lt;br /&gt;
&lt;br /&gt;
===RSS feeds===&lt;br /&gt;
* All RSS feeds are now secured using a random per-user token in the URL&lt;br /&gt;
* Tokens can be updated by the user at any time (if they suspect a feed URL has been compromised)&lt;br /&gt;
* RSS feeds are now more accurate (eg they support forums with separate groups), and are generated efficiently whenever required&lt;br /&gt;
&lt;br /&gt;
===Themes===&lt;br /&gt;
* Many new themes in the core distribution&lt;br /&gt;
* All HTML and JS ouput is now far more efficient (server-side caching) and consistent (tableless layout, new CSS, YUI Framework)&lt;br /&gt;
* Themes can change the HTML of the page if they wish&lt;br /&gt;
* Core support for custom menus in all themes (for example at the top of the page)&lt;br /&gt;
&lt;br /&gt;
===Translation system===&lt;br /&gt;
* [http://lang.moodle.org/ New web portal] to make it easer for groups to collaborate on translating Moodle, and to keep their translations up-to-date.&lt;br /&gt;
* More efficient [[Development:Languages/AMOS|storage format for language strings]] should slightly improve performance.&lt;br /&gt;
&lt;br /&gt;
===User profile pages===&lt;br /&gt;
* Site-wide user profile page can be customised by users with blocks, news, feeds and so on&lt;br /&gt;
* Course-specific user profile pages show course blocks and standard profile information, plus information for teachers of that course&lt;br /&gt;
&lt;br /&gt;
==Major improvements to activity modules==&lt;br /&gt;
&lt;br /&gt;
===Lesson===&lt;br /&gt;
* Refactored internal code &lt;br /&gt;
* Forms are now standard Moodle forms&lt;br /&gt;
&lt;br /&gt;
===Quiz module and question bank===&lt;br /&gt;
&lt;br /&gt;
* [[Development:quiz_navigation|Quiz navigation improvements for students]]&lt;br /&gt;
* [[Development:Flagging_questions_during_a_quiz_attempt|Flagging questions during a quiz attempt]] &lt;br /&gt;
* [[Development:Quiz_report_enhancements|Quiz report enhancements]] - Major improvements to the quiz reports, especially regrading and item analysis&lt;br /&gt;
* [[Development:Quiz_UI_redesign|Quiz editing interface improvements]]&lt;br /&gt;
* Different settings (open/close date, number of attempts, password, time limit) for each group or student (MDL-16478)&lt;br /&gt;
* [[Development:Administration page for question types|Administration page for question types]]&lt;br /&gt;
* [[Development:Moodle 2.0 question bank improvements|Question tagging and improved searching in the question bank]]&lt;br /&gt;
* MDL-8648 Essay questions can now be randomised by random questions&lt;br /&gt;
&lt;br /&gt;
===Resource===&lt;br /&gt;
* All the resource types have been refactored into real modules, and cleaned up&lt;br /&gt;
** File - for displaying a file, possibly with supporting files (like a HTML mini-site)&lt;br /&gt;
** Folder - for displaying a collection of documents &lt;br /&gt;
** URL - for displaying a page with a given URL&lt;br /&gt;
** Page - for a single page, edited online using the HTML editor&lt;br /&gt;
** IMS - for showing a regular IMS content package&lt;br /&gt;
* Better XHTML-compliant support for frames, iframes and embedding in all these modules&lt;br /&gt;
&lt;br /&gt;
===SCORM===&lt;br /&gt;
&lt;br /&gt;
* New [[SCORM module]] settings - display attempt status, display course structure, force completed, force new attempt, lock after final attempt - allowing the behaviour dictated to the SCORM object by the authoring package to be changed MDL-11501 &lt;br /&gt;
* New reporting interface including sortable/collapsible table with group select box and ability to download in Excel, ODS and text format MDL-21555&lt;br /&gt;
&lt;br /&gt;
===Wiki===&lt;br /&gt;
* Completely re-written from scratch, based on NWIki from UPC&lt;br /&gt;
* Support for Mediawiki-style syntax, as well as Creole &lt;br /&gt;
* Interface improvements &lt;br /&gt;
&lt;br /&gt;
===Workshop===&lt;br /&gt;
&lt;br /&gt;
* Completely rewritten from scratch &lt;br /&gt;
* Vastly improved interface for managing stages and users&lt;br /&gt;
&lt;br /&gt;
==System requirements==&lt;br /&gt;
&lt;br /&gt;
Since Moodle 2.0 is such a major release, we are allowing ourselves some increases in the requirements.&lt;br /&gt;
&lt;br /&gt;
* PHP must be 5.2.8 or later (it was released 08-Dec-2008)&lt;br /&gt;
* Databases should be one of the following:&lt;br /&gt;
** MySQL 5.0.25 or later  (InnoDB storage engine highly recommended)&lt;br /&gt;
** PostgreSQL 8.3 or later&lt;br /&gt;
** Oracle 10.2 or later&lt;br /&gt;
** MS SQL 2005 or later&lt;br /&gt;
* Any standards-supporting browser from the past few years, for example:&lt;br /&gt;
** Firefox 3 or later &lt;br /&gt;
** Safari 3 or later &lt;br /&gt;
** Google Chrome 4 or later&lt;br /&gt;
** Opera 9 or later&lt;br /&gt;
** MS Internet Explorer 7 or later (Even [http://googleenterprise.blogspot.com/2010/01/modern-browsers-for-modern-applications.html Google don&#039;t support IE6 any more])&lt;br /&gt;
** etc&lt;br /&gt;
&lt;br /&gt;
==Upgrading==&lt;br /&gt;
&lt;br /&gt;
* When upgrading to Moodle 2.0, you must have Moodle 1.9 or later.  if you are using an earlier version of Moodle (eg 1.8.x) then you need to upgrade to Moodle 1.9.x first.&lt;br /&gt;
* We advise that you test the upgrade first on a COPY of your production site, to make sure it works as you expect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==For developers: API changes==&lt;br /&gt;
&lt;br /&gt;
See [[Development:Migrating_contrib_code_to_2.0]]&lt;br /&gt;
&lt;br /&gt;
* [[Development:DB_layer_2.0_migration_docs|Database layer changes]] - you will need to update your code.&lt;br /&gt;
* [[Development:Using_the_file_API|File handling changes]] - you will need to update your code.&lt;br /&gt;
* [[Development:Migrating your code code to the 2.0 rendering API|Rendering layer changes]] - should be mostly backwards compatible, but you are advised to upgrade your code.&lt;br /&gt;
* Require capability used to do an automatic require_login. It no longer does so. All pages must explicitly call require_login if they need it. MDL-19882&lt;br /&gt;
* [[Development:Moodle_2.0_question_type_API_changes|Changes to the question type API]]&lt;br /&gt;
* MNet has been refactored and tidied up - related third party code needs to be checked&lt;br /&gt;
* Changes and improvements to the [[Development:Local_customisation|Local customisation system]].&lt;br /&gt;
* Javascript &lt;br /&gt;
* YUI&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;==See also==&lt;br /&gt;
*[[Moodle 1.9 release notes]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Release notes]]&lt;br /&gt;
[[Category:Moodle 2.0]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Notes de mise à jour de Moodle 2.0]]&lt;br /&gt;
[[es:Notas de Moodle 2.0]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=PHP_settings_by_Moodle_version&amp;diff=73997</id>
		<title>PHP settings by Moodle version</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=PHP_settings_by_Moodle_version&amp;diff=73997"/>
		<updated>2010-07-18T07:31:28Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* PHP Settings */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
and &lt;br /&gt;
{{Review}}{{Template:Installing Moodle}}&lt;br /&gt;
==PHP Version==&lt;br /&gt;
Moodle has different PHP requirements for different versions:&lt;br /&gt;
* Moodle 2.0 will require PHP 5.2.8 or later.&lt;br /&gt;
* Moodle 1.6 to 1.9 requires PHP 4.3.0 or later&lt;br /&gt;
* Moodle 1.0 to 1.5 requires PHP 4.1.0 or later &lt;br /&gt;
==PHP Settings==&lt;br /&gt;
Check these settings in your php.ini or .htaccess file (if you&#039;re using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. &lt;br /&gt;
* &#039;&#039;register_globals&#039;&#039; &#039;&#039;&#039;MUST&#039;&#039;&#039; be OFF&lt;br /&gt;
* &#039;&#039;safe_mode&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;memory_limit&#039;&#039; should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.&lt;br /&gt;
* &#039;&#039;session.save_handler&#039;&#039; needs to be set to FILES.&lt;br /&gt;
* &#039;&#039;magic_quotes_gpc&#039;&#039; should be OFF. (It will be an installation pre-requisite for this to be turned off from 2.0 onwards.)&lt;br /&gt;
* &#039;&#039;magic_quotes_runtime&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;file_uploads&#039;&#039; needs to be ON.&lt;br /&gt;
* &#039;&#039;session.auto_start&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;session.bug_compat_warn&#039;&#039; needs to be OFF.&lt;br /&gt;
* For file uploads in Moodle 2 on a Windows install, the temp folder must be defined and writeable by your webserver user&lt;br /&gt;
&lt;br /&gt;
==PHP Extensions and libraries==&lt;br /&gt;
* The mbstring extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
* The iconv extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
* [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make. (Freetype support is available as part of the GD extension for the 5.x versions of PHP)&lt;br /&gt;
* The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.&lt;br /&gt;
* The pgsql extension is required if you are using the PostgreSQL database.&lt;br /&gt;
* The zlib extension is required for zip/unzip functionality.&lt;br /&gt;
* The pdo and pdo_sqlite extensions are required for the (experimental) SQLite 3 database support.&lt;br /&gt;
* The tokenizer extension is recommended for Moodle 1.8 or later (enabled by default as of [http://www.php.net/manual/en/tokenizer.installation.php PHP 4.3.0]).&lt;br /&gt;
* The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
* The xmlrpc extension is required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
* The ctype extension is recommended for Moodle 1.8 or later (enabled by default as of [http://www.php.net/manual/en/ctype.installation.php PHP 4.2.0]). &lt;br /&gt;
* Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
==Database Support==&lt;br /&gt;
A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is &#039;&#039;the&#039;&#039; choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment.&lt;br /&gt;
* For Moodle 1.5, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). &lt;br /&gt;
* For Moodle 1.6, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).&lt;br /&gt;
* For Moodle 1.7, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
* For Moodle 1.8 or later, MySQL (version 4.1.12 or later), PostgreSQL (8.0 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting &amp;quot;strict mode&amp;quot; must be OFF (set to &amp;quot;&amp;quot; or &amp;quot;MYSQL40&amp;quot;) in the MySQL configuration file. &lt;br /&gt;
: PostgreSQL Notes: PostgreSQL 7.4 is recommended for earlier Moodle versions, since Moodle 1.8 only PostgreSQL 8.0 and above are supported.&lt;br /&gt;
* For showcases or low to medium-sized installations, Moodle 2.0 also includes (experimental) support for SQLite 3 database. This setup requires no database server, as the database file is stored in a local directory on the server.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Installing Moodle]]&lt;br /&gt;
*[[Performance]]&lt;br /&gt;
&lt;br /&gt;
[[de:PHP-Versionen für Moodle]]&lt;br /&gt;
[[ru:Настройки PHP для разных версий Moodle]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Moodle_2.0_release_notes&amp;diff=73996</id>
		<title>Moodle 2.0 release notes</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Moodle_2.0_release_notes&amp;diff=73996"/>
		<updated>2010-07-18T07:24:29Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* System requirements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Work_in_progress}}&lt;br /&gt;
&lt;br /&gt;
Release date: &#039;&#039;&#039;July 20, 2010&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Before the final release we will have a series of rapidly improving Preview releases.  These are to allow a wider range of developers and contributors to test the code on copies of their production servers, help us tweak the interface and performance, and work on translations, modules and other third-party code (most of which will have to be rewritten significantly).&lt;br /&gt;
&lt;br /&gt;
* [[Moodle 2.0 Preview 1 release notes]] - May 4, 2010&lt;br /&gt;
* [[Moodle 2.0 Preview 2 release notes]] - May 17, 2010&lt;br /&gt;
* [[Moodle 2.0 Preview 3 release notes]] - May 31, 2010&lt;br /&gt;
* [[Moodle 2.0 Preview 4 release notes]] - June 30, 2010&lt;br /&gt;
* [[Moodle 2.0 Preview 5 release notes]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Moodle 2.0 contains a lot of large new features, some completely rewritten features, and hundreds of bug fixes.  For full details (more than you probably want!), see [http://tracker.moodle.org/browse/MDL/fixforversion/10122 the full list of fixed issues in 2.0].&lt;br /&gt;
&lt;br /&gt;
This page is a summary of the major things to look for (links and screenshots will be added over time).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Major new features==&lt;br /&gt;
&lt;br /&gt;
===Community hubs===&lt;br /&gt;
&lt;br /&gt;
* Anybody can set up a Community Hub, which is a directory of courses for public use or for private communities.  The code is implemented as separate GPL plugin for Moodle.&lt;br /&gt;
* Sites can register to any Community Hub (instead of just moodle.org)&lt;br /&gt;
* Teachers on registered sites can publish their full courses to Community Hubs, for download&lt;br /&gt;
* Teachers on registered sites can also advertise their courses on Community Hubs, for people to join&lt;br /&gt;
* Teachers on any site can search all public Community Hubs and download courses as templates for their own courses&lt;br /&gt;
* Users on any Moodle site can also search Community Hubs for courses (and communities of practice) to participate in.  Initially we are encouraging &#039;&#039;&#039;&#039;communities of teaching practice&#039;&#039;&#039;&#039; but any sort of course can be listed.&lt;br /&gt;
&lt;br /&gt;
===Repository support===&lt;br /&gt;
&lt;br /&gt;
* Moodle now supports integration with external repositories of content, making it really simple to bring documents and media into Moodle via an AJAX interface that looks like a standard &#039;&#039;&#039;Open&#039;&#039;&#039; dialogue in desktop applications.&lt;br /&gt;
* Initial plugins in 2.0 include: Alfresco, Amazon S3, Box.net, File system on Server, Flickr, Google Docs, Mahara, MERLOT, Picasa, Recent Files, Remote Moodle sites, WebDAV servers, Wikimedia, Youtube.  These are simple to develop, so many more are expected.&lt;br /&gt;
* You can also import files from your desktop or by specifying a URL.&lt;br /&gt;
&lt;br /&gt;
===Portfolio support===&lt;br /&gt;
&lt;br /&gt;
* Modules can now export their data to external systems, particularly useful for portfolios where snapshots of forums, assignments and other things in Moodle are useful to record in a journal or a portfolio of evidence&lt;br /&gt;
* Different formats are supported (currently LEAP2A, HTML, Images and Text, but others like PDF can be added)&lt;br /&gt;
* Initial plugins in 2.0 include: Box.net, Flickr, Google Docs, &#039;&#039;&#039;Mahara&#039;&#039;&#039; and Picasa.&lt;br /&gt;
&lt;br /&gt;
===Completion===&lt;br /&gt;
&lt;br /&gt;
* Teachers can now specify conditions that define when any &#039;&#039;&#039;activity&#039;&#039;&#039; is seen as completed by a student.  For example, when a certain number of posts have been made, or a grade has been reached, or a choice has been made.  &lt;br /&gt;
* Teachers can now specify conditions that define with any &#039;&#039;&#039;course&#039;&#039;&#039; is seen as completed by a student.  Conditions include activity completion, but could also be by grade, date or a number of other criteria.&lt;br /&gt;
* Teachers and students can see reports that show the progress of any user within a course, or through a series of courses.&lt;br /&gt;
&lt;br /&gt;
===Conditional activities===&lt;br /&gt;
&lt;br /&gt;
* Access to activities can be restricted based on certain criteria, such as dates, grade obtained, or the completion of another activity.  &lt;br /&gt;
* These can be chained together to enable progressive disclosure of the course content, if that is desired. &lt;br /&gt;
&lt;br /&gt;
===Cohorts===&lt;br /&gt;
* Also known as &amp;quot;Site-wide groups&amp;quot;, these are site-wide collections of users that can be enrolled into courses in one action, either manually or synchronised automatically&lt;br /&gt;
&lt;br /&gt;
===Web services support===&lt;br /&gt;
* Support for standards-based web services across the entire Moodle code base, allowing the admin to expose particular functions of Moodle for use by:&lt;br /&gt;
** Administrative systems such as HR or SIS applications&lt;br /&gt;
** Mobile clients&lt;br /&gt;
* Framework contains a very high-level of security with a detailed token system and complete control over the range of functions exposed&lt;br /&gt;
* All defined functions are automatically available via:&lt;br /&gt;
** SOAP&lt;br /&gt;
** XML-RPC&lt;br /&gt;
** REST&lt;br /&gt;
** AMF (Flash)&lt;br /&gt;
&lt;br /&gt;
===IMS Common Cartridge===&lt;br /&gt;
* Moodle can now import courses in IMS Common Cartridge format (commonly used by publishers)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===New blocks===&lt;br /&gt;
* Comments block - like a shoutbox, allows comments to be added to any page. Great for student feedback.&lt;br /&gt;
* Private files block - allows easy access to one&#039;s private file repository in Moodle (with quota support)&lt;br /&gt;
* Community block - keeps track of external courses one is interested in &lt;br /&gt;
* Completion block - reports on the completion status of your courses&lt;br /&gt;
&lt;br /&gt;
==Major improvements to existing core features==&lt;br /&gt;
&lt;br /&gt;
===Backup and restore===&lt;br /&gt;
&lt;br /&gt;
* Completely rewritten Backup/Restore framework, no longer bound by memory (can work with &#039;&#039;&#039;any size course&#039;&#039;&#039;).&lt;br /&gt;
* Completely new backup format.&lt;br /&gt;
* Improved interface.&lt;br /&gt;
* Backup can be made of whole courses, but also specific sections or activities.&lt;br /&gt;
&lt;br /&gt;
===Blocks===&lt;br /&gt;
* Blocks are now consistently implemented on every page in Moodle&lt;br /&gt;
* No longer any limit to the block regions (in addition to left and right, put them at the top, center or bottom of pages)&lt;br /&gt;
* Any block can be made sticky (appears in all the contexts below, eg throughout a course).&lt;br /&gt;
* Blocks can be &amp;quot;docked&amp;quot; on the side of the screen (if the theme supports it)&lt;br /&gt;
&lt;br /&gt;
===Blog===&lt;br /&gt;
* Support for comments on each blog entry&lt;br /&gt;
* Removal of group-level and course-level blogs (these are converted into forums on upgrade)&lt;br /&gt;
* Support for external blog feeds (synchronised to Moodle blog)&lt;br /&gt;
&lt;br /&gt;
===Comments===&lt;br /&gt;
* User comments (Glossaries, Databases, Blogs, etc) are now all consistently handled  and displayed throughout Moodle, using AJAX if available&lt;br /&gt;
* User activity reports will include all the comments made by that user&lt;br /&gt;
&lt;br /&gt;
===Enrolment plugins===&lt;br /&gt;
* Major improvements in the handling of guests and guest accounts &lt;br /&gt;
* Support for multiple forms of enrolment at the same time &lt;br /&gt;
* More detailed control over enrolment in courses &lt;br /&gt;
&lt;br /&gt;
===File handling===&lt;br /&gt;
&lt;br /&gt;
* Full support for Unicode file names on all operating systems.&lt;br /&gt;
* Metadata about each file (author, date, license, etc) and what the file is used for are stored in the database.&lt;br /&gt;
* Duplicate files (for example, a large video file use in two different courses) are only stored once, saving disk space.&lt;br /&gt;
* Files are no longer just &amp;quot;uploaded to the course&amp;quot;.  Files are connected to the particular bit of Moodle content that uses them. (For example, a file may belong to a file resource, a forum post or a wiki page). Access to these files is then controlled by the same rules as as that bit of Moodle, increasing security.&lt;br /&gt;
&lt;br /&gt;
===Gradebook===&lt;br /&gt;
* Details coming soon&lt;br /&gt;
&lt;br /&gt;
===HTML editor===&lt;br /&gt;
* New editor based on TinyMCE&lt;br /&gt;
* Works on more browsers&lt;br /&gt;
* Resizable editing area&lt;br /&gt;
* Cleaner XHTML output &lt;br /&gt;
* Full integration with configured external repositories to import and embed media into text&lt;br /&gt;
&lt;br /&gt;
===Messaging===&lt;br /&gt;
* All email sent by Moodle is now treated as a message&lt;br /&gt;
* A message overview panel allows users to control how messages are sent to them&lt;br /&gt;
* Initial message output plugins in Moodle 2.0 include: Email, Jabber and Popups&lt;br /&gt;
&lt;br /&gt;
===My Moodle page===&lt;br /&gt;
* More customisable My Moodle page with new blocks for showing relevant information &lt;br /&gt;
* Admin can design (and optionally force) site-wide layouts for My Moodle&lt;br /&gt;
* My Moodle page given more prominence as the main &amp;quot;home page&amp;quot; for users&lt;br /&gt;
&lt;br /&gt;
===Navigation===&lt;br /&gt;
* Standard &amp;quot;Navigation&amp;quot; block on every page showing contextual links, while allowing you to jump elsewhere quickly&lt;br /&gt;
* Standard &amp;quot;Settings&amp;quot; blocks on every page shows contextual settings as well as settings for anything else you have permissions for&lt;br /&gt;
&lt;br /&gt;
===Ratings===&lt;br /&gt;
* User ratings (Glossaries, Databases, Forums, etc) are now all consistently handled and displayed throughout Moodle, using AJAX if available&lt;br /&gt;
* Aggregation of using ratings into activity grades is now standardised in all activities&lt;br /&gt;
&lt;br /&gt;
===Roles and permissions===&lt;br /&gt;
* Improved and simplified AJAX interfaces for defining and assigning roles&lt;br /&gt;
* Improved and simplified interfaces for tweaking permissions in any given context &lt;br /&gt;
* New &amp;quot;Archetypes&amp;quot; concept replacing the &amp;quot;Legacy roles&amp;quot; concept.&lt;br /&gt;
* New archetype &amp;quot;manager&amp;quot; to define the role of most people with system-wide editing rights, separate from &amp;quot;admin&amp;quot; role.&lt;br /&gt;
&lt;br /&gt;
===RSS feeds===&lt;br /&gt;
* All RSS feeds are now secured using a random per-user token in the URL&lt;br /&gt;
* Tokens can be updated by the user at any time (if they suspect a feed URL has been compromised)&lt;br /&gt;
* RSS feeds are now more accurate (eg they support forums with separate groups), and are generated efficiently whenever required&lt;br /&gt;
&lt;br /&gt;
===Themes===&lt;br /&gt;
* Many new themes in the core distribution&lt;br /&gt;
* All HTML and JS ouput is now far more efficient (server-side caching) and consistent (tableless layout, new CSS, YUI Framework)&lt;br /&gt;
* Themes can change the HTML of the page if they wish&lt;br /&gt;
* Core support for custom menus in all themes (for example at the top of the page)&lt;br /&gt;
&lt;br /&gt;
===Translation system===&lt;br /&gt;
* [http://lang.moodle.org/ New web portal] to make it easer for groups to collaborate on translating Moodle, and to keep their translations up-to-date.&lt;br /&gt;
* More efficient [[Development:Languages/AMOS|storage format for language strings]] should slightly improve performance.&lt;br /&gt;
&lt;br /&gt;
===User profile pages===&lt;br /&gt;
* Site-wide user profile page can be customised by users with blocks, news, feeds and so on&lt;br /&gt;
* Course-specific user profile pages show course blocks and standard profile information, plus information for teachers of that course&lt;br /&gt;
&lt;br /&gt;
==Major improvements to activity modules==&lt;br /&gt;
&lt;br /&gt;
===Lesson===&lt;br /&gt;
* Refactored internal code &lt;br /&gt;
* Forms are now standard Moodle forms&lt;br /&gt;
&lt;br /&gt;
===Quiz module and question bank===&lt;br /&gt;
&lt;br /&gt;
* [[Development:quiz_navigation|Quiz navigation improvements for students]]&lt;br /&gt;
* [[Development:Flagging_questions_during_a_quiz_attempt|Flagging questions during a quiz attempt]] &lt;br /&gt;
* [[Development:Quiz_report_enhancements|Quiz report enhancements]] - Major improvements to the quiz reports, especially regrading and item analysis&lt;br /&gt;
* [[Development:Quiz_UI_redesign|Quiz editing interface improvements]]&lt;br /&gt;
* Different settings (open/close date, number of attempts, password, time limit) for each group or student (MDL-16478)&lt;br /&gt;
* [[Development:Administration page for question types|Administration page for question types]]&lt;br /&gt;
* [[Development:Moodle 2.0 question bank improvements|Question tagging and improved searching in the question bank]]&lt;br /&gt;
* MDL-8648 Essay questions can now be randomised by random questions&lt;br /&gt;
&lt;br /&gt;
===Resource===&lt;br /&gt;
* All the resource types have been refactored into real modules, and cleaned up&lt;br /&gt;
** File - for displaying a file, possibly with supporting files (like a HTML mini-site)&lt;br /&gt;
** Folder - for displaying a collection of documents &lt;br /&gt;
** URL - for displaying a page with a given URL&lt;br /&gt;
** Page - for a single page, edited online using the HTML editor&lt;br /&gt;
** IMS - for showing a regular IMS content package&lt;br /&gt;
* Better XHTML-compliant support for frames, iframes and embedding in all these modules&lt;br /&gt;
&lt;br /&gt;
===SCORM===&lt;br /&gt;
&lt;br /&gt;
* New [[SCORM module]] settings - display attempt status, display course structure, force completed, force new attempt, lock after final attempt - allowing the behaviour dictated to the SCORM object by the authoring package to be changed MDL-11501 &lt;br /&gt;
* New reporting interface including sortable/collapsible table with group select box and ability to download in Excel, ODS and text format MDL-21555&lt;br /&gt;
&lt;br /&gt;
===Wiki===&lt;br /&gt;
* Completely re-written from scratch, based on NWIki from UPC&lt;br /&gt;
* Support for Mediawiki-style syntax, as well as Creole &lt;br /&gt;
* Interface improvements &lt;br /&gt;
&lt;br /&gt;
===Workshop===&lt;br /&gt;
&lt;br /&gt;
* Completely rewritten from scratch &lt;br /&gt;
* Vastly improved interface for managing stages and users&lt;br /&gt;
&lt;br /&gt;
==System requirements==&lt;br /&gt;
&lt;br /&gt;
Since Moodle 2.0 is such a major release, we are allowing ourselves some increases in the requirements.&lt;br /&gt;
&lt;br /&gt;
* PHP must be 5.2.8 or later (it was released 08-Dec-2008)&lt;br /&gt;
* Databases should be one of the following:&lt;br /&gt;
** MySQL 5.0.25 or later  (InnoDB storage engine highly recommended)&lt;br /&gt;
** PostgreSQL 8.3 or later&lt;br /&gt;
** Oracle 10.2 or later&lt;br /&gt;
** MS SQL 2005 or later&lt;br /&gt;
* Any standards-supporting browser from the past few years, for example:&lt;br /&gt;
** Firefox 3 or later &lt;br /&gt;
** Safari 3 or later &lt;br /&gt;
** Google Chrome 4 or later&lt;br /&gt;
** Opera 9 or later&lt;br /&gt;
** MS Internet Explorer 7 or later (Even [http://googleenterprise.blogspot.com/2010/01/modern-browsers-for-modern-applications.html Google don&#039;t support IE6 any more])&lt;br /&gt;
** In Windows installations at least, the webserver user must have write access to the Temp folder defined in your php set up for file uploads to function&lt;br /&gt;
** etc&lt;br /&gt;
&lt;br /&gt;
==Upgrading==&lt;br /&gt;
&lt;br /&gt;
* When upgrading to Moodle 2.0, you must have Moodle 1.9 or later.  if you are using an earlier version of Moodle (eg 1.8.x) then you need to upgrade to Moodle 1.9.x first.&lt;br /&gt;
* We advise that you test the upgrade first on a COPY of your production site, to make sure it works as you expect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==For developers: API changes==&lt;br /&gt;
&lt;br /&gt;
See [[Development:Migrating_contrib_code_to_2.0]]&lt;br /&gt;
&lt;br /&gt;
* [[Development:DB_layer_2.0_migration_docs|Database layer changes]] - you will need to update your code.&lt;br /&gt;
* [[Development:Using_the_file_API|File handling changes]] - you will need to update your code.&lt;br /&gt;
* [[Development:Migrating your code code to the 2.0 rendering API|Rendering layer changes]] - should be mostly backwards compatible, but you are advised to upgrade your code.&lt;br /&gt;
* Require capability used to do an automatic require_login. It no longer does so. All pages must explicitly call require_login if they need it. MDL-19882&lt;br /&gt;
* [[Development:Moodle_2.0_question_type_API_changes|Changes to the question type API]]&lt;br /&gt;
* MNet has been refactored and tidied up - related third party code needs to be checked&lt;br /&gt;
* Changes and improvements to the [[Development:Local_customisation|Local customisation system]].&lt;br /&gt;
* Javascript &lt;br /&gt;
* YUI&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;==See also==&lt;br /&gt;
*[[Moodle 1.9 release notes]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Release notes]]&lt;br /&gt;
[[Category:Moodle 2.0]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Notes de mise à jour de Moodle 2.0]]&lt;br /&gt;
[[es:Notas de Moodle 2.0]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=error/moodle/errortoomanylogins&amp;diff=73927</id>
		<title>error/moodle/errortoomanylogins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=error/moodle/errortoomanylogins&amp;diff=73927"/>
		<updated>2010-07-14T18:19:36Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It says &amp;quot;Error too many logins&amp;quot;. This means either you or someone else tried to login with your details and failed.&lt;br /&gt;
&lt;br /&gt;
Try again in 10-15 minutes or ask an administrator for help.&lt;br /&gt;
&lt;br /&gt;
[[fr:error/moodle/errortoomanylogins]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=User:Jon_Witts/Biography&amp;diff=73841</id>
		<title>User:Jon Witts/Biography</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=User:Jon_Witts/Biography&amp;diff=73841"/>
		<updated>2010-07-11T19:14:24Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Education History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Jon Witts Biography=&lt;br /&gt;
==Work History==&lt;br /&gt;
*2007 - Current : Director of ICT at South Hunsley School&lt;br /&gt;
*2004 - 2007 : Learning Resource Centre Manager at South Hunsley School&lt;br /&gt;
*2003 - 2004 : Ran my own Cyber Café and IT consultancy Company&lt;br /&gt;
*2002 - 2003 : Audio Visual and IT Technician at Hull Time Based Arts&lt;br /&gt;
*2001 - 2002 : Administrative Assistant at Hull Time Based Arts&lt;br /&gt;
&lt;br /&gt;
==Education History==&lt;br /&gt;
&lt;br /&gt;
*2005 - 2008 : Foundation Degree, Design and Development of e-Learning, University of Huddersfield&lt;br /&gt;
*1997 - 2000 : BA Hons , Fine Art - Time Based Media, University of Humberside and Lincolnshire&lt;br /&gt;
*1996 - 1997 : BTEC, Fine Art Foundation, Barnfield College&lt;br /&gt;
*1994 - 1996 : A Level, Art, Maths and Physics, Luton Sixth Form College&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=User:Jon_Witts/Biography&amp;diff=73840</id>
		<title>User:Jon Witts/Biography</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=User:Jon_Witts/Biography&amp;diff=73840"/>
		<updated>2010-07-11T19:10:47Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Work History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Jon Witts Biography=&lt;br /&gt;
==Work History==&lt;br /&gt;
*2007 - Current : Director of ICT at South Hunsley School&lt;br /&gt;
*2004 - 2007 : Learning Resource Centre Manager at South Hunsley School&lt;br /&gt;
*2003 - 2004 : Ran my own Cyber Café and IT consultancy Company&lt;br /&gt;
*2002 - 2003 : Audio Visual and IT Technician at Hull Time Based Arts&lt;br /&gt;
*2001 - 2002 : Administrative Assistant at Hull Time Based Arts&lt;br /&gt;
&lt;br /&gt;
==Education History==&lt;br /&gt;
&lt;br /&gt;
1997 - 2000 : BA Hons Fine Art at University of Humberside and Lincolnshire specialising in Time Based Media&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=User:Jon_Witts&amp;diff=73839</id>
		<title>User:Jon Witts</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=User:Jon_Witts&amp;diff=73839"/>
		<updated>2010-07-11T19:09:19Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I work at a secondary school in the East Riding of Yorkshire in England as the Director of ICT.&lt;br /&gt;
&lt;br /&gt;
I like to help out in the forums if I can...&lt;br /&gt;
&lt;br /&gt;
I have just started to try and focus more of Moodle time on the docs. Hopefully some of the edits I make and pages I create will help those starting out with Moodle.&lt;br /&gt;
&lt;br /&gt;
Here are links to my User area sub-pages... &lt;br /&gt;
&lt;br /&gt;
*[[user:Jon_Witts/Biography]]&lt;br /&gt;
*[[User:Jon_Witts/moodle_via_apt_get]]&lt;br /&gt;
*[[User:Jon_Witts/file-upload-v2]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=User:Jon_Witts&amp;diff=73475</id>
		<title>User:Jon Witts</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=User:Jon_Witts&amp;diff=73475"/>
		<updated>2010-06-30T20:08:14Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I work at a secondary school in the East Riding of Yorkshire in England as the Director of ICT.&lt;br /&gt;
&lt;br /&gt;
I like to help out in the forums if I can...&lt;br /&gt;
&lt;br /&gt;
I have just started to try and focus more of Moodle time on the docs. Hopefully some of the edits I make and pages I create will help those starting out with Moodle.&lt;br /&gt;
&lt;br /&gt;
[[user:Jon_Witts/Biography]]&lt;br /&gt;
&lt;br /&gt;
[[User:Jon_Witts/moodle_via_apt_get]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=User:Jon_Witts&amp;diff=73474</id>
		<title>User:Jon Witts</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=User:Jon_Witts&amp;diff=73474"/>
		<updated>2010-06-30T20:08:01Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I work at a secondary school in the East Riding of Yorkshire in England as the Director of ICT.&lt;br /&gt;
&lt;br /&gt;
I like to help out in the forums if I can...&lt;br /&gt;
&lt;br /&gt;
I have just started to try and focus more of Moodle time on the docs. Hopefully some of the edits I make and pages I create will help those starting out with Moodle.&lt;br /&gt;
&lt;br /&gt;
[[user:Jon_Witts/Biography]]&lt;br /&gt;
[[User:Jon_Witts/moodle_via_apt_get]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=User:Jon_Witts/moodle_via_apt_get&amp;diff=73473</id>
		<title>User:Jon Witts/moodle via apt get</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=User:Jon_Witts/moodle_via_apt_get&amp;diff=73473"/>
		<updated>2010-06-30T20:07:24Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: New page: =Install Moodle via apt get package on Ubuntu and Debian= So this to try and tidy up the apt-get install docs which are in a bit of disarray at the moment...  *Ubuntu and Debain both use t...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Install Moodle via apt get package on Ubuntu and Debian=&lt;br /&gt;
So this to try and tidy up the apt-get install docs which are in a bit of disarray at the moment...&lt;br /&gt;
&lt;br /&gt;
*Ubuntu and Debain both use the same package manager that uses deb packages to allow you to install software and know that all of the dependencies will be automatically met and resolved for you by the operating system. Packages are also updated automatically as new versions are maintained in the package repositories.&lt;br /&gt;
*There is a deb package for Moodle maintained by ???. Whilst it will not be the latest version of Moodle; it should make installation on a Debian or Ubuntu server very easy.&lt;br /&gt;
==Install your server==&lt;br /&gt;
Download either the latest Ubuntu server disc (10.04 as this written) or the latest Debian disc (5.0 as writing) and follow the documentation on either site to install an basic server install with no packages installed (also known as the base system).&lt;br /&gt;
==Update your server==&lt;br /&gt;
Once your server is installed, make sure it is fully up to date.&lt;br /&gt;
 sudo apt-get update&lt;br /&gt;
 sudo apt-get dist-upgrade&lt;br /&gt;
At this point it is probably wise to reboot your server&lt;br /&gt;
==Set Static IP==&lt;br /&gt;
You are probably going to want your server running on a static IP.&lt;br /&gt;
*Edit /etc/networking/interfaces to set your static IP&lt;br /&gt;
*Restart your networking: sudo /etc/init.d/networking restart&lt;br /&gt;
*Check it works; can you ping another server? www.google.com for example?&lt;br /&gt;
==Install Moodle==&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Wiki_settings&amp;diff=73419</id>
		<title>Wiki settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Wiki_settings&amp;diff=73419"/>
		<updated>2010-06-28T17:44:48Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: Undo revision 73407 by Sadak0304025 (Talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Wiki}}&lt;br /&gt;
The standard Moodle wiki has different settings.   Please note that these instructions are located in docs.moodle.org&#039;s documentation wiki.&lt;br /&gt;
&lt;br /&gt;
==Adding a wiki==&lt;br /&gt;
[[Image:Wiki settting screen.JPG|thumb|Adding a new wiki in Moodle 1.7]]&lt;br /&gt;
To create a wiki:&lt;br /&gt;
#Click the &amp;quot;Turn editing on&amp;quot; button.&lt;br /&gt;
#Select Wiki from the &amp;quot;Add an activity&amp;quot; dropdown menu in the course section where you would like to add the wiki.&lt;br /&gt;
#On the Adding a new wiki page, give the wiki a descriptive name.&lt;br /&gt;
#In the summary field, describe the purpose of the wiki and what you expect students to contribute.&lt;br /&gt;
#Select the wiki type - groups, student or teacher. The wiki type interacts with the groups setting for your course, resulting in 9 options, as shown in the [http://moodle.org/help.php?module=wiki&amp;amp;file=wikitype.html&amp;amp;lang=en type help pop-up].&lt;br /&gt;
#Click the &amp;quot;Show Advanced&amp;quot; button (in Moodle 1.8 onwards) to display additional options (see below).&lt;br /&gt;
#Select the common module settings (see below).&lt;br /&gt;
#Click the &amp;quot;Save changes&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
== Adding and editing wiki pages ==&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve created a wiki, it&#039;s available for editing. [[Viewing a wiki]] contains information on adding and editing wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Advanced options==&lt;br /&gt;
&lt;br /&gt;
===Print wiki name of every page===&lt;br /&gt;
If you select this option, the top of each page will have the name of the wiki.&lt;br /&gt;
&lt;br /&gt;
===HTML mode===&lt;br /&gt;
There are three options: No HTML, safe HTML or HTML only. &#039;No HTML&#039; will display all HTML tags as tags. &#039;Safe HTML&#039; will allow certain tags to be displayed. &#039;HTML only&#039; enables the [[HTML editor]] to display in [[Common_acronyms#N_to_Z|WYSIWYG]].&lt;br /&gt;
&lt;br /&gt;
===Allow binary files===&lt;br /&gt;
Binary files are graphics, audio, video, and other non-text resources. If you want students to be able to add files as attachments, set this to Yes. &lt;br /&gt;
&lt;br /&gt;
===Wiki auto-linking options===&lt;br /&gt;
A new page can be created in the wiki by typing a word using CamelCase i.e. with a capital letter at the beginning and a capital letter somewhere else in the word. It&#039;s called CamelCase because the two capital letters resemble a two-humped camel. CamelCase combines all the words for the link into one word. Each word in the link is capitalized. When a word is added in CamelCase, the wiki automatically creates a new page and makes the word a link. You can disable this feature if you wish, so that typing a word enclosed in square brackets is the only way of creating a new page.&lt;br /&gt;
&lt;br /&gt;
CamelCase is not always desirable, as some text is written in it. For example a file name might be MyFile_2007_Feb.jpg.&lt;br /&gt;
&lt;br /&gt;
===Student admin options===&lt;br /&gt;
When students can edit a page, you can allow them certain administrative privileges in the wiki (see [[Wiki administration]]).&lt;br /&gt;
&lt;br /&gt;
===Page name===&lt;br /&gt;
You may wish to seed the wiki with a page name for the first page.&lt;br /&gt;
&lt;br /&gt;
===Choose an initial page===&lt;br /&gt;
This can be the first wiki page that is created, or a way to switch to a different front page. Other files in the same directory as the first wiki page you select will also become part of the initial wiki - see:&lt;br /&gt;
http://moodle.org/mod/forum/discuss.php?d=8501&lt;br /&gt;
&lt;br /&gt;
==Common module settings==&lt;br /&gt;
The [[Common module settings]] section appears in many modules besides wiki.  It sets [[Groups]] interactions levels and the ID number.&lt;br /&gt;
&lt;br /&gt;
==Creating a Wiki with Groups (Step by Step Instructions)==&lt;br /&gt;
Create a Wiki with Groups Tutorial (Subject: American War Battles)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Create Groups&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. On the course page select “Groups” under “Administration”.&lt;br /&gt;
&lt;br /&gt;
2. On the groups page click the “Create group” button.&lt;br /&gt;
&lt;br /&gt;
3. Fill in the following info for this group:&lt;br /&gt;
&lt;br /&gt;
     - Group name: civil&lt;br /&gt;
     - Group description: Civil War Battles Group Project&lt;br /&gt;
     - Enrollment key: civil&lt;br /&gt;
&lt;br /&gt;
4. Click the &amp;quot;Save changes&amp;quot; button. &lt;br /&gt;
&lt;br /&gt;
5. On the group page, make sure the &#039;&#039;civil&#039;&#039; group is selected and click the “Add/remove users” button.&lt;br /&gt;
&lt;br /&gt;
6. Add users to the &#039;&#039;civil&#039;&#039; group (move them from the right box to the left box by clicking the “Add” button). When finished, click the “Back to groups” button.&lt;br /&gt;
&lt;br /&gt;
7. Repeat steps 2-6 to create three additional groups (vietnam, world1, world2). Make sure to make the appropriate changes to Group name, Group description, and Enrollment key.&lt;br /&gt;
&lt;br /&gt;
8. Return to course page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Create the Wiki&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Turn editing on.&lt;br /&gt;
&lt;br /&gt;
2. Click the drop-down menu for “Add an Activity”. Select “Wiki”.&lt;br /&gt;
&lt;br /&gt;
3. On the “Add a Wiki” page fill in the following:&lt;br /&gt;
&lt;br /&gt;
     - Name: American War Battles&lt;br /&gt;
     - Summary: American War Battles Group Project&lt;br /&gt;
     - Type: Groups&lt;br /&gt;
     - Print Wiki name on every page: Yes (optional)&lt;br /&gt;
     - HTML mode: HTML only&lt;br /&gt;
     - Allow Binary Files: Yes&lt;br /&gt;
     - Disable CamelCase linking: Yes&lt;br /&gt;
     - Group Mode: Visible Groups&lt;br /&gt;
     - Visible: Show&lt;br /&gt;
     - Grade Category: Uncategorized&lt;br /&gt;
&lt;br /&gt;
4. Click the “Save and return to course” button.&lt;br /&gt;
&lt;br /&gt;
5. On the course page click on the Wiki link.&lt;br /&gt;
&lt;br /&gt;
6. This is where you need to stop for a moment and get yourself oriented. Most likely you are on the “Groups wiki for civil” page in the “American War Battles&amp;quot; Wiki since this was the first group you created (this will be shown on the top-left of the page).  If so, you are ready to begin created your Civil War page Wiki. If you would prefer to start with another war, simply click the drop-down on the top-right of the page labeled “Other Wikis:” and choose the wiki group you want to start with.&lt;br /&gt;
 &lt;br /&gt;
7. On the lower portion of the page you should see a bold header: &#039;&#039;&#039;Edit this page ‘American War Battles’&#039;&#039;&#039;. (I chose to start with the civil group so I will begin editing for the Civil War). Type the following: &lt;br /&gt;
&lt;br /&gt;
[The Battle of Shiloh]&lt;br /&gt;
&lt;br /&gt;
[The Battle of Gettysburg]&lt;br /&gt;
&lt;br /&gt;
[The Battle of New Orleans]&lt;br /&gt;
&lt;br /&gt;
8. Click the “Save” button&lt;br /&gt;
&lt;br /&gt;
9. On the top-right of the page choose the world1 group from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
10. Repeat steps 7-8 but replace the battles with battles from World War I.&lt;br /&gt;
&lt;br /&gt;
11. On the top-right of the page choose the world2 group from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
12. Repeat steps 7-8 but replace the battles with battles from World War II.&lt;br /&gt;
&lt;br /&gt;
13. On the top-right of the page choose the vietnam group from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
14. Repeat steps 7-8 but replace the battles with battles from the Vietnam War.&lt;br /&gt;
&lt;br /&gt;
15. Now the Wiki is ready for students to work in!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Student Access to Wiki&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Go to course page.&lt;br /&gt;
&lt;br /&gt;
2. Click on the “American War Battles” Wiki.&lt;br /&gt;
&lt;br /&gt;
3. Select your group from the top-right drop-down menu.&lt;br /&gt;
&lt;br /&gt;
4. Use the Enrollment key that was given to you by your teacher.&lt;br /&gt;
&lt;br /&gt;
5. Click the ? to the right of the battle you want to begin working on.&lt;br /&gt;
&lt;br /&gt;
6. Get to work!&lt;br /&gt;
&lt;br /&gt;
7. Note: Students will only be able to edit within their group. Because the Group Mode was set to “Visible Groups” by the teacher, students will be able to view every groups work but will only be able to edit their own.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Wiki permissions]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Wiki]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Ajouter/modifier un wiki]]&lt;br /&gt;
[[de:Wiki anlegen]]&lt;br /&gt;
[[ja:Wikiを追加/編集する]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr_public&amp;diff=73191</id>
		<title>admin/repository/flickr public</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr_public&amp;diff=73191"/>
		<updated>2010-06-18T10:17:21Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: Redirecting to Flickr Public Configuration&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Flickr_Public_Configuration]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Flickr_public_repository&amp;diff=73189</id>
		<title>Flickr public repository</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Flickr_public_repository&amp;diff=73189"/>
		<updated>2010-06-18T10:16:40Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 2.0}}&lt;br /&gt;
&lt;br /&gt;
Location: &#039;&#039;Administration &amp;gt; Modules &amp;gt; Repositories &amp;gt; Manage repositories&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This page lets you configure access to a Flickr Public repository. It will allow a user to search Flickr and copy files from there into any of the Moodle file interfaces.&lt;br /&gt;
&lt;br /&gt;
To set this repository up you need to set the following field:&lt;br /&gt;
*API Key&lt;br /&gt;
&lt;br /&gt;
==Setting up a Flickr API==&lt;br /&gt;
To get your API Key you need to create an App inside your Flickr account. Visit [http://www.flickr.com/services/api/keys/ this link] to start creating your own API Key.&lt;br /&gt;
#Click the &amp;quot;Get Another Key&amp;quot; button to start creating your App. [[Image:get-another-key.png]]&lt;br /&gt;
#Choose &amp;quot;Apply for a Non-commercial Key&amp;quot;&lt;br /&gt;
#Enter a title and brief description for the App (i.e. Moodle to Flickr Access - App to allow Moodle to access Flickr through it&#039;s repository API)&lt;br /&gt;
#Tick the two boxes to show your agreement to Flickr&#039;s terms of use and then click submit.&lt;br /&gt;
#You will now have the key for the new app. Copy and paste this into the field in your Moodle Flickr public configuration page.&lt;br /&gt;
#Click save on the Moodle Flickr public configuration page.&lt;br /&gt;
#Click &amp;quot;Save Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You should now have a working Flickr public repository. Try adding a file from Flickr as a resource in Moodle to test it!&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Manage_repositories|Manage Repositories]]&lt;br /&gt;
*[[Flickr_configuration|Flickr Repository]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[eu:Flickr_publikoaren_ezarpenak]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr&amp;diff=73188</id>
		<title>admin/repository/flickr</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr&amp;diff=73188"/>
		<updated>2010-06-18T10:13:28Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: Redirecting to Flickr configuration&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Flickr_configuration]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Flickr_repository&amp;diff=73187</id>
		<title>Flickr repository</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Flickr_repository&amp;diff=73187"/>
		<updated>2010-06-18T10:12:50Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 2.0}}&lt;br /&gt;
&lt;br /&gt;
Location: &#039;&#039;Administration &amp;gt; Modules &amp;gt; Repositories &amp;gt; Manage repositories&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This page lets you configure access to a Flickr repository. It will allow a user to log into their Flickr account and copy files from their account into any of the Moodle file interfaces.&lt;br /&gt;
&lt;br /&gt;
To set this repository up you need to set the following two fields:&lt;br /&gt;
*API Key&lt;br /&gt;
*Secret&lt;br /&gt;
&lt;br /&gt;
==Setting up a Flickr API==&lt;br /&gt;
To get your API Key and Secret you need to create an App inside your Flickr account. Visit [http://www.flickr.com/services/api/keys/ this link] to start creating your own API Key and secret.&lt;br /&gt;
#Click the &amp;quot;Get Another Key&amp;quot; button to start creating your App. [[Image:get-another-key.png]]&lt;br /&gt;
#Choose &amp;quot;Apply for a Non-commercial Key&amp;quot;&lt;br /&gt;
#Enter a title and brief description for the App (i.e. Moodle to Flickr Access - App to allow Moodle to access Flickr through it&#039;s repository API)&lt;br /&gt;
#Tick the two boxes to show your agreement to Flickr&#039;s terms of use and then click submit.&lt;br /&gt;
#You will now have the key and secret for the new app. Copy and paste these into the fields in your Moodle Flickr configuration page.&lt;br /&gt;
#Click save on the Moodle Flickr configuration page.&lt;br /&gt;
#Revisit the settings of your Flickr repository in Moodle and copy the callback URL from that page.&lt;br /&gt;
#Revisit your Flickr App page and click on the &amp;quot;Edit Auth Flow for this App&amp;quot; link&lt;br /&gt;
#Paste the URL from your Moodle page into the Callback URL field on your Flickr App&lt;br /&gt;
#Click &amp;quot;Save Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You should now have a working Flickr repository. Try adding a file from your Flickr account as a resource in Moodle to test it!&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Manage_repositories|Manage Repositories]]&lt;br /&gt;
*[[Flickr_Public_Configuration|Flickr Public Repository]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;br /&gt;
&lt;br /&gt;
[[eu:Flickr ezarpenak]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Flickr_repository&amp;diff=73185</id>
		<title>Flickr repository</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Flickr_repository&amp;diff=73185"/>
		<updated>2010-06-18T10:11:50Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 2.0}}&lt;br /&gt;
&lt;br /&gt;
Location: &#039;&#039;Administration &amp;gt; Modules &amp;gt; Repositories &amp;gt; Manage repositories&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=Flickr Configuration=&lt;br /&gt;
This page lets you configure access to a Flickr repository. It will allow a user to log into their Flickr account and copy files from their account into any of the Moodle file interfaces.&lt;br /&gt;
&lt;br /&gt;
To set this repository up you need to set the following two fields:&lt;br /&gt;
*API Key&lt;br /&gt;
*Secret&lt;br /&gt;
&lt;br /&gt;
==Setting up a Flickr API==&lt;br /&gt;
To get your API Key and Secret you need to create an App inside your Flickr account. Visit [http://www.flickr.com/services/api/keys/ this link] to start creating your own API Key and secret.&lt;br /&gt;
#Click the &amp;quot;Get Another Key&amp;quot; button to start creating your App. [[Image:get-another-key.png]]&lt;br /&gt;
#Choose &amp;quot;Apply for a Non-commercial Key&amp;quot;&lt;br /&gt;
#Enter a title and brief description for the App (i.e. Moodle to Flickr Access - App to allow Moodle to access Flickr through it&#039;s repository API)&lt;br /&gt;
#Tick the two boxes to show your agreement to Flickr&#039;s terms of use and then click submit.&lt;br /&gt;
#You will now have the key and secret for the new app. Copy and paste these into the fields in your Moodle Flickr configuration page.&lt;br /&gt;
#Click save on the Moodle Flickr configuration page.&lt;br /&gt;
#Revisit the settings of your Flickr repository in Moodle and copy the callback URL from that page.&lt;br /&gt;
#Revisit your Flickr App page and click on the &amp;quot;Edit Auth Flow for this App&amp;quot; link&lt;br /&gt;
#Paste the URL from your Moodle page into the Callback URL field on your Flickr App&lt;br /&gt;
#Click &amp;quot;Save Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You should now have a working Flickr repository. Try adding a file from your Flickr account as a resource in Moodle to test it!&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Manage_repositories|Manage Repositories]]&lt;br /&gt;
*[[Flickr_Public_Configuration|Flickr Public Repository]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;br /&gt;
&lt;br /&gt;
[[eu:Flickr ezarpenak]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Moodle_documentation_FAQ&amp;diff=73174</id>
		<title>Moodle documentation FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Moodle_documentation_FAQ&amp;diff=73174"/>
		<updated>2010-06-18T07:50:32Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* How can I download a copy of MoodleDocs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Who can edit MoodleDocs? ==&lt;br /&gt;
&lt;br /&gt;
Anyone who is a registered user on Moodle.org can login to MoodleDocs and become a contributor.  A reminder, this is not a school site and people from all over the world use this documentation site every day.&lt;br /&gt;
&lt;br /&gt;
== How can I download a copy of MoodleDocs ==&lt;br /&gt;
Offline Moodle Docs Packages have been compiled by Antonio Vicent &amp;amp; Eloy Lafuente.  You can find them at [http://wimski.org/docs/ wimski.org]. These packages allow you to browse Moodle documentation offline. Certain links, such as &amp;quot;edit&amp;quot;, &amp;quot;history&amp;quot; or &amp;quot;recent changes&amp;quot; still lead to the online version of the documentation. Packages are built using HTTrack website copier plus custom shell scripts for packaging the contents.&lt;br /&gt;
&lt;br /&gt;
It is also possible to export individual pages using Toolbox&amp;gt;Special pages&amp;gt;Page Tools&amp;gt;[[Special:Export]].&lt;br /&gt;
&lt;br /&gt;
== See also: ==&lt;br /&gt;
* [[MoodleDocs:Guidelines for contributors]]&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Performance_recommendations&amp;diff=72937</id>
		<title>Performance recommendations</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Performance_recommendations&amp;diff=72937"/>
		<updated>2010-06-13T13:56:26Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: Undo revision 72935 by Pmarsden (Talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Server &amp;gt; Performance&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Moodle can be made to perform very well, at small usage levels or scaling up to many thousands of users. The factors involved in performance are basically the same as for any PHP-based database-driven system. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Obtain a baseline benchmark==&lt;br /&gt;
&lt;br /&gt;
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you&#039;ll be able to determine if the change you have made has had any real impact.&lt;br /&gt;
&lt;br /&gt;
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;optimization order preference&#039;&#039;&#039; is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).&lt;br /&gt;
&lt;br /&gt;
==Scalability==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;s design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)&lt;br /&gt;
&lt;br /&gt;
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.&lt;br /&gt;
&lt;br /&gt;
It is possible to load-balance a Moodle installation, for example by using more than one webserver. The separate webservers should query the same database and refer to the same filestore area, but otherwise the separation of the application layers is complete enough to make this kind of clustering feasible. Similarly, the database could be a cluster of servers (e.g. a MySQL cluster), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;: &lt;br /&gt;
*[[Server cluster]]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=4801 Scalability] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing] forum dicsussion.&lt;br /&gt;
&lt;br /&gt;
==Hardware configuration==&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The fastest and most effective change that you can make to improve performance is to &#039;&#039;&#039;increase the amount of RAM on your web server&#039;&#039;&#039; - get as much as possible (eg 4GB). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.&lt;br /&gt;
* Better performance is gained by obtaining the best &#039;&#039;&#039;processor capability&#039;&#039;&#039; you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].&lt;br /&gt;
* If you can afford them, use &#039;&#039;&#039;SCSI hard disks&#039;&#039;&#039; instead of SATA drives. SATA drives will increase your system&#039;s CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).&lt;br /&gt;
* Purchase hard disks with a &#039;&#039;&#039;low seek time&#039;&#039;&#039;. This will improve the overall speed of your system, especially when accessing Moodle&#039;s reports.&lt;br /&gt;
* Size your &#039;&#039;&#039;swap file&#039;&#039;&#039; correctly. The general advice is to set it to 4 x physical RAM.&lt;br /&gt;
* Use a &#039;&#039;&#039;RAID disk system&#039;&#039;&#039;. Although there are many different RAID configurations you can create, the following generally works best:&lt;br /&gt;
** install a hardware RAID controller (if you can)&lt;br /&gt;
** the operating system and swap drive on one set of disks configured as RAID-1.&lt;br /&gt;
** Moodle, Web server and Database server on another set of disks configured as RAID-5.&lt;br /&gt;
* Use &#039;&#039;&#039;gigabit ethernet&#039;&#039;&#039; for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.&lt;br /&gt;
* Check the settings on your &#039;&#039;&#039;network card&#039;&#039;&#039;. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.&lt;br /&gt;
*  Read this [http://moodle.org/mod/forum/discuss.php?d=68579 Case Study] on a server stress test with 300 users.  &lt;br /&gt;
* See this [http://elearning.sgu.ac.jp/doc/PT/ accompanying report] on network traffic and server loads.&lt;br /&gt;
* See the [[Moodle.org configuration]]&lt;br /&gt;
* Also see this SFSU presentation at Educause (using VMWare): [http://www.educause.edu/Resources/AnOpenSourceLMSforaMissionCrit/162843]&lt;br /&gt;
&lt;br /&gt;
==Operating System==&lt;br /&gt;
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server &#039;&#039;&#039;operating system&#039;&#039;&#039;. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you&#039;re used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].&lt;br /&gt;
* Check your own OS and &#039;&#039;&#039;vendor specific instructions&#039;&#039;&#039; for optimization steps.&lt;br /&gt;
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. &lt;br /&gt;
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the async and noatime options.&lt;br /&gt;
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File &amp;amp; Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.&lt;br /&gt;
&lt;br /&gt;
==Web server performance==&lt;br /&gt;
&lt;br /&gt;
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo&#039;s [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules] ([http://video.yahoo.com/video/play?vid=1040890 video]) for fast loading websites.&lt;br /&gt;
&lt;br /&gt;
===PHP performance===&lt;br /&gt;
* You are strongly recommended to use a &#039;&#039;&#039;PHP accelerator&#039;&#039;&#039; to ease CPU load, such as [http://pecl.php.net/apc APC], [http://www.php-accelerator.co.uk/ PHPA], [http://trac.lighttpd.net/xcache/ Xcache] or [http://eaccelerator.net/ eAccelerator]. (Take care to choose a PHP accelerator that is known to work well with your version of PHP and note that Turck MMCache is [http://turckmmcache.exeprod.com/TheManifestoEnglish no longer maintained] and can cause failures with PHP 5). &lt;br /&gt;
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you&#039;ll lose the cache contents when there is a power failure or the server is rebooted.&lt;br /&gt;
* Performance of PHP is better when installed as an &#039;&#039;&#039;Apache/IIS ISAPI module&#039;&#039;&#039; (rather than a CGI).&lt;br /&gt;
* Also check the &#039;&#039;&#039;memory_limit&#039;&#039;&#039; in php.ini, reduce it to 16M for Moodle version earlier than 1.7 ([http://moodle.org/mod/forum/discuss.php?d=39656 See this forum discussion]). For Moodle 1.7 or later, it is recommended that the value of memory_limit should be 40M. As of [http://www.php.net/ChangeLog-5.php PHP 5.2.1] the default value for the memory_limit directive is 128M.&lt;br /&gt;
* Also see [[PHP_settings_by_Moodle_version]]&lt;br /&gt;
&lt;br /&gt;
===Install HowTo===&lt;br /&gt;
* [http://2bits.com/articles/installing-php-apc-gnulinux-centos-5.html APC on CentOS 5.x (linux)]&lt;br /&gt;
* [http://fplanque.com/dev/linux/install-apc-php-cache-debian-lenny APC on Debian (linux)]&lt;br /&gt;
* [http://www.linuxtuts.net/211-installing-memcached-php5-memcache-module-debian-apache2.html MemCache module on Debian (Apache2 and PHP5) ]&lt;br /&gt;
&lt;br /&gt;
===Apache performance===&lt;br /&gt;
* If you are using Apache on a Windows server, use the build from [http://www.apachelounge.com Apache Lounge] which is reported to have [http://moodle.org/mod/forum/discuss.php?d=93358 performance and stability improvements] compared to the official Apache download. Note that this is an unofficial build, so may not keep up with official releases.&lt;br /&gt;
* Set the &#039;&#039;&#039;MaxClients&#039;&#039;&#039; directive correctly. Use this formula to help (which uses 80% of available memory to leave room for spare):&lt;br /&gt;
 MaxClients = Total available memory * 80% / Max memory usage of apache process&lt;br /&gt;
:Memory usage of apache process is usually 10MB, so a general rule of thumb is to divide your available memory in megabytes by 10 to get the value of MaxClients. To find the max memory usage of apache processes read the value from the shell command:&lt;br /&gt;
 #ps -ylC httpd --sort:rss&lt;br /&gt;
&lt;br /&gt;
:If you need to increase the value of &#039;&#039;&#039;MaxClients&#039;&#039;&#039; beyond 256, you will also need to set the &#039;&#039;&#039;ServerLimit&#039;&#039;&#039; directive. &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: Do not be tempted to set the value of MaxClients higher than your available memory as your server will consume more RAM than available and start to swap to disk. &lt;br /&gt;
* Consider reducing the &#039;&#039;&#039;number of modules&#039;&#039;&#039; that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. &lt;br /&gt;
* Use the &#039;&#039;&#039;latest version of Apache&#039;&#039;&#039; - Apache 2 has an improved memory model which reduces memory usage further.&lt;br /&gt;
* For Unix/Linux systems, consider lowering &#039;&#039;&#039;MaxRequestsPerChild&#039;&#039;&#039; in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). &lt;br /&gt;
* For a heavily loaded server, consider setting &#039;&#039;&#039;KeepAlive Off&#039;&#039;&#039; (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the &#039;&#039;&#039;KeepAliveTimeout&#039;&#039;&#039; to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.&lt;br /&gt;
* A warning about the previous performance tip.  Microsoft Internet Explorer has a (little) known bug that causes seriously problems with SSL-enabled Apache websites.   The issue is that if a web server&#039;s KeepAlive timeout is set to less than 60 seconds (say to the default of 15 seconds), MSIE can get confused about whether a keep-alive connection is available or not.  As a result, any browser POST requests (which always use a keep-alive if available) will fail to reach the server.  This is easily reproduced with postings to the Moodle forums.   Using MSIE, connect to an ssl-enabled Moodle site.  Write a quick forum post, and submit it when the form has been displayed for between 15 seconds and 60 seconds.   You will see a browser error message, and your post content will be lost.  In some cases, doing this will even crash the Windows TCP stack on the client machine. &#039;&#039;&#039; So, if your site is SSL-enabled, and you use Apache, you should set the KeepAliveTimeout to at least 60 seconds&#039;&#039;&#039;.&lt;br /&gt;
* As an alternative to using KeepAlive Off, consider setting-up a &#039;&#039;&#039;Reverse Proxy server&#039;&#039;&#039; infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.&lt;br /&gt;
* If you do not use a .htaccess file, set the &#039;&#039;&#039;AllowOverride&#039;&#039;&#039; variable to AllowOverride None to prevent .htaccess lookups.&lt;br /&gt;
* Set &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; correctly so as to avoid content-negotiation. Here&#039;s an example from a production server:&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
* Unless you are doing development work on the server, set &#039;&#039;&#039;ExtendedStatus Off&#039;&#039;&#039; and disable mod_info as well as mod_status.&lt;br /&gt;
* Leave &#039;&#039;&#039;HostnameLookups Off&#039;&#039;&#039; (as default) to reduce DNS latency.&lt;br /&gt;
* Consider reducing the value of &#039;&#039;&#039;TimeOut&#039;&#039;&#039; to between 30 to 60 (seconds). &lt;br /&gt;
* For the &#039;&#039;&#039;Options directive&#039;&#039;&#039;, avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use&lt;br /&gt;
 Options -Indexes FollowSymLinks&lt;br /&gt;
*&#039;&#039;&#039;Caching&#039;&#039;&#039; - Apache can be told to make pages load a lot faster by specifying that the browser should cache some various page elements such as images and reuse them from local memory rather than ask for them again every time a page is requested. How to do this varies slightly between OSes but there are two basic steps:&lt;br /&gt;
&lt;br /&gt;
# Install and enable mod_expires - refer to documentation or man pages&lt;br /&gt;
# Add this code to the virtual server config file within the &amp;lt;directory&amp;gt; section for the root directory (or within the .htaccess file if AllowOverrides is On):&lt;br /&gt;
 &amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
  ExpiresActive On&lt;br /&gt;
  ExpiresDefault &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType text/html &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType image/gif &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/jpeg &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/png &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/css &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType application/x-javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/xml &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
 &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It&#039;s possible to gain a several hundred percent decrease in load times this way. Adjust the cache times according to how often your images etc change.&lt;br /&gt;
&lt;br /&gt;
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]&lt;br /&gt;
&lt;br /&gt;
===IIS performance===&lt;br /&gt;
All alter this location in the registry:&lt;br /&gt;
 HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\&lt;br /&gt;
* The equivalent to KeepAliveTimeout is &#039;&#039;&#039;ListenBackLog&#039;&#039;&#039; (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.&lt;br /&gt;
*Change the &#039;&#039;&#039;MemCacheSize&#039;&#039;&#039; value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).&lt;br /&gt;
*Change the &#039;&#039;&#039;MaxCachedFileSize&#039;&#039;&#039; to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).&lt;br /&gt;
*Create a new DWORD called &#039;&#039;&#039;ObjectCacheTTL&#039;&#039;&#039; to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).&lt;br /&gt;
&lt;br /&gt;
===Lighttpd performance===&lt;br /&gt;
You can increase server performance by using a &#039;&#039;&#039;light-weight&#039;&#039;&#039; webserver like [http://www.lighttpd.net/ lighttpd] (or [http://nginx.net/ nginx])in combination with PHP in FastCGI-mode. Lighttpd was originally created as a proof-of-concept[http://www.lighttpd.net/story] to address the [http://www.kegel.com/c10k.html C10k problem] and while primarily recommended for memory-limited servers, its design origins and asynchronous-IO model make it a suitable and proven[http://blog.lighttpd.net/articles/2006/12/28/lighttpd-powers-5-alexa-top-250-sites] alternative HTTP server for high-load websites and web apps, including Moodle. See the [[lighttpd | MoodleDocs Lighttpd page]] for additional information, configuration example and links.&lt;br /&gt;
&lt;br /&gt;
Alternatively, both [http://www.lighttpd.net/ lighttpd] and [http://nginx.net/ nginx] are capable of performing as a load-balancer and/or reverse-proxy to alleviate load on back-end servers[http://www.linuxjournal.com/article/10108], providing benefit without requiring an actual software change on existing servers.&lt;br /&gt;
&lt;br /&gt;
==Database performance==&lt;br /&gt;
&lt;br /&gt;
Moodle contains a script which will display some key database performance statistics from the [http://phplens.com/lens/adodb/docs-perf.htm ADOdb performance monitor]. Run the script in your browser as in the following example:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/dbperformance.php&lt;br /&gt;
&lt;br /&gt;
Use the data displayed as a guide to tune and improve the performance of your database server.&lt;br /&gt;
&lt;br /&gt;
===MySQL performance===&lt;br /&gt;
&lt;br /&gt;
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands&lt;br /&gt;
 SHOW STATUS;&lt;br /&gt;
 SHOW VARIABLES; &lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.&lt;br /&gt;
&lt;br /&gt;
If you are able, the [http://mysqltuner.com/ MySQLTuner] tool can be run against your MySQL server and will calculate appropriate configuration values for most of the following settings based on your current load, status and variables automatically.&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;query cache&#039;&#039;&#039; with &lt;br /&gt;
 query_cache_type = 1. &lt;br /&gt;
For most Moodle installs, set the following:&lt;br /&gt;
 query_cache_size = 36M &lt;br /&gt;
 query_cache_min_res_unit = 2K. &lt;br /&gt;
The query cache will improve performance if you are doing few updates on the database. &lt;br /&gt;
* Set the &#039;&#039;&#039;table cache&#039;&#039;&#039; correctly. For Moodle 1.6 set &lt;br /&gt;
 table_cache = 256 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min), and for Moodle 1.7 set &lt;br /&gt;
 table_cache = 512 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables &amp;gt; 3 * table_cache(table_open_cache in MySQL &amp;gt; 5.1.2) then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.&lt;br /&gt;
 mysql&amp;gt;SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema=&#039;yourmoodledbname&#039;;&lt;br /&gt;
* Set the &#039;&#039;&#039;thread cache&#039;&#039;&#039; correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:&lt;br /&gt;
 thread cache utilization (%) = (threads_created / connections) * 100&lt;br /&gt;
* The &#039;&#039;&#039;key buffer&#039;&#039;&#039; can improve the access speed to Moodle&#039;s SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:&lt;br /&gt;
 key_read / key_read_requests &amp;lt; 0.01&lt;br /&gt;
 key_write / key_write_requests &amp;lt;= 1.0&lt;br /&gt;
* Set the &#039;&#039;&#039;maximum number of connections&#039;&#039;&#039; so that your users will not see a &amp;quot;Too many connections&amp;quot; message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.&lt;br /&gt;
* Manage &#039;&#039;&#039;high burst activity&#039;&#039;&#039;. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.&lt;br /&gt;
* &#039;&#039;&#039;Optimize your tables weekly and after upgrading Moodle&#039;&#039;&#039;. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:&lt;br /&gt;
 mysql&amp;gt;CHECK TABLE mdl_tablename;&lt;br /&gt;
 mysql&amp;gt;OPTIMIZE TABLE mdl_tablename;&lt;br /&gt;
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).&lt;br /&gt;
* &#039;&#039;&#039;Maintain the key distribution&#039;&#039;&#039;. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.&lt;br /&gt;
 #myisamchk -a -S /pathtomysql/data/moodledir/*.MYI&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.&lt;br /&gt;
* Reduce the number of &#039;&#039;&#039;temporary tables saved to disk&#039;&#039;&#039;. Check this with the created_tmp_disk_tables value. If this is relatively large (&amp;gt;5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.&lt;br /&gt;
* Moodle&#039;s tables are in the MyISAM format, so &#039;&#039;&#039;turn InnoDB off&#039;&#039;&#039; if you feel there is no performance gain. Add &amp;lt;code&amp;gt;skip-innodb&amp;lt;/code&amp;gt; to your &amp;lt;code&amp;gt;my.cnf&amp;lt;/code&amp;gt; file. If you must use InnoDB, you&#039;ll have to convert all of Moodle&#039;s tables. To do this run the innodb script:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/innodb.php&lt;br /&gt;
&lt;br /&gt;
:See also [http://moodle.org/mod/forum/discuss.php?d=12961 this forum discussion] which looks at the MyISAM vs InnoDB options.&lt;br /&gt;
&lt;br /&gt;
===PostgreSQL performance===&lt;br /&gt;
&lt;br /&gt;
There are some good papers around on tuning PostgreSQL, and Moodle&#039;s case does not seem to be different to the general case.&lt;br /&gt;
&lt;br /&gt;
The first thing to recognise is that if you really need to worry about tuning you should be using a separate machine for the database server. If you are not using a separate machine then the answers to many performance questions are substantially muddied by the memory requirements of the rest of the application.&lt;br /&gt;
&lt;br /&gt;
You should probably &#039;&#039;&#039;enable autovacuum&#039;&#039;&#039;, unless you know what you are doing. Many e-learning sites have predictable periods of low use, so disabling autovacuum and running a specific vacuum at those times can be a good option. Or perhaps leave autovacuum running but do a full vacuum weekly in a quiet period.&lt;br /&gt;
&lt;br /&gt;
Set &#039;&#039;&#039;shared_buffers&#039;&#039;&#039; to something reasonable. For versions up to 8.1 my testing has shown that peak performance is almost always obtained with buffers &amp;lt; 10000, so if you are using such a version, and have more than 512M of RAM just set shared_buffers to 10,000 (8MB).&lt;br /&gt;
&lt;br /&gt;
The buffer management had a big overhaul in 8.2 and &amp;quot;reasonable&amp;quot; is now a much larger number. I have not conducted performance tests with 8.2, but the recommendations from others are generally that you should now scale shared_buffers much more with memory and may continue to reap benefits even up to values like 100,000 (80MB). Consider using 1-2% of system RAM.&lt;br /&gt;
&lt;br /&gt;
PostgreSQL will also assume that the operating system is caching its files, so setting &#039;&#039;&#039;effective_cache_size&#039;&#039;&#039; to a reasonable value is also a good idea. A reasonable value will usually be (total RAM - RAM in use by programs). If you are running Linux and leave the system running for a day or two you can look at &#039;free&#039; and under the &#039;cached&#039; column you will see what it currently is. Consider taking that number (which is kB) and dividing it by 10 (i.e. allow 20% for other programs cache needs and then divide by 8 to get pages). If you are not using a dedicated database server you will need to decrease that value to account for usage by other programs.&lt;br /&gt;
&lt;br /&gt;
Some other useful parameters that can have positive effects, and the values I would typically set them to on a machine with 4G RAM, are:&lt;br /&gt;
&lt;br /&gt;
 work_mem = 10240&lt;br /&gt;
&lt;br /&gt;
That&#039;s 10M of RAM to use instead of on-disk sorting and so forth. That can give a big speed increase, but it is per connection and 200 connections * 10M is 2G, so it can theoretically chew up a lot of RAM.&lt;br /&gt;
&lt;br /&gt;
 maintenance_work_mem = 163840&lt;br /&gt;
&lt;br /&gt;
That&#039;s 160M of RAM which will be used by (e.g.) VACUUM, index rebuild, cluster and so forth. This should only be used periodically and should be freed when those processes exit, so I believe it is well worth while.&lt;br /&gt;
&lt;br /&gt;
 max_fsm_pages = 100000&lt;br /&gt;
 max_fsm_relations = 5000&lt;br /&gt;
&lt;br /&gt;
These are used to hold the free-space map, and if they are too small you will see performance degradation after the database has been operating for some time. The exact numbers to set can be gleaned from the output of VACUUM VERBOSE, which prints the required FSM pages at the end of it&#039;s run. The 5x increase seems to be useful for a Moodle installation, from experience.&lt;br /&gt;
&lt;br /&gt;
 wal_buffers = 64&lt;br /&gt;
&lt;br /&gt;
These buffers are used for the write-ahead log, and there have been a number of reports on the PostgreSQL mailing lists of improvement from this level of increase.&lt;br /&gt;
&lt;br /&gt;
This is a little out of date now (version 8.0) but still worth a read: http://www.powerpostgresql.com/Docs&lt;br /&gt;
&lt;br /&gt;
And there is lots of good stuff here as well: http://www.varlena.com/GeneralBits/Tidbits/index.php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Based on Andrew McMillan&#039;s post at [http://moodle.org/mod/forum/discuss.php?d=68558 Tuning PostgreSQL] forum thread.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Other database performance links===&lt;br /&gt;
* Consider using a &#039;&#039;&#039;distributed cacheing system&#039;&#039;&#039; like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.&lt;br /&gt;
* Consider using PostgreSQL. See [[Arguments in favour of PostgreSQL]] and [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).&lt;br /&gt;
* [[Increasing the database connection lifetime | Try increasing the database connection lifetime]]&lt;br /&gt;
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)&lt;br /&gt;
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.&lt;br /&gt;
&lt;br /&gt;
==Moodle Admin settings==&lt;br /&gt;
* In Moodle 1.7 or later, set the &#039;&#039;&#039;Cache type&#039;&#039;&#039; for your server: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Cache type. There are several options available. &lt;br /&gt;
:*If you do not have eaccelerator or mmemcached installed, choose &amp;quot;internal&amp;quot; (which makes use of the record/internal cache - see the next bullet point). &lt;br /&gt;
:* If you have a single server and have compiled &#039;&#039;&#039;eaccelerator with shared memory support&#039;&#039;&#039;, set the cache type to the eaccelerator option. &lt;br /&gt;
:* If you have a &#039;&#039;&#039;separate memcached server&#039;&#039;&#039;, set the cache type to memcached and enter a csv list of server IP addresses.&lt;br /&gt;
* Enable the &#039;&#039;&#039;record/internal cache&#039;&#039;&#039;: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Record cache = True. Set the maximum amount of memory allocated to the cache in the Int Cache Max box. This will enable a primary cache for database records, without using any database engine cache, e.g. MySQL/PostgreSQL cache. See [http://tracker.moodle.org/browse/MDL-7196 this Tracker entry] for a full discussion.&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting (Admin/Server/Cleanup).&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
* Don&#039;t use database sessions unless you really need them. On-disc sessions tend to be much faster.&lt;br /&gt;
&lt;br /&gt;
==Performance of different Moodle modules==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;s activity modules, filters, and other plugins can be activated/deactivated. If necessary, you may wish to deactivate some features (such as chat) if not required - but this isn&#039;t necessary. Some notes on the performance of certain modules:&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;Chat&#039;&#039;&#039; module is [http://moodle.org/mod/forum/discuss.php?d=37979&amp;amp;parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use &#039;&#039;Streamed&#039;&#039; updates, or, if you&#039;re using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the &#039;&#039;chat_old_ping&#039;&#039; and &#039;&#039;chat_refresh&#039;&#039; parameters as these can have greatest impact on server load.&lt;br /&gt;
* The &#039;&#039;&#039;Quiz&#039;&#039;&#039; module is known to stretch database performance. Try to optimise your database server by tuning. See [http://moodle.org/mod/forum/discuss.php?d=25616&amp;amp;parent=120770 for a brief report on performance for 55 students simultaneously using quizzes]&lt;br /&gt;
** See this Case Study for an extensive server stress test with 300 quiz users.[http://moodle.org/mod/forum/discuss.php?d=68579]  And this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]&lt;br /&gt;
* The Moodle &#039;&#039;&#039;Cron&#039;&#039;&#039; task is triggered by calling the script &#039;&#039;cron.php&#039;&#039;. If this is called over HTTP (e.g. using wget or curl) it can take a large amount of memory on large installations. If it is called by directly invoking the php command (e.g. &#039;&#039;php -f /path/to/moodle/directory/admin/cron.php&#039;&#039;) efficiency can be much improved.&lt;br /&gt;
* The &#039;&#039;&#039;Recent activities&#039;&#039;&#039; block is consuming to much resources if you have huge number of records &amp;lt;code&amp;gt;mdl_log&amp;lt;/code&amp;gt;. this is being tested to optimize the SQL query.&lt;br /&gt;
&lt;br /&gt;
==Moodle Image Optimization==&lt;br /&gt;
&lt;br /&gt;
The base images delivered in the original Moodle distribution package provide unoptimized graphics, most of which can benefit from lossless recompression utilizing [http://optipng.sourceforge.net/ optipng] for PNGs, [http://www.lcdf.org/gifsicle/ gifsicle] for GIFs and [http://www.kokkonen.net/tjko/projects.html jpegoptim] for JPGs.  Optimized graphics transfer faster and provide a faster perceived response for clients[http://www.websiteoptimization.com/speed/12/], especially distance learners.  The following example will recursively optimize (without any loss of quality) all the graphics and image files included in a base Moodle installation directory on a server with the above commands installed and available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname *.png -exec optipng -o7 {} \;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname *.gif -exec gifsicle -O2 -b {} \;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname *.jpg -exec jpegoptim -p {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both [http://optipng.sourceforge.net/ optipng] and [http://www.lcdf.org/gifsicle/ gifsicle] are provided in the base repositories of most newer Linux distributions; [http://www.kokkonen.net/tjko/projects.html jpegoptim] must be downloaded and installed manually.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Performance FAQ]]&lt;br /&gt;
*Using Moodle: [http://moodle.org/mod/forum/view.php?f=94 Hardware and Performance] forum&lt;br /&gt;
&lt;br /&gt;
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=102978#p461624 Moodle performance in a pil by Martin Langhoff]&lt;br /&gt;
[[Category:Performance]]&lt;br /&gt;
&lt;br /&gt;
[[es:Rendimiento]]&lt;br /&gt;
[[fr:Performance]]&lt;br /&gt;
[[ja:パフォーマンス]]&lt;br /&gt;
[[pl:Wydajnosc]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Themes_FAQ&amp;diff=72754</id>
		<title>Themes FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Themes_FAQ&amp;diff=72754"/>
		<updated>2010-06-08T19:23:42Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* How can I see theme changes when using the Windows Complete Installer package */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Themes}}&lt;br /&gt;
==How do I install a new theme?==&lt;br /&gt;
&lt;br /&gt;
# Unzip the .zip file to an empty local directory.&lt;br /&gt;
# Upload folder to your web server to the /moodle/theme/[Theme Name]. (Replace [Theme Name] with the name of the theme you have downloaded.) Ensure the new theme folder and its contents are readable by the webserver.  Change Read and Write permissions (CHMOD) for the files and folder to 755 - Owner read/write/execute, Group read/execute, Everyone read/execute.  Incorrect permissions may prevent display of the newly installed theme.&lt;br /&gt;
# Choose your new theme from within Moodle via &#039;&#039;Administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme selector&#039;&#039;  (or &#039;&#039;Administration &amp;gt; Configuration &amp;gt; Themes&#039;&#039; in versions of Moodle prior to 1.7).&lt;br /&gt;
&lt;br /&gt;
==How do I create a custom theme?==&lt;br /&gt;
&lt;br /&gt;
See [[Creating a custom theme]] and/or [[Make your own theme]].&lt;br /&gt;
&lt;br /&gt;
==Can I assign a specific theme to a course?==&lt;br /&gt;
&lt;br /&gt;
Yes. In the course settings, use the &amp;quot;Force theme&amp;quot; dropdown box.&lt;br /&gt;
&lt;br /&gt;
== Where shall I put my custom CSS code? ==&lt;br /&gt;
&lt;br /&gt;
Instead of modifying the theme&#039;s CSS files you better put your own code in a separate CSS file and make your theme aware of that file by modifying its config.php file (be sure add your own CSS file as the last one in the list so that you will override all prior settings). See this posting for [http://moodle.org/mod/forum/discuss.php?d=128599#p564055 detailed instructions]. &lt;br /&gt;
&lt;br /&gt;
See also the instructions on creating your own theme mentioned above.&lt;br /&gt;
&lt;br /&gt;
==How can I get the New Moodle2 theme for my site?==&lt;br /&gt;
Not til Moodle 2.x comes out and it will be a &amp;quot;sort of&amp;quot;.  The new look (refered to as &amp;quot;Moodle2&amp;quot;) for Moodle.org was made public just before the close of 2008. The Moodle2 look has various things hard coded into its fabric.   The good news is that many pieces of the look are available.&lt;br /&gt;
&lt;br /&gt;
==Will I lose my courses, language files, logo, etc. if I switch my theme?==&lt;br /&gt;
Switching themes only changes the appearance of your site, not the content within it. The logo is a part of the theme and will be lost when you switch.&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to [[Creating_a_custom_theme#Adding_a_Logo|add a logo]] to a theme.&lt;br /&gt;
&lt;br /&gt;
== Are there tools which help me creating and editing themes? ==&lt;br /&gt;
&lt;br /&gt;
=== Clear Cache Button ===&lt;br /&gt;
This useful Firefox add-on let&#039;s you add a button to your tool bar for easily clearing your cache while working on your theme: https://addons.mozilla.org/de/firefox/addon/1801&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;Please note that the following tools are only for development. They only change the way &#039;&#039;you&#039;&#039; see your Moodle site, not the Moodle site itself. Any changes you make using these tools will not be visible to anyone else who uses your site. For this you will have to make those changes permanent by changing your theme&#039;s CSS files for example.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Firebug ===&lt;br /&gt;
The single most useful tool is the [[Development:Firebug|Firebug]] add-on for the [[Firefox]] web browser. Firebug integrates with Firefox to put a wealth of development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page... And there are additional add-ons for making Firebug an even more powerful tool.&lt;br /&gt;
&lt;br /&gt;
==== Firebug enhancements ====&lt;br /&gt;
You can enhance Firebug even further. See [[Firebug]] for more information.&lt;br /&gt;
&lt;br /&gt;
=== Web Developer Toolbar ===&lt;br /&gt;
Another great tool for any web developer is the [[Web developer extension]], another Firefox add-on. One very useful feature is the option to &#039;&#039;&#039;disable your browser&#039;s cache&#039;&#039;&#039; while working on your theme. That way you are sure you&#039;re always presented with your latest modifications and not with an older, cached version.&lt;br /&gt;
&lt;br /&gt;
Now also available for Google&#039;s Chrome browser: [http://www.sitepoint.com/blogs/2010/03/23/chrome-web-developer-toolbar/ &amp;quot;The Web Developer Toolbar Comes to Chrome&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
=== Stylish ===&lt;br /&gt;
Modifications made with Firebug are lost when refreshing your page. If you want your CSS changes to be a bit more permanent, for example to try them with different pages of your Moodle installation, you can use another Firefox plugin: [https://addons.mozilla.org/en-US/firefox/addon/2108 Stylish]. That way you can change your site&#039;s CSS with a simple mouse click without having to change Moodle code.&lt;br /&gt;
&lt;br /&gt;
See [[Stylish]] for detailed instructions and examples.&lt;br /&gt;
&lt;br /&gt;
== How do I check for cross-browser compatibility? ==&lt;br /&gt;
There are some tools (standalone and online) which can show you how your site looks in different browsers. See this [http://moodle.org/mod/forum/discuss.php?d=127746 forum discussion] for details.&lt;br /&gt;
&lt;br /&gt;
== Concrete examples for modifying Moodle themes ==&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&lt;br /&gt;
The following examples were taken from the former &#039;&#039;Theme Scrapbook&#039;&#039;:&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;quot;The Moodle &#039;&#039;&#039;Theme Scrapbook&#039;&#039;&#039; is a collection of small how-to descriptions. You theme designers and Moodle users working with themes add your knowledge here to help new Moodle users with tips and tricks for their theme work. &lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Feel free to add to this list! Don&#039;t know how? Read our [[MoodleDocs:Guidelines_for_contributors|Guidelines for contributors]].&amp;quot;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Changing things ===&lt;br /&gt;
&lt;br /&gt;
==== Colors ====&lt;br /&gt;
* [[Forcing the colour of the chat discussion pane (pop-up mode)]]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=142765 Changing background colour of a topic box]&lt;br /&gt;
&lt;br /&gt;
==== Logo and icons ====&lt;br /&gt;
* [[Alternate Icon Set|Using an alternate icon set in Moodle]]&lt;br /&gt;
* [[Favicon|Change the favicon that shows in front of the web address]]&lt;br /&gt;
* [[Footer replacement|Replace the logo in the footer with your web address and/or or own logo]]&lt;br /&gt;
*[[Header logo|Replace the logo in the header]]&lt;br /&gt;
&lt;br /&gt;
==== Layout ====&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=136546 Overriding the $menu / $button variables] using PHP regular expressions in header.html&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=143411 Changing the view of course categories] - work in progress&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=143411 Sub categories and courses layout] - work in progress&lt;br /&gt;
&lt;br /&gt;
=== Adding things ===&lt;br /&gt;
* [[Header logo|Adding a logo to the theme header]]&lt;br /&gt;
&lt;br /&gt;
=== Hiding things ===&lt;br /&gt;
* Hiding an element with CSS is generally achieved using the [http://reference.sitepoint.com/css/display display: none;] property on the element.&lt;br /&gt;
* See [[Print style]] and [[Stylish#Print style for Database records]] for an example how to hide parts of a page not meant for printing.&lt;br /&gt;
&lt;br /&gt;
=== Moving things ===&lt;br /&gt;
* [[Center Forum Posts|Centre smaller forum posts on the page]]&lt;br /&gt;
* [[Footer positioning|Positioning the page footer]]&lt;br /&gt;
* [[Left-align quiz|Left align quiz questions and answers]]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=121847 Indentation for nested categories]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=128599 Positioning login and choose language field]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=145179 Match question type - position answers nearer to the questions]&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous ===&lt;br /&gt;
* [[Fixed-width theme|Creating a fixed-width theme]]&lt;br /&gt;
* [[Homepage design|Homepage design of moodle.org]]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=146763 Is there a way to fix oversized HTML Editor using CSS?]&lt;br /&gt;
&lt;br /&gt;
==How can I see theme changes when using the Windows Complete Installer package==&lt;br /&gt;
In the [http://download.moodle.org/windows/ Windows Complete Installer package], the eAccelerator in the XAMPP install can cause some issues with changes to your theme&#039;s CSS and HTML files from showing.&lt;br /&gt;
&lt;br /&gt;
Open the php.ini file inside of the server\php folder from your install in notepad and search for &amp;quot;eAccelerator&amp;quot; you should see a line that reads: &lt;br /&gt;
 extension=eaccelerator.dll&lt;br /&gt;
&lt;br /&gt;
Insert a semi-colon (turns the line into a comment) at the start of this line so it now reads: &lt;br /&gt;
 ;extension=eaccelerator.dll&lt;br /&gt;
&lt;br /&gt;
Restart the Moodle server using the &amp;quot;stop moodle&amp;quot; and then the &amp;quot;start moodle&amp;quot; programs in your server folder. You should now find that all of your changes to your css are reflected as soon as you save the file and refresh your browser cache (usually you can refresh your cache by pressing F5). This FAQ from a discussion at [http://moodle.org/mod/forum/discuss.php?d=151562#p663950 Deactivating caching with XAMPP installations]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?f=29 Themes forum]&lt;br /&gt;
* [[CSS FAQ]]&lt;br /&gt;
* [http://learn.open.ac.uk/mod/oublog/view.php?user=155976 &amp;quot;Understanding Moodle Themes&amp;quot;] - Blog post by [http://moodle.org/user/view.php?id=78896&amp;amp;course=5 Christopher Douce] (Open University)&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=149534 Testing 2.0. Use for modern vs old browsers] forum discussion&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
[[de:Designs_FAQ]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Themes_FAQ&amp;diff=72753</id>
		<title>Themes FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Themes_FAQ&amp;diff=72753"/>
		<updated>2010-06-08T19:21:57Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Themes}}&lt;br /&gt;
==How do I install a new theme?==&lt;br /&gt;
&lt;br /&gt;
# Unzip the .zip file to an empty local directory.&lt;br /&gt;
# Upload folder to your web server to the /moodle/theme/[Theme Name]. (Replace [Theme Name] with the name of the theme you have downloaded.) Ensure the new theme folder and its contents are readable by the webserver.  Change Read and Write permissions (CHMOD) for the files and folder to 755 - Owner read/write/execute, Group read/execute, Everyone read/execute.  Incorrect permissions may prevent display of the newly installed theme.&lt;br /&gt;
# Choose your new theme from within Moodle via &#039;&#039;Administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme selector&#039;&#039;  (or &#039;&#039;Administration &amp;gt; Configuration &amp;gt; Themes&#039;&#039; in versions of Moodle prior to 1.7).&lt;br /&gt;
&lt;br /&gt;
==How do I create a custom theme?==&lt;br /&gt;
&lt;br /&gt;
See [[Creating a custom theme]] and/or [[Make your own theme]].&lt;br /&gt;
&lt;br /&gt;
==Can I assign a specific theme to a course?==&lt;br /&gt;
&lt;br /&gt;
Yes. In the course settings, use the &amp;quot;Force theme&amp;quot; dropdown box.&lt;br /&gt;
&lt;br /&gt;
== Where shall I put my custom CSS code? ==&lt;br /&gt;
&lt;br /&gt;
Instead of modifying the theme&#039;s CSS files you better put your own code in a separate CSS file and make your theme aware of that file by modifying its config.php file (be sure add your own CSS file as the last one in the list so that you will override all prior settings). See this posting for [http://moodle.org/mod/forum/discuss.php?d=128599#p564055 detailed instructions]. &lt;br /&gt;
&lt;br /&gt;
See also the instructions on creating your own theme mentioned above.&lt;br /&gt;
&lt;br /&gt;
==How can I get the New Moodle2 theme for my site?==&lt;br /&gt;
Not til Moodle 2.x comes out and it will be a &amp;quot;sort of&amp;quot;.  The new look (refered to as &amp;quot;Moodle2&amp;quot;) for Moodle.org was made public just before the close of 2008. The Moodle2 look has various things hard coded into its fabric.   The good news is that many pieces of the look are available.&lt;br /&gt;
&lt;br /&gt;
==Will I lose my courses, language files, logo, etc. if I switch my theme?==&lt;br /&gt;
Switching themes only changes the appearance of your site, not the content within it. The logo is a part of the theme and will be lost when you switch.&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to [[Creating_a_custom_theme#Adding_a_Logo|add a logo]] to a theme.&lt;br /&gt;
&lt;br /&gt;
== Are there tools which help me creating and editing themes? ==&lt;br /&gt;
&lt;br /&gt;
=== Clear Cache Button ===&lt;br /&gt;
This useful Firefox add-on let&#039;s you add a button to your tool bar for easily clearing your cache while working on your theme: https://addons.mozilla.org/de/firefox/addon/1801&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;Please note that the following tools are only for development. They only change the way &#039;&#039;you&#039;&#039; see your Moodle site, not the Moodle site itself. Any changes you make using these tools will not be visible to anyone else who uses your site. For this you will have to make those changes permanent by changing your theme&#039;s CSS files for example.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Firebug ===&lt;br /&gt;
The single most useful tool is the [[Development:Firebug|Firebug]] add-on for the [[Firefox]] web browser. Firebug integrates with Firefox to put a wealth of development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page... And there are additional add-ons for making Firebug an even more powerful tool.&lt;br /&gt;
&lt;br /&gt;
==== Firebug enhancements ====&lt;br /&gt;
You can enhance Firebug even further. See [[Firebug]] for more information.&lt;br /&gt;
&lt;br /&gt;
=== Web Developer Toolbar ===&lt;br /&gt;
Another great tool for any web developer is the [[Web developer extension]], another Firefox add-on. One very useful feature is the option to &#039;&#039;&#039;disable your browser&#039;s cache&#039;&#039;&#039; while working on your theme. That way you are sure you&#039;re always presented with your latest modifications and not with an older, cached version.&lt;br /&gt;
&lt;br /&gt;
Now also available for Google&#039;s Chrome browser: [http://www.sitepoint.com/blogs/2010/03/23/chrome-web-developer-toolbar/ &amp;quot;The Web Developer Toolbar Comes to Chrome&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
=== Stylish ===&lt;br /&gt;
Modifications made with Firebug are lost when refreshing your page. If you want your CSS changes to be a bit more permanent, for example to try them with different pages of your Moodle installation, you can use another Firefox plugin: [https://addons.mozilla.org/en-US/firefox/addon/2108 Stylish]. That way you can change your site&#039;s CSS with a simple mouse click without having to change Moodle code.&lt;br /&gt;
&lt;br /&gt;
See [[Stylish]] for detailed instructions and examples.&lt;br /&gt;
&lt;br /&gt;
== How do I check for cross-browser compatibility? ==&lt;br /&gt;
There are some tools (standalone and online) which can show you how your site looks in different browsers. See this [http://moodle.org/mod/forum/discuss.php?d=127746 forum discussion] for details.&lt;br /&gt;
&lt;br /&gt;
== Concrete examples for modifying Moodle themes ==&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&lt;br /&gt;
The following examples were taken from the former &#039;&#039;Theme Scrapbook&#039;&#039;:&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;quot;The Moodle &#039;&#039;&#039;Theme Scrapbook&#039;&#039;&#039; is a collection of small how-to descriptions. You theme designers and Moodle users working with themes add your knowledge here to help new Moodle users with tips and tricks for their theme work. &lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Feel free to add to this list! Don&#039;t know how? Read our [[MoodleDocs:Guidelines_for_contributors|Guidelines for contributors]].&amp;quot;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Changing things ===&lt;br /&gt;
&lt;br /&gt;
==== Colors ====&lt;br /&gt;
* [[Forcing the colour of the chat discussion pane (pop-up mode)]]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=142765 Changing background colour of a topic box]&lt;br /&gt;
&lt;br /&gt;
==== Logo and icons ====&lt;br /&gt;
* [[Alternate Icon Set|Using an alternate icon set in Moodle]]&lt;br /&gt;
* [[Favicon|Change the favicon that shows in front of the web address]]&lt;br /&gt;
* [[Footer replacement|Replace the logo in the footer with your web address and/or or own logo]]&lt;br /&gt;
*[[Header logo|Replace the logo in the header]]&lt;br /&gt;
&lt;br /&gt;
==== Layout ====&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=136546 Overriding the $menu / $button variables] using PHP regular expressions in header.html&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=143411 Changing the view of course categories] - work in progress&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=143411 Sub categories and courses layout] - work in progress&lt;br /&gt;
&lt;br /&gt;
=== Adding things ===&lt;br /&gt;
* [[Header logo|Adding a logo to the theme header]]&lt;br /&gt;
&lt;br /&gt;
=== Hiding things ===&lt;br /&gt;
* Hiding an element with CSS is generally achieved using the [http://reference.sitepoint.com/css/display display: none;] property on the element.&lt;br /&gt;
* See [[Print style]] and [[Stylish#Print style for Database records]] for an example how to hide parts of a page not meant for printing.&lt;br /&gt;
&lt;br /&gt;
=== Moving things ===&lt;br /&gt;
* [[Center Forum Posts|Centre smaller forum posts on the page]]&lt;br /&gt;
* [[Footer positioning|Positioning the page footer]]&lt;br /&gt;
* [[Left-align quiz|Left align quiz questions and answers]]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=121847 Indentation for nested categories]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=128599 Positioning login and choose language field]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=145179 Match question type - position answers nearer to the questions]&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous ===&lt;br /&gt;
* [[Fixed-width theme|Creating a fixed-width theme]]&lt;br /&gt;
* [[Homepage design|Homepage design of moodle.org]]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=146763 Is there a way to fix oversized HTML Editor using CSS?]&lt;br /&gt;
&lt;br /&gt;
==How can I see theme changes when using the Windows Complete Installer package==&lt;br /&gt;
In the Windows Complete Installer package, the eAccelerator in the XAMPP install can cause some issues with changes to your theme&#039;s CSS and HTML files from showing.&lt;br /&gt;
&lt;br /&gt;
Open the php.ini file inside of the server\php folder from your install in notepad and search for &amp;quot;eAccelerator&amp;quot; you should see a line that reads: &lt;br /&gt;
 extension=eaccelerator.dll&lt;br /&gt;
&lt;br /&gt;
Insert a semi-colon (turns the line into a comment) at the start of this line so it now reads: &lt;br /&gt;
 ;extension=eaccelerator.dll&lt;br /&gt;
&lt;br /&gt;
Restart the Moodle server using the &amp;quot;stop moodle&amp;quot; and then the &amp;quot;start moodle&amp;quot; programs in your server folder. You should now find that all of your changes to your css are reflected as soon as you save the file and refresh your browser cache (usually you can refresh your cache by pressing F5). This FAQ from a discussion at [http://moodle.org/mod/forum/discuss.php?d=151562#p663950 Deactivating caching with XAMPP installations]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?f=29 Themes forum]&lt;br /&gt;
* [[CSS FAQ]]&lt;br /&gt;
* [http://learn.open.ac.uk/mod/oublog/view.php?user=155976 &amp;quot;Understanding Moodle Themes&amp;quot;] - Blog post by [http://moodle.org/user/view.php?id=78896&amp;amp;course=5 Christopher Douce] (Open University)&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=149534 Testing 2.0. Use for modern vs old browsers] forum discussion&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
[[de:Designs_FAQ]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=admin/environment/php_extension/mbstring&amp;diff=71544</id>
		<title>admin/environment/php extension/mbstring</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=admin/environment/php_extension/mbstring&amp;diff=71544"/>
		<updated>2010-04-27T22:31:35Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you want to have mbstring work on a LAMP server with yum (Fedora, Redhat, Centos) or apt-get (Ubuntu, Debian) then  do this&lt;br /&gt;
&lt;br /&gt;
1) As root from the CLI &#039;&#039;yum install php-mbstring&#039;&#039; or in the apt-get case &#039;&#039;apt-get install php-mbstring&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Then restart Apache&lt;br /&gt;
&lt;br /&gt;
either &#039;&#039;/etc/init.d/httpd&#039;&#039; restart&#039;&#039; or possibly &#039;&#039;/etc/init.d/apache2 restart&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Then check your server Environment again and the whinge from Moodle should have gone away and rewarded you with a nice tick or such-like.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To enable the mbstring library in Windows package installations of Moodle:&lt;br /&gt;
&lt;br /&gt;
# Open the &#039;&#039;php.ini&#039;&#039; file found in the &#039;&#039;moodle/apache/bin&#039;&#039; folder or Windows folder&lt;br /&gt;
# Find the line: &amp;lt;code&amp;gt;;extension=php_mbstring.dll&amp;lt;/code&amp;gt;&lt;br /&gt;
# Remove the &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt; at the beginning of the line&lt;br /&gt;
# Restart apache if necessary&lt;br /&gt;
&lt;br /&gt;
Note: This page needs to be enhanced by adding corresponding instructions for other kinds of Moodle installations.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=39977 php_extension mbstring is recommended to be installed/enabled] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[Category:Environment|php extension]]&lt;br /&gt;
&lt;br /&gt;
[[fr:admin/environment/php extension/mbstring]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Development:Themes_2.0&amp;diff=71417</id>
		<title>Development:Themes 2.0</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Development:Themes_2.0&amp;diff=71417"/>
		<updated>2010-04-24T07:08:17Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Moodle&amp;#039;s core organisation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Themes}}{{Moodle 2.0}}Welcome to the new world of themes within Moodle 2.0!&lt;br /&gt;
&lt;br /&gt;
This document explains how themes work in Moodle and is intended to help you create or modify most themes for Moodle 2.0.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Moodle themes are responsible for much of the &amp;quot;look&amp;quot; of a Moodle site.  They are responsible for providing the CSS for colours, layouts, fonts and so on, and can also change the structural XHTML code below that.  &lt;br /&gt;
&lt;br /&gt;
Themes can either be completely standalone (which means the theme designer needs to define everything) or they can extend an existing theme with customisations.   &lt;br /&gt;
&lt;br /&gt;
Most themes simply add new CSS to an existing standard theme and this is an effective way to achieve just about anything you want to do.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==What&#039;s new in 2.0==&lt;br /&gt;
&lt;br /&gt;
The theme system was completely redesigned in Moodle 2.0.  Known issues have been addressed and new features have been added to meet community requests.&lt;br /&gt;
&lt;br /&gt;
Unfortunately it was not possible to maintain backward compatibility, so all Moodle 1.x themes need to be recreated for Moodle 2.0.&lt;br /&gt;
&lt;br /&gt;
Major changes include:&lt;br /&gt;
* Clearer and more consistent CSS classes and IDs throughout all pages in Moodle&lt;br /&gt;
* Introduction of layout files (templates) describing overall layout HTML for many different types of pages in Moodle.&lt;br /&gt;
* Introduction of renderers, which produce the smaller &amp;quot;parts&amp;quot; of a HTML page.  Advanced themes can choose to override these too if they choose.&lt;br /&gt;
* Introduction of standard methods for adding Javascript to themes.&lt;br /&gt;
* Easier control over icons and images in Moodle.&lt;br /&gt;
* The old &amp;quot;standard&amp;quot; theme has been split into two themes:&lt;br /&gt;
**&#039;&#039;&#039;base&#039;&#039;&#039; - contains absolutely basic layout, and&lt;br /&gt;
**&#039;&#039;&#039;standard&#039;&#039;&#039; - which adds CSS to the base theme to make it look like the old standard theme.&lt;br /&gt;
* Performance tuning: In normal production mode CSS files are combined into a single optimised file, and both CSS and JavaScript files are minimised to ensure there are no wasted connections or traffic.  Files are heavily cached, but also versioned, so that users never need to clear their caches.&lt;br /&gt;
&lt;br /&gt;
==The structure of a theme==&lt;br /&gt;
&lt;br /&gt;
Some important things to know when building good themes:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;config.php&#039;&#039;&#039; - this file is required in every theme.  It defines configuration settings and definitions required to make the theme work in Moodle. These include theme, file, region, default region and options. &lt;br /&gt;
# &#039;&#039;&#039;Layouts and layout files&#039;&#039;&#039; -  in config.php there is one definition for each page type (see [[#theme_layouts_table|Appendix A: Theme layouts]] for a list of over 12 types).  Each page type definition tells Moodle which layout file will be used, what block regions this page type should display and so on.  The layout file contains the HTML and the minimum PHP required to display basic structure of pages. (If you know Moodle 1.9, it&#039;s like a combination of header.html and footer.html).&lt;br /&gt;
# &#039;&#039;&#039;The base theme&#039;&#039;&#039; - is not intended to be used for production sites.  It sets up the simplest possible generic layout and includes only CSS essential to that layout &#039;&#039;or&#039;&#039; to Moodle as a whole.  It tries not to make any unnecessary rules and makes as few assumptions as possible.  It&#039;s the perfect base on which to start designing a theme, as there are very few colours, borders, margins, and alignments to override.  You can just start adding what you need.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Theme files and folders are laid out like this:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! File / Directory&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| /config.php &lt;br /&gt;
| Contains all of the configuration and definitions for each theme&lt;br /&gt;
|-&lt;br /&gt;
| /lib.php &lt;br /&gt;
| Contains speciality classes and functions that are used by theme&lt;br /&gt;
|-&lt;br /&gt;
| /renderers.php &lt;br /&gt;
| Contains the custom renderers for the theme.&lt;br /&gt;
|-&lt;br /&gt;
| /settings.php &lt;br /&gt;
| Contains custom theme settings. These local settings are defined by the theme allowing the theme user to easily alter something about the way it looks or operates. (eg a background colour, or a header image)&lt;br /&gt;
|-&lt;br /&gt;
| /javascript/ &lt;br /&gt;
| All speciality JavaScript files the theme requires should be located in here.&lt;br /&gt;
|-&lt;br /&gt;
| /lang/ &lt;br /&gt;
| Any special language files the theme requires should be located in here.&lt;br /&gt;
|-&lt;br /&gt;
| /layout/ &lt;br /&gt;
| Contains the layout files for the theme.&lt;br /&gt;
|-&lt;br /&gt;
| /pix/ &lt;br /&gt;
| Contains any images the theme makes use of either in CSS or in the layout files.&lt;br /&gt;
|-&lt;br /&gt;
| /pix/favicon.ico &lt;br /&gt;
| The favicon to display for this theme.&lt;br /&gt;
|-&lt;br /&gt;
| /pix/screenshot.jpg &lt;br /&gt;
| A screenshot of the theme to be displayed in on the theme selection screen.&lt;br /&gt;
|-&lt;br /&gt;
| /style/ &lt;br /&gt;
| Contains the CSS files that the theme requires.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are also several other places that stylesheets can be included from (see the CSS how and why section below).&lt;br /&gt;
&lt;br /&gt;
==Theme options==&lt;br /&gt;
All theme options are set within the config.php file for the theme.&lt;br /&gt;
Have a look at the &#039;&#039;&#039;[[#theme_options_table|theme options table]]&#039;&#039;&#039; for a complete list of theme options, however keep in mind that in reality for most themes the only settings that are of any use are parents, javascripts, layouts, and sheets. The other settings are specialised or advanced and will not be used in most cases.&lt;br /&gt;
&lt;br /&gt;
Lets have a look at a basic theme configuration file and the different bits that make it up:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;name = &#039;newtheme&#039;;&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;parents = array(&lt;br /&gt;
    &#039;base&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;admin&#039;,&lt;br /&gt;
    &#039;blocks&#039;,&lt;br /&gt;
    &#039;calendar&#039;,&lt;br /&gt;
    &#039;course&#039;,&lt;br /&gt;
    &#039;grade&#039;,&lt;br /&gt;
    &#039;message&#039;,&lt;br /&gt;
    &#039;question&#039;,&lt;br /&gt;
    &#039;user&#039;&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    &#039;base&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;newtheme&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(),&lt;br /&gt;
    ),&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;newtheme&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;,&lt;br /&gt;
    )&lt;br /&gt;
    //.......&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
$THEME-&amp;gt;javascripts_footer = array(&lt;br /&gt;
    &#039;navigation&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First up you will notice everything is added to $THEME. This is the theme&#039;s configuration object, it is created by Moodle using default settings and is then updated by whatever settings you add to it.&lt;br /&gt;
&lt;br /&gt;
The first setting is the theme&#039;s name, this should simply be whatever your theme&#039;s name is, most likely whatever you named your theme directory.&lt;br /&gt;
&lt;br /&gt;
Next comes an array of themes this theme will extend. In this case it is extending the base theme.&lt;br /&gt;
&lt;br /&gt;
After this is an array containing the names of the stylesheets to include for this theme. Note that it is just the name of the stylesheet and does not contain either the directory it exists in or the file extension. This is because Moodle assumes that the theme&#039;s stylesheets will be located in the styles directory of the theme and have .css as an extension.&lt;br /&gt;
&lt;br /&gt;
Next we see the layouts definition, in this case two layouts have been defined to override the layouts from the base theme. For more information see the [[#Layouts|layouts]] section below.&lt;br /&gt;
&lt;br /&gt;
The final setting is to include a JavaScript file. Much like styles you only need to provide the files name, Moodle will assume it is in your themes JavaScript directory and be a .js file.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;: When you start out theming, make sure you take a look at the configuration files of the other themes that get shipped with Moodle. You will get a good picture of how everything works, and what is going on in a theme, simply by reading it and taking notice of what it is including or excluding.&lt;br /&gt;
&lt;br /&gt;
==CSS==&lt;br /&gt;
===Where it comes from===&lt;br /&gt;
First lets look at where CSS can be included from within Moodle:&lt;br /&gt;
; \theme\themename\styles\*.css : This is the default location for all of the stylesheets that are used by a theme&lt;br /&gt;
; {pluginpath}\styles.css e.g. \block\blockname\styles.css or \mod\modname\styles.css : Every plugin can have its own styles.css file. This file should only contain the required CSS rules for the module and should not add anything to the look of the plugin such as colours, font sizes, or margins other than those that are truly required.&amp;lt;br /&amp;gt;Theme specific styles for a plugin should be located within the themes styles directory.&lt;br /&gt;
; {pluginpath}\styles_themename.css : This should only ever be used by plugin developers. It allows them to write CSS that is designed for a specific theme without having to make changes to that theme. You will notice that this is never used within Moodle and is designed to be used only by contributed code.&lt;br /&gt;
&lt;br /&gt;
There is also one more method that can be used (although very rarely) to include CSS in a page. A developer can manually specify to include a stylesheet from anywhere within Moodle.&lt;br /&gt;
&lt;br /&gt;
As a theme designer you should not have to worry about this, however, as it is only ever meant to be used to include styles from a php file that is getting them from somewhere else, like the database.&lt;br /&gt;
Usually, if code is doing this, it is because there is a config or plugin setting that contains information required by CSS.&lt;br /&gt;
&lt;br /&gt;
When designing a theme, the only method of introducing CSS, that we are interested in, is the first method: adding rules to a stylesheet file located in the themes styles directory.&lt;br /&gt;
&lt;br /&gt;
It is important to note that the order, in which CSS files are found and included, has been specially crafted to ensure that the rules, within a theme&#039;s style sheets, take precedence over identical rules in other files, ensuring that themes have the last say.&lt;br /&gt;
&lt;br /&gt;
===Moodle&#039;s core organisation===&lt;br /&gt;
The next thing to look at is the organisation of CSS and rules within a theme. Although as a theme designer it is entirely up to you as to how you create and organise your CSS you will notice that within the themes provided out of the box by Moodle there is a very clear organisation of CSS.&lt;br /&gt;
&lt;br /&gt;
First up the pagelayout.css file, this contains the CSS required to give the layouts their look and feel. It doesn&#039;t contain any rules that affect the content generated by Moodle.&lt;br /&gt;
&lt;br /&gt;
Next is the core.css file. If you open up core you will notice that it contains all manner of general (usually) simple rules that don&#039;t relate to a specific section of Moodle but to Moodle as a whole.&lt;br /&gt;
There are also rules that relate to specific sections however this is done if there are only a handful of rules for that section. These small clusters of rules are grouped together and separated by comments identifying for which section each relates.&lt;br /&gt;
&lt;br /&gt;
Finally there are all the other CSS files, you will notice that there is a file for each section of Moodle that has a significant collection of rules.&lt;br /&gt;
For those who are familiar with Moodle 1.9 theme&#039;s this organisation will be a big change, in 1.9 CSS was organised by its nature (e.g. colours, layout, other)&lt;br /&gt;
&lt;br /&gt;
===How to write effective rules within Moodle===&lt;br /&gt;
This is an incredibly important point now within Moodle 2.0.&lt;br /&gt;
&lt;br /&gt;
Due to performance requirements and browser limitations all of the CSS files are combined into a single CSS file that gets included every time. This means that rules need to be written in such a way as to minimise the chances of a collision leading to unwanted styles being applied. Whilst writing good CSS is something most designers strive for we have implemented several new body classes and put more emphasis on developers for using classes more appropriately.&lt;br /&gt;
&lt;br /&gt;
====The body tag====&lt;br /&gt;
As of Moodle 2.0 the ID tag that gets applied to the body will always be a representation of the URI. For example if you are looking at a forum posting and the URI is &#039;/mod/forum/view.php&#039; then the body tags ID will be &#039;#page-mod-forum-view&#039;.&lt;br /&gt;
&lt;br /&gt;
As well as the body&#039;s ID attribute the URI is also exploded to form several CSS classes that get added to the body tag, so in the above example &#039;/mod/forum/view&#039; you would end up with the following classes being added to the body tag &#039;.path-mod&#039;, &#039;.path-mod-forum&#039;. Note that &#039;.path-mod-forum-view&#039; is not added as a class, this is intentionally left out to lessen confusion and duplication as rules can relate directly to the page by using the ID and do not require the final class.&lt;br /&gt;
&lt;br /&gt;
The body ID and body classes described above will form the bread and butter for many of the CSS rules you will need to write for your theme, however there are also several other very handy classes that get added to the body tag that will be beneficial to you once you start your journey down the rabbit hole that is themeing. Some of the more interesting classes are listed below.&lt;br /&gt;
&lt;br /&gt;
* If JavaScript is enabled then &#039;jsenabled&#039; will be added as a class to the body tag allowing you to style based on JavaScript being enabled or not.&lt;br /&gt;
* Either &#039;dir-rtl&#039; or &#039;dir-ltr&#039; will be added to the body as a class depending on the direction of the language pack: rtl = right to left, ltr = left to right. This allows you to determine your text-alignment based on language if required.&lt;br /&gt;
* A class will be added to represent the language pack currently in use, by default en_utf8 is used by Moodle and will result in the class &#039;lang-en_utf8&#039; being added to the body tag.&lt;br /&gt;
* The wwwroot for Moodle will also be converted to a class and added to the body tag allowing you to stylise your theme based on the URL through which it was reached. e.g. http://sam.moodle.local/moodle/ will become &#039;.sam-moodle-local—moodle&#039;&lt;br /&gt;
* If the current user is not logged then &#039;.notloggedin&#039; will be added to the body tag.&lt;br /&gt;
&lt;br /&gt;
What does all of this look like in practise? Well using the above example /mod/forum/view.php you would get at least the following body tag:&lt;br /&gt;
&amp;lt;code html4strict&amp;gt;&amp;lt;body id=”page-mod-forum-view” class=”path-mod path-mod-forum” /&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Writing your rules====&lt;br /&gt;
Now of course there are many specific classes used within Moodle, we try to put them everywhere where anyone may want to apply their own styles. It is important to recognise that no one developer can be aware of the all of the class names that have been used all throughout Moodle, let alone within all of the different contributed bits and pieces available for Moodle, it is up to the themer to write good rules and minimise the chances of a collision between rules because in this case good CSS is FAR more effective.&lt;br /&gt;
&lt;br /&gt;
When starting to write rules make sure that you have a good understanding of where you want those rules to be applied, it is a good idea to make the most of the body classes mentioned above.&lt;br /&gt;
If you want to write a rule for a specific page make use of the body tag&#039;s ID, e.g.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;#page-mod-forum-view .forumpost {border:1px solid orange;)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to write a rule that will be applied all throughout the forum.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;.path-mod-forum .forumpost {border:1px solid orange;}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The other very important thing to take into consideration is the structure leading up to the tag you want to style. Browsers apply conflicting styles with priority on the more specific selectors. It can be very beneficial to keep this in mind and write full selectors that rely on the structure of the tags leading to the tag you wish to style.&lt;br /&gt;
&lt;br /&gt;
By making use of body id&#039;s and classes and writing selectors to take into account the leading structure you can greatly minimise the chance of a collision both with Moodle now and in the future.&lt;br /&gt;
&lt;br /&gt;
==Layouts==&lt;br /&gt;
All themes are required to define the layouts they wish to be responsible for as well as create however many layout files are required by those layouts. If the theme is overriding another theme then it is a case of deciding which layouts this new theme should override. If the theme is a completely fresh start then you will need to define a layout for each of the different possibilities. For both situations these layouts should be defined within config.php.&lt;br /&gt;
&lt;br /&gt;
It is also important to note that a new theme that will base itself on another theme (overriding it) does not need to define any layouts or use any layout files if there are no changes that it wishes to make to the layouts of the existing theme. The standard theme in Moodle is a good example of this as it extends the base theme simply adding CSS to achieve its look and feel.&lt;br /&gt;
&lt;br /&gt;
So layouts... as mentioned earlier layouts are defined in config.php within $THEME-&amp;gt;layouts. The following is an example of one such layout definition:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$THEME-&amp;gt;layouts = array(&lt;br /&gt;
    // Standard layout with blocks, this is recommended for most pages with general information&lt;br /&gt;
    &#039;standard&#039; =&amp;gt; array(&lt;br /&gt;
        &#039;theme&#039; =&amp;gt; &#039;base&#039;,&lt;br /&gt;
        &#039;file&#039; =&amp;gt; &#039;general.php&#039;,&lt;br /&gt;
        &#039;regions&#039; =&amp;gt; array(&#039;side-pre&#039;, &#039;side-post&#039;),&lt;br /&gt;
        &#039;defaultregion&#039; =&amp;gt; &#039;side-post&#039;&lt;br /&gt;
    )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The first thing Moodle looks at is the name of the layout, in this case it is `standard` (the array key in PHP), it then looks at the settings for the layout, this is the theme, file, regions, and default region. There are also a couple of other options that can be set by a layout.&lt;br /&gt;
&lt;br /&gt;
; theme : is the theme the layout file exists in. That&#039;s right you can make use of layouts from other installed themes.&lt;br /&gt;
; file : is the name of the layout file this layout wants to use.&lt;br /&gt;
; regions : is the different block regions (places you can put blocks) within the theme.&lt;br /&gt;
; defaultregion : is the default location when adding new blocks.&lt;br /&gt;
; options : an array of layout specific options described in detail below.&lt;br /&gt;
&lt;br /&gt;
The first four settings are required by each layout definition however the final setting `options` is a special case that only needs to be set if you want to make use of it. This setting allows the theme designer to specify special options that they would like to create that can be later accessed within the layout file. This allows the theme to make design decisions during the definition and react upon those decisions in what ever layout file is being used.&lt;br /&gt;
&lt;br /&gt;
One such place this has been used is infact within the base theme. If you take a look first at theme/base/config.php you will notice that several layouts specify options &#039;&#039;&#039;nonavbar&#039;&#039;&#039; and &#039;&#039;&#039;nofooter&#039;&#039;&#039; which can both be set to either true or false. Then if we take a look at theme/base/layout/general.php you will spot lines like the following:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$hasnavbar = (empty($PAGE-&amp;gt;layout_options[&#039;nonavbar&#039;]) &amp;amp;&amp;amp; $PAGE-&amp;gt;has_navbar());&lt;br /&gt;
$hasfooter = (empty($PAGE-&amp;gt;layout_options[&#039;nofooter&#039;]));&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
............&lt;br /&gt;
&amp;lt;?php if ($hasnavbar) { ?&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;navbar clearfix&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;navbar(); ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;navbutton&amp;quot;&amp;gt; &amp;lt;?php echo $PAGE-&amp;gt;button; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
What you are seeing here is the use of those settings from the layout within the layout file. In this case it is being used to toggle the display of the navigation bar and page footer.&lt;br /&gt;
&lt;br /&gt;
==Layout files==&lt;br /&gt;
A layout file is a file that contains the core HTML structure for a layout including the header, footer, content and block regions.&lt;br /&gt;
For those of you who are familiar with themes in Moodle 1.9 this is simply header.html and footer.html combined.&lt;br /&gt;
Of course it is not all HTML, there is bits of HTML and content that Moodle needs to put into the page, within each layout file this will be done by a couple of VERY simple PHP calls to get bits and pieces including content.&lt;br /&gt;
&lt;br /&gt;
The following is a very simple layout file to illustrate the different bits that make it up:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyid ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyclasses; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_top_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;table id=&amp;quot;page&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;login_info(); echo $PAGE-&amp;gt;headingmenu; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&lt;br /&gt;
            &amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
        &amp;lt;td colspan=&amp;quot;3&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;p class=&amp;quot;helplink&amp;quot;&amp;gt;&amp;lt;?php echo page_doc_link(get_string(&#039;moodledocslink&#039;)) ?&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
            &amp;lt;?php&lt;br /&gt;
            echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
            echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
            echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
            ?&amp;gt;&lt;br /&gt;
        &amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_end_of_body_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lets assume you know a enough HTML to understand the basic structure above, what you probably don&#039;t understand are the PHP calls so lets look at them.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;doctype() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This occurs at the VERY top of the page, it must be the first bit of output and is responsible for adding the (X)HTML document type definition to the page. This of course is determined by the settings of the site and is one of the things that the themer has no control over.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;html &amp;lt;?php echo $OUTPUT-&amp;gt;htmlattributes() ?&amp;gt;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we have started writing the opening html tag and have asked Moodle to give us the HTML attributes that should be applied to it. This again is determined by several settings within the actual HTML install.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $PAGE-&amp;gt;title ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This gets us the title for the page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;standard_head_html() ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This very important call gets us the standard head HTML that needs to be within the HEAD tag of the page. This is where CSS and JavaScript requirements for the top of the page will be output as well as any special script or style tags.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;body id=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyid; ?&amp;gt;&amp;quot; class=&amp;quot;&amp;lt;?php echo $PAGE-&amp;gt;bodyclasses; ?&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Much like the html tag above we have started writing the body tag and have asked for Moodle to get us the desired ID and classes that should be applied to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;h1 class=&amp;quot;headermain&amp;quot;&amp;gt;&amp;lt;?php echo $PAGE-&amp;gt;heading; ?&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;headermenu&amp;quot;&amp;gt;&amp;lt;?php echo $OUTPUT-&amp;gt;login_info(); echo $PAGE-&amp;gt;headingmenu; ?&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we are creating the header for the page. In this case we want the heading for the page, we want to display the login information which will be the current users username or a link to log in if they are not logged in, and we want the heading menu if there is one.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-pre&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we get the HTML to display the blocks that have been added to the page. In this case we have asked for all blocks that have been added to the area labelled &#039;&#039;side-pre&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo core_renderer::MAIN_CONTENT_TOKEN ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This is one of the most important calls within the file, it determines where the actual content for the page gets inserted.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php echo $OUTPUT-&amp;gt;blocks_for_region(&#039;side-post&#039;) ?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here we get the HTML to display the blocks that have been added to the page. In this case we have asked for all blocks that have been added to the area labelled &#039;&#039;side-post&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
echo $OUTPUT-&amp;gt;login_info();&lt;br /&gt;
echo $OUTPUT-&amp;gt;home_link();&lt;br /&gt;
echo $OUTPUT-&amp;gt;standard_footer_html();&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This final bit of code gets the content for the footer of the page. It gets the login information which is the same as in the header, a home link, and the standard footer HTML which like the standard head HTML contains all of the script and style tags required by the page and requested to go in the footer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Note&#039;&#039;&#039;&#039;&#039;: Within Moodle 2.0 most of the JavaScript for the page will be included in the footer. This greatly helps reduce the loading time of the page.&lt;br /&gt;
&lt;br /&gt;
When writing layout files think about the different layouts and how the HTML that each makes use of will differ. You will most likely find you do not need a different layout file for each layout, most likely you will be able to reuse the layout files you create across several layouts. You can of course make use of layout options as well to further reduce the number of layout files you need to produce.&lt;br /&gt;
&lt;br /&gt;
Of course as mentioned above if you are customising an existing theme then you may not need to create any layouts or layout files at all.&lt;br /&gt;
&lt;br /&gt;
==Making use of images==&lt;br /&gt;
Right at the start when listing the features of the new themes system one of the features mentioned was the ability to override any of the standard images within Moodle from within your theme. At this point we will look at both how to make use of your own images within your theme, and secondly how to override the images being used by Moodle.&lt;br /&gt;
So first up a bit about images within Moodle,&lt;br /&gt;
&lt;br /&gt;
# Images you want to use within your theme &#039;&#039;&#039;need&#039;&#039;&#039; to be located within your theme&#039;s pix directory.&lt;br /&gt;
# You can use sub directories within the pix directory of your theme.&lt;br /&gt;
# Images used by Moodle&#039;s core are located within the pix directory of Moodle.&lt;br /&gt;
# Modules, blocks and other plugins should also store there images within a pix directory.&lt;br /&gt;
&lt;br /&gt;
So making use of your own images first up. Lets assume you have added two image files to the pix directory of your theme.&lt;br /&gt;
&lt;br /&gt;
* /theme/yourthemename/pix/imageone.jpg&lt;br /&gt;
* /theme/yourthemename/pix/subdir/imagetwo.png&lt;br /&gt;
&lt;br /&gt;
Notice that one image is a JPEG image, and the second is a PNG. Also the second image is in a subdirectory.&lt;br /&gt;
&lt;br /&gt;
The following code snippet illustrates how to make use of your images within HTML, such as if you wanted to use them within a layout file.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;imageone&#039;, &#039;theme&#039;);?&amp;gt;&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;img src=&amp;quot;&amp;lt;?php echo $OUTPUT-&amp;gt;pix_url(&#039;subdir/imagetwo&#039;, &#039;theme&#039;);?&amp;gt;&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
In this case rather than writing out the URL to the image we use a method of Moodle&#039;s output library. Its not too important how that functions works but it is important that we use it as it is what allows images within Moodle to be over-rideable.&lt;br /&gt;
&lt;br /&gt;
The following is how you would use the images from within CSS as background images.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.divone {background-image:url([[pix:theme|imageone]]);}&lt;br /&gt;
.divtwo {background-image:url([[pix:theme|subdir/imagetwo]]);}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
If this case we have to use some special notations that Moodle looks for. Whenever Moodle hands out a CSS file it first searches for all &#039;&#039;[[something]]&#039;&#039; tags and replaces them with what is required.&lt;br /&gt;
&lt;br /&gt;
The final thing to notice with both of the cases above is that at no point do we include the images file extension. &lt;br /&gt;
The reason for this leads us into the next topic, how to override images.&lt;br /&gt;
&lt;br /&gt;
From within a theme you can VERY easily override any standard image within Moodle by simply adding the replacement image to the theme&#039;s pix directory in the same sub directory structure as it is in Moodle.&lt;br /&gt;
So for instance we wanted to override the following two images:&lt;br /&gt;
# /pix/moodlelogo.gif&lt;br /&gt;
# /pix/i/user.gif&lt;br /&gt;
We would simply need to add our replacement images to the theme in the following locations&lt;br /&gt;
# /theme/themename/pix/moodlelogo.gif&lt;br /&gt;
# /theme/themename/pix/i/user.gif&lt;br /&gt;
How easy is that!&lt;br /&gt;
&lt;br /&gt;
Now the other very cool thing to mention is that Moodle looks for not just replacements of the same image type (jpg, gif, etc...) but also replacements in any image format. This is why above when working with our images we never specified the images file extension.&lt;br /&gt;
This means that the following would also work:&lt;br /&gt;
# /theme/themename/pix/moodlelogo.png&lt;br /&gt;
# /theme/themename/pix/i/user.bmp&lt;br /&gt;
&lt;br /&gt;
==Appendix A==&lt;br /&gt;
===Theme options as of March 29th, 2010===&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot; id=&amp;quot;theme_options_table&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Setting&lt;br /&gt;
! Effect&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;csspostprocess&#039;&#039;&#039;&lt;br /&gt;
|  Allows the user to provide the name of a function that all CSS should be passed to before being delivered.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;editor_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets to include within the body of the editor.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;enable_dock&#039;&#039;&#039;&lt;br /&gt;
|  If set to true the side dock is enabled for blocks&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;filter_mediaplugin_colors&#039;&#039;&#039;&lt;br /&gt;
|  Used to control the colours used in the small media player for the filters&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;javascripts&#039;&#039;&#039;&lt;br /&gt;
|  An array containing the names of JavaScript files located in /javascript/ to include in the theme. (gets included in the head)&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;javascripts_footer&#039;&#039;&#039;&lt;br /&gt;
|  As above but will be included in the page footer.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;larrow&#039;&#039;&#039;&lt;br /&gt;
|  Overrides the left arrow image used throughout Moodle&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;layouts&#039;&#039;&#039;&lt;br /&gt;
|  An array setting the layouts for the theme&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents&#039;&#039;&#039;&lt;br /&gt;
|  An array of themes to inherit from&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents_exclude_javascripts&#039;&#039;&#039;&lt;br /&gt;
|  An array of JavaScript files NOT to inherit from the themes parents&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;parents_exclude_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets not to inherit from the themes parents&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;plugins_exclude_sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of plugin sheets to ignore and not include.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;rarrow&#039;&#039;&#039;&lt;br /&gt;
|  Overrides the right arrow image used throughout Moodle&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;renderfactory&#039;&#039;&#039;&lt;br /&gt;
|  Sets a custom render factory to use with the theme, used when working with custom renderers.&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;resource_mp3player_colors&#039;&#039;&#039;&lt;br /&gt;
|  Controls the colours for the MP3 player&lt;br /&gt;
|-&lt;br /&gt;
|  $THEME-&amp;gt;&#039;&#039;&#039;sheets&#039;&#039;&#039;&lt;br /&gt;
|  An array of stylesheets to include for this theme. Should be located in the theme&#039;s styles directory.&lt;br /&gt;
|}&lt;br /&gt;
===The different layouts as of March 29th, 2010===&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot; id=&amp;quot;theme_layouts_table&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Layout&lt;br /&gt;
! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| base&lt;br /&gt;
| Most backwards compatible layout without the blocks - this is the layout used by default.&lt;br /&gt;
|- &lt;br /&gt;
| standard&lt;br /&gt;
| Standard layout with blocks, this is recommended for most pages with general information.&lt;br /&gt;
|- &lt;br /&gt;
| course&lt;br /&gt;
| Main course page.&lt;br /&gt;
|- &lt;br /&gt;
| coursecategory&lt;br /&gt;
| Use for browsing through course categories.&lt;br /&gt;
|- &lt;br /&gt;
| incourse&lt;br /&gt;
| Default layout while browsing a course, typical for modules.&lt;br /&gt;
|- &lt;br /&gt;
| frontpage&lt;br /&gt;
| The site home page.&lt;br /&gt;
|- &lt;br /&gt;
| admin&lt;br /&gt;
| Administration pages and scripts.&lt;br /&gt;
|- &lt;br /&gt;
| mydashboard&lt;br /&gt;
| My dashboard page.&lt;br /&gt;
|- &lt;br /&gt;
| mypublic&lt;br /&gt;
| My public page.&lt;br /&gt;
|- &lt;br /&gt;
| login&lt;br /&gt;
| The login page.&lt;br /&gt;
|-&lt;br /&gt;
| popup&lt;br /&gt;
| Pages that appear in pop-up windows - no navigation, no blocks, no header.&lt;br /&gt;
|-&lt;br /&gt;
| frametop&lt;br /&gt;
| Used for legacy frame layouts only. No blocks and minimal footer.&lt;br /&gt;
|-&lt;br /&gt;
| embedded&lt;br /&gt;
| Embeded pages, like iframe/object embedded in moodleform - it needs as much space as possible&lt;br /&gt;
|-&lt;br /&gt;
| maintenance&lt;br /&gt;
| Used during upgrade and install. This must not have any blocks, and it is good idea if it does not have links to other places - for example there should not be a home link in the footer.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
* [[Development:Themes 2.0 creating your first theme]]&lt;br /&gt;
* [[Development:Themes 2.0 overriding a renderer]]&lt;br /&gt;
&lt;br /&gt;
* [[Development:Theme_changes Older docs describing the core code changes]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=PHP_settings_by_Moodle_version&amp;diff=71067</id>
		<title>PHP settings by Moodle version</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=PHP_settings_by_Moodle_version&amp;diff=71067"/>
		<updated>2010-04-15T08:04:31Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
and &lt;br /&gt;
{{Review}}{{Template:Installing Moodle}}&lt;br /&gt;
==PHP Version==&lt;br /&gt;
Moodle has different PHP requirements for different versions:&lt;br /&gt;
* Moodle 2.0 will require PHP 5.2.8 or later.&lt;br /&gt;
* Moodle 1.6 to 1.9 requires PHP 4.3.0 or later&lt;br /&gt;
* Moodle 1.0 to 1.5 requires PHP 4.1.0 or later &lt;br /&gt;
==PHP Settings==&lt;br /&gt;
Check these settings in your php.ini or .htaccess file (if you&#039;re using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. &lt;br /&gt;
* &#039;&#039;register_globals&#039;&#039; &#039;&#039;&#039;MUST&#039;&#039;&#039; be OFF&lt;br /&gt;
* &#039;&#039;safe_mode&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;memory_limit&#039;&#039; should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.&lt;br /&gt;
* &#039;&#039;session.save_handler&#039;&#039; needs to be set to FILES.&lt;br /&gt;
* &#039;&#039;magic_quotes_gpc&#039;&#039; should be OFF. (It will be an installation pre-requisite for this to be turned off from 2.0 onwards.)&lt;br /&gt;
* &#039;&#039;magic_quotes_runtime&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;file_uploads&#039;&#039; needs to be ON.&lt;br /&gt;
* &#039;&#039;session.auto_start&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;session.bug_compat_warn&#039;&#039; needs to be OFF.&lt;br /&gt;
==PHP Extensions and libraries==&lt;br /&gt;
* The mbstring extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
* The iconv extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
* [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make. (Freetype support is available as part of the GD extension for the 5.x versions of PHP)&lt;br /&gt;
* The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.&lt;br /&gt;
* The pgsql extension is required if you are using the PostgreSQL database.&lt;br /&gt;
* The zlib extension is required for zip/unzip functionality.&lt;br /&gt;
* The pdo and pdo_sqlite extensions are required for the (experimental) SQLite 3 database support.&lt;br /&gt;
* The tokenizer extension is recommended for Moodle 1.8 or later (enabled by default as of [http://www.php.net/manual/en/tokenizer.installation.php PHP 4.3.0]).&lt;br /&gt;
* The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
* The xmlrpc extension is required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
* The ctype extension is recommended for Moodle 1.8 or later (enabled by default as of [http://www.php.net/manual/en/ctype.installation.php PHP 4.2.0]). &lt;br /&gt;
* Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
==Database Support==&lt;br /&gt;
A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is &#039;&#039;the&#039;&#039; choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment.&lt;br /&gt;
* For Moodle 1.5, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). &lt;br /&gt;
* For Moodle 1.6, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).&lt;br /&gt;
* For Moodle 1.7, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
* For Moodle 1.8 or later, MySQL (version 4.1.12 or later), PostgreSQL (8.0 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting &amp;quot;strict mode&amp;quot; must be OFF (set to &amp;quot;&amp;quot; or &amp;quot;MYSQL40&amp;quot;) in the MySQL configuration file. &lt;br /&gt;
: PostgreSQL Notes: PostgreSQL 7.4 is recommended for earlier Moodle versions, since Moodle 1.8 only PostgreSQL 8.0 and above are supported.&lt;br /&gt;
* For showcases or low to medium-sized installations, Moodle 2.0 also includes (experimental) support for SQLite 3 database. This setup requires no database server, as the database file is stored in a local directory on the server.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Installing Moodle]]&lt;br /&gt;
*[[Performance]]&lt;br /&gt;
&lt;br /&gt;
[[de:PHP-Versionen für Moodle]]&lt;br /&gt;
[[ru:Настройки PHP для разных версий Moodle]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=PHP_settings_by_Moodle_version&amp;diff=71066</id>
		<title>PHP settings by Moodle version</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=PHP_settings_by_Moodle_version&amp;diff=71066"/>
		<updated>2010-04-15T08:03:21Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
and &lt;br /&gt;
{{Review}}{{Template:Installing Moodle}}&lt;br /&gt;
==PHP Version==&lt;br /&gt;
Moodle has different PHP requirements for different versions:&lt;br /&gt;
* Moodle 2.0 will require PHP 5.2.8 or later.&lt;br /&gt;
* Moodle 1.6 to 1.9 requires PHP 4.3.0 or later&lt;br /&gt;
* Moodle 1.0 to 1.5 requires PHP 4.1.0 or later &lt;br /&gt;
==PHP Settings==&lt;br /&gt;
Check these settings in your php.ini or .htaccess file (if you&#039;re using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. &lt;br /&gt;
* &#039;&#039;register_globals&#039;&#039; &#039;&#039;&#039;MUST&#039;&#039;&#039; be OFF&lt;br /&gt;
* &#039;&#039;safe_mode&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;memory_limit&#039;&#039; should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.&lt;br /&gt;
* &#039;&#039;session.save_handler&#039;&#039; needs to be set to FILES.&lt;br /&gt;
* &#039;&#039;magic_quotes_gpc&#039;&#039; should be OFF. (It will be an installation pre-requisite for this to be turned off from 2.0 onwards.)&lt;br /&gt;
* &#039;&#039;magic_quotes_runtime&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;file_uploads&#039;&#039; needs to be ON.&lt;br /&gt;
* &#039;&#039;session.auto_start&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;session.bug_compat_warn&#039;&#039; needs to be OFF.&lt;br /&gt;
==PHP Extensions and libraries==&lt;br /&gt;
* The mbstring extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
* The iconv extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
* [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make. (Freetype support is available as part of the GD extension for the 5.x versions of PHP)&lt;br /&gt;
* The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.&lt;br /&gt;
* The pgsql extension is required if you are using the PostgreSQL database.&lt;br /&gt;
* The zlib extension is required for zip/unzip functionality.&lt;br /&gt;
* The pdo and pdo_sqlite extensions are required for the (experimental) SQLite 3 database support.&lt;br /&gt;
* The tokenizer extension is recommended for Moodle 1.8 or later (enabled by default as of [http://www.php.net/manual/en/tokenizer.installation.php PHP 4.3.0]).&lt;br /&gt;
* The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
* The xmlrpc extension is required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
* The ctype extension is recommended for Moodle 1.8 or later (enabled by default as of [http://www.php.net/manual/en/ctype.installation.php PHP 4.2.0]). &lt;br /&gt;
* Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
==Database Support==&lt;br /&gt;
A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is &#039;&#039;the&#039;&#039; choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment.&lt;br /&gt;
* For Moodle 1.5, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). &lt;br /&gt;
* For Moodle 1.6, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).&lt;br /&gt;
* For Moodle 1.7, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
* For Moodle 1.8 or later, MySQL (version 4.1.12 or later), PostgreSQL (8.0 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting &amp;quot;strict mode&amp;quot; must be OFF (set to &amp;quot;&amp;quot; or &amp;quot;MYSQL40&amp;quot;) in the MySQL configuration file. &lt;br /&gt;
: PostgreSQL Notes: PostgreSQL 7.4 is recommended for earlier Moodle versions, since Moodle 1.8 only PostgreSQL 8.0 and above are supported.&lt;br /&gt;
* For showcases or low to medium-sized installations, Moodle 2.0 also includes (experimental) support for SQLite 3 database. This setup requires no database server, as the database file is stored in a local directory on the server.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Installing Moodle]]&lt;br /&gt;
&lt;br /&gt;
[[de:PHP-Versionen für Moodle]]&lt;br /&gt;
[[ru:Настройки PHP для разных версий Moodle]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Performance_recommendations&amp;diff=71065</id>
		<title>Performance recommendations</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Performance_recommendations&amp;diff=71065"/>
		<updated>2010-04-15T07:54:34Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* PHP performance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Location: &#039;&#039;Administration &amp;gt; Server &amp;gt; Performance&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Moodle can be made to perform very well, at small usage levels or scaling up to many thousands of users. The factors involved in performance are basically the same as for any PHP-based database-driven system. When trying to optimize your server, try to focus on the factor which will make the most difference to the user. For example, if you have relatively more users browsing than accessing the database, look to improve the webserver performance.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Obtain a baseline benchmark==&lt;br /&gt;
&lt;br /&gt;
Before attempting any optimization, you should obtain a baseline benchmark of the component of the system you are trying to improve. For Linux try [http://lbs.sourceforge.net/ LBS] and for Windows use the Performance Monitor. Once you have quantitative data about how your system is performing currently, you&#039;ll be able to determine if the change you have made has had any real impact.&lt;br /&gt;
&lt;br /&gt;
The overall aim of adjustments to improve performance is to use RAM (cacheing) and to reduce disk-based activity. It is especially important to try to eliminate swap file usage as much as you can. If your system starts swapping, this is a sign that you need more RAM. &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;optimization order preference&#039;&#039;&#039; is usually: primary storage (more RAM), secondary storage (faster hard disks/improved hard disk configuration), processor (more and faster).&lt;br /&gt;
&lt;br /&gt;
==Scalability==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;s design (with clear separation of application layers) allows for strongly scalable setups. (Please check the list of [[Large installations|large Moodle installations]].)&lt;br /&gt;
&lt;br /&gt;
Large sites usually separate the web server and database onto separate servers, although for smaller installations this is typically not necessary.&lt;br /&gt;
&lt;br /&gt;
It is possible to load-balance a Moodle installation, for example by using more than one webserver. The separate webservers should query the same database and refer to the same filestore area, but otherwise the separation of the application layers is complete enough to make this kind of clustering feasible. Similarly, the database could be a cluster of servers (e.g. a MySQL cluster), but this is not an easy task and you should seek expert support, e.g. from a Moodle Partner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;: &lt;br /&gt;
*[[Server cluster]]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=4801 Scalability] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=57202 Moodle clustering] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=44470 Software load balancing] forum discussion.&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=49986 TCP load balancing] forum dicsussion.&lt;br /&gt;
&lt;br /&gt;
==Hardware configuration==&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: The fastest and most effective change that you can make to improve performance is to &#039;&#039;&#039;increase the amount of RAM on your web server&#039;&#039;&#039; - get as much as possible (eg 4GB). Increasing primary memory will reduce the need for processes to swap to disk and will enable your server to handle more users.&lt;br /&gt;
* Better performance is gained by obtaining the best &#039;&#039;&#039;processor capability&#039;&#039;&#039; you can, i.e. dual or dual core processors. A modern BIOS should allow you to enable hyperthreading, but check if this makes a difference to the overall performance of the processors by using a [http://en.wikipedia.org/wiki/Super_PI CPU benchmarking tool].&lt;br /&gt;
* If you can afford them, use &#039;&#039;&#039;SCSI hard disks&#039;&#039;&#039; instead of SATA drives. SATA drives will increase your system&#039;s CPU utilization, whereas SCSI drives have their own integrated processors and come into their own when you have multiple drives. If you must have SATA drives, check that your motherboard and the drives themselves support NCQ (Native Command Queuing).&lt;br /&gt;
* Purchase hard disks with a &#039;&#039;&#039;low seek time&#039;&#039;&#039;. This will improve the overall speed of your system, especially when accessing Moodle&#039;s reports.&lt;br /&gt;
* Size your &#039;&#039;&#039;swap file&#039;&#039;&#039; correctly. The general advice is to set it to 4 x physical RAM.&lt;br /&gt;
* Use a &#039;&#039;&#039;RAID disk system&#039;&#039;&#039;. Although there are many different RAID configurations you can create, the following generally works best:&lt;br /&gt;
** install a hardware RAID controller (if you can)&lt;br /&gt;
** the operating system and swap drive on one set of disks configured as RAID-1.&lt;br /&gt;
** Moodle, Web server and Database server on another set of disks configured as RAID-5.&lt;br /&gt;
* Use &#039;&#039;&#039;gigabit ethernet&#039;&#039;&#039; for improved latency and throughput. This is especially important when you have your webserver and database server separated out on different hosts.&lt;br /&gt;
* Check the settings on your &#039;&#039;&#039;network card&#039;&#039;&#039;. You may get an improvement in performance by increasing the use of buffers and transmit/receive descriptors (balance this with processor and memory overheads) and off-loading TCP checksum calculation onto the card instead of the OS.&lt;br /&gt;
*  Read this [http://moodle.org/mod/forum/discuss.php?d=68579 Case Study] on a server stress test with 300 users.  &lt;br /&gt;
* See this [http://elearning.sgu.ac.jp/doc/PT/ accompanying report] on network traffic and server loads.&lt;br /&gt;
* See the [[Moodle.org configuration]]&lt;br /&gt;
* Also see this SFSU presentation at Educause (using VMWare): [http://www.educause.edu/Resources/AnOpenSourceLMSforaMissionCrit/162843]&lt;br /&gt;
&lt;br /&gt;
==Operating System==&lt;br /&gt;
* You can use [http://en.wikipedia.org/wiki/Linux Linux](recommended), Unix-based, Windows or Mac OS X for the server &#039;&#039;&#039;operating system&#039;&#039;&#039;. *nix operating systems generally require less memory than Mac OS X or Windows servers for doing the same task as the server is configured with just a shell interface. Additionally Linux does not have licensing fees attached, but can have a big learning curve if you&#039;re used to another operating system. If you have a large number of processors running SMP, you may also want to consider using a highly tuned OS such as [http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris].&lt;br /&gt;
* Check your own OS and &#039;&#039;&#039;vendor specific instructions&#039;&#039;&#039; for optimization steps.&lt;br /&gt;
** For Linux look at the [http://linuxperf.sourceforge.net/ Linux Performance Team] site. &lt;br /&gt;
** For Linux investigate the hdparm command, e.g. hdparm -m16 -d1 can be used to enable read/write on multiple sectors and DMA. Mount disks with the async and noatime options.&lt;br /&gt;
** For Windows set the sever to be optimized for network applications (Control Panel, Network Connections, LAN connection, Properties, File &amp;amp; Printer Sharing for Microsoft Networks, Properties, Optimization). You can also search the [http://technet.microsoft.com/ Microsoft TechNet site] for optimization documents.&lt;br /&gt;
&lt;br /&gt;
==Web server performance==&lt;br /&gt;
&lt;br /&gt;
Installing [http://www.mozilla.com/en-US/ Firefox] and the [https://addons.mozilla.org/en-US/firefox/addon/1843 firebug] extension will allow you to watch the time it takes for each page component to load. Also, the [https://addons.mozilla.org/en-US/firefox/addon/5369 Yslow] extension will evaluate your page against Yahoo&#039;s [http://www.skrenta.com/2007/05/14_rules_for_fast_web_pages_by_1.html 14 rules] ([http://video.yahoo.com/video/play?vid=1040890 video]) for fast loading websites.&lt;br /&gt;
&lt;br /&gt;
===PHP performance===&lt;br /&gt;
* You are strongly recommended to use a &#039;&#039;&#039;PHP accelerator&#039;&#039;&#039; to ease CPU load, such as [http://pecl.php.net/apc APC], [http://www.php-accelerator.co.uk/ PHPA], [http://trac.lighttpd.net/xcache/ Xcache] or [http://eaccelerator.net/ eAccelerator]. (Take care to choose a PHP accelerator that is known to work well with your version of PHP and note that Turck MMCache is [http://turckmmcache.exeprod.com/TheManifestoEnglish no longer maintained] and can cause failures with PHP 5). &lt;br /&gt;
* Improvements in read/write performance can be improved by putting the cached PHP pages on a [[TMPFS]] filesystem - but remember that you&#039;ll lose the cache contents when there is a power failure or the server is rebooted.&lt;br /&gt;
* Performance of PHP is better when installed as an &#039;&#039;&#039;Apache/IIS ISAPI module&#039;&#039;&#039; (rather than a CGI).&lt;br /&gt;
* Also check the &#039;&#039;&#039;memory_limit&#039;&#039;&#039; in php.ini, reduce it to 16M for Moodle version earlier than 1.7 ([http://moodle.org/mod/forum/discuss.php?d=39656 See this forum discussion]). For Moodle 1.7 or later, it is recommended that the value of memory_limit should be 40M. As of [http://www.php.net/ChangeLog-5.php PHP 5.2.1] the default value for the memory_limit directive is 128M.&lt;br /&gt;
* Also see [[PHP_settings_by_Moodle_version]]&lt;br /&gt;
&lt;br /&gt;
===Install HowTo===&lt;br /&gt;
* [http://2bits.com/articles/installing-php-apc-gnulinux-centos-5.html APC on CentOS 5.x (linux)]&lt;br /&gt;
* [http://fplanque.com/dev/linux/install-apc-php-cache-debian-lenny APC on Debian (linux)]&lt;br /&gt;
* [http://www.linuxtuts.net/211-installing-memcached-php5-memcache-module-debian-apache2.html MemCache module on Debian (Apache2 and PHP5) ]&lt;br /&gt;
&lt;br /&gt;
===Apache performance===&lt;br /&gt;
* If you are using Apache on a Windows server, use the build from [http://www.apachelounge.com Apache Lounge] which is reported to have [http://moodle.org/mod/forum/discuss.php?d=93358 performance and stability improvements] compared to the official Apache download. Note that this is an unofficial build, so may not keep up with official releases.&lt;br /&gt;
* Set the &#039;&#039;&#039;MaxClients&#039;&#039;&#039; directive correctly. Use this formula to help (which uses 80% of available memory to leave room for spare):&lt;br /&gt;
 MaxClients = Total available memory * 80% / Max memory usage of apache process&lt;br /&gt;
:Memory usage of apache process is usually 10MB, so a general rule of thumb is to divide your available memory in megabytes by 10 to get the value of MaxClients. To find the max memory usage of apache processes read the value from the shell command:&lt;br /&gt;
 #ps -ylC httpd --sort:rss&lt;br /&gt;
&lt;br /&gt;
:If you need to increase the value of &#039;&#039;&#039;MaxClients&#039;&#039;&#039; beyond 256, you will also need to set the &#039;&#039;&#039;ServerLimit&#039;&#039;&#039; directive. &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: Do not be tempted to set the value of MaxClients higher than your available memory as your server will consume more RAM than available and start to swap to disk. &lt;br /&gt;
* Consider reducing the &#039;&#039;&#039;number of modules&#039;&#039;&#039; that Apache loads in the httpd.conf file to the minumum necessary to reduce the memory needed. &lt;br /&gt;
* Use the &#039;&#039;&#039;latest version of Apache&#039;&#039;&#039; - Apache 2 has an improved memory model which reduces memory usage further.&lt;br /&gt;
* For Unix/Linux systems, consider lowering &#039;&#039;&#039;MaxRequestsPerChild&#039;&#039;&#039; in httpd.conf to as low as 20-30 (if you set it any lower the overhead of forking begins to outweigh the benefits). &lt;br /&gt;
* For a heavily loaded server, consider setting &#039;&#039;&#039;KeepAlive Off&#039;&#039;&#039; (do this only if your Moodle pages do not contain links to resources or uploaded images) or lowering the &#039;&#039;&#039;KeepAliveTimeout&#039;&#039;&#039; to between 2 and 5. The default is 15 (seconds) - the higher the value the more server processes will be kept waiting for possibly idle connections. A more accurate value for KeepAliveTimeout is obtained by observing how long it takes your users to download a page. After altering any of the KeepAlive variables, monitor your CPU utilization as there may be an additional overhead in initiating more worker processes/threads.&lt;br /&gt;
* A warning about the previous performance tip.  Microsoft Internet Explorer has a (little) known bug that causes seriously problems with SSL-enabled Apache websites.   The issue is that if a web server&#039;s KeepAlive timeout is set to less than 60 seconds (say to the default of 15 seconds), MSIE can get confused about whether a keep-alive connection is available or not.  As a result, any browser POST requests (which always use a keep-alive if available) will fail to reach the server.  This is easily reproduced with postings to the Moodle forums.   Using MSIE, connect to an ssl-enabled Moodle site.  Write a quick forum post, and submit it when the form has been displayed for between 15 seconds and 60 seconds.   You will see a browser error message, and your post content will be lost.  In some cases, doing this will even crash the Windows TCP stack on the client machine. &#039;&#039;&#039; So, if your site is SSL-enabled, and you use Apache, you should set the KeepAliveTimeout to at least 60 seconds&#039;&#039;&#039;.&lt;br /&gt;
* As an alternative to using KeepAlive Off, consider setting-up a &#039;&#039;&#039;Reverse Proxy server&#039;&#039;&#039; infront of the Moodle server to cache HTML files with images. You can then return Apache to using keep-alives on the Moodle server.&lt;br /&gt;
* If you do not use a .htaccess file, set the &#039;&#039;&#039;AllowOverride&#039;&#039;&#039; variable to AllowOverride None to prevent .htaccess lookups.&lt;br /&gt;
* Set &#039;&#039;&#039;DirectoryIndex&#039;&#039;&#039; correctly so as to avoid content-negotiation. Here&#039;s an example from a production server:&lt;br /&gt;
 DirectoryIndex index.php index.html index.htm&lt;br /&gt;
* Unless you are doing development work on the server, set &#039;&#039;&#039;ExtendedStatus Off&#039;&#039;&#039; and disable mod_info as well as mod_status.&lt;br /&gt;
* Leave &#039;&#039;&#039;HostnameLookups Off&#039;&#039;&#039; (as default) to reduce DNS latency.&lt;br /&gt;
* Consider reducing the value of &#039;&#039;&#039;TimeOut&#039;&#039;&#039; to between 30 to 60 (seconds). &lt;br /&gt;
* For the &#039;&#039;&#039;Options directive&#039;&#039;&#039;, avoid Options Multiviews as this performs a directory scan. To reduce disk I/O further use&lt;br /&gt;
 Options -Indexes FollowSymLinks&lt;br /&gt;
*&#039;&#039;&#039;Caching&#039;&#039;&#039; - Apache can be told to make pages load a lot faster by specifying that the browser should cache some various page elements such as images and reuse them from local memory rather than ask for them again every time a page is requested. How to do this varies slightly between OSes but there are two basic steps:&lt;br /&gt;
&lt;br /&gt;
# Install and enable mod_expires - refer to documentation or man pages&lt;br /&gt;
# Add this code to the virtual server config file within the &amp;lt;directory&amp;gt; section for the root directory (or within the .htaccess file if AllowOverrides is On):&lt;br /&gt;
 &amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
  ExpiresActive On&lt;br /&gt;
  ExpiresDefault &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType text/html &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
  ExpiresByType image/gif &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/jpeg &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType image/png &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/css &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType application/x-javascript &amp;quot;access plus 1 week&amp;quot;&lt;br /&gt;
  ExpiresByType text/xml &amp;quot;access plus 1 seconds&amp;quot;&lt;br /&gt;
 &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It&#039;s possible to gain a several hundred percent decrease in load times this way. Adjust the cache times according to how often your images etc change.&lt;br /&gt;
&lt;br /&gt;
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]&lt;br /&gt;
&lt;br /&gt;
===IIS performance===&lt;br /&gt;
All alter this location in the registry:&lt;br /&gt;
 HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters\&lt;br /&gt;
* The equivalent to KeepAliveTimeout is &#039;&#039;&#039;ListenBackLog&#039;&#039;&#039; (IIS - registry location is HKLM\ SYSTEM\ CurrentControlSet\ Services\ Inetinfo\ Parameters). Set this to between 2 to 5.&lt;br /&gt;
*Change the &#039;&#039;&#039;MemCacheSize&#039;&#039;&#039; value to adjust the amount of memory (Mb) that IIS will use for its file cache (50% of available memory by default).&lt;br /&gt;
*Change the &#039;&#039;&#039;MaxCachedFileSize&#039;&#039;&#039; to adjust the maximum size of a file cached in the file cache in bytes. Default is 262,144 (256K).&lt;br /&gt;
*Create a new DWORD called &#039;&#039;&#039;ObjectCacheTTL&#039;&#039;&#039; to change the length of time (in milliseconds) that objects in the cache are held in memory. Default is 30,000 milliseconds (30 seconds).&lt;br /&gt;
&lt;br /&gt;
===Lighttpd performance===&lt;br /&gt;
You can increase server performance by using a &#039;&#039;&#039;light-weight&#039;&#039;&#039; webserver like [http://www.lighttpd.net/ lighttpd] (or [http://nginx.net/ nginx])in combination with PHP in FastCGI-mode. Lighttpd was originally created as a proof-of-concept[http://www.lighttpd.net/story] to address the [http://www.kegel.com/c10k.html C10k problem] and while primarily recommended for memory-limited servers, its design origins and asynchronous-IO model make it a suitable and proven[http://blog.lighttpd.net/articles/2006/12/28/lighttpd-powers-5-alexa-top-250-sites] alternative HTTP server for high-load websites and web apps, including Moodle. See the [[lighttpd | MoodleDocs Lighttpd page]] for additional information, configuration example and links.&lt;br /&gt;
&lt;br /&gt;
Alternatively, both [http://www.lighttpd.net/ lighttpd] and [http://nginx.net/ nginx] are capable of performing as a load-balancer and/or reverse-proxy to alleviate load on back-end servers[http://www.linuxjournal.com/article/10108], providing benefit without requiring an actual software change on existing servers.&lt;br /&gt;
&lt;br /&gt;
==Database performance==&lt;br /&gt;
&lt;br /&gt;
Moodle contains a script which will display some key database performance statistics from the [http://phplens.com/lens/adodb/docs-perf.htm ADOdb performance monitor]. Run the script in your browser as in the following example:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/dbperformance.php&lt;br /&gt;
&lt;br /&gt;
Use the data displayed as a guide to tune and improve the performance of your database server.&lt;br /&gt;
&lt;br /&gt;
===MySQL performance===&lt;br /&gt;
&lt;br /&gt;
The following are MySQL specific settings which can be adjusted for better performance in your my.cnf (my.ini in Windows). The file contains a list of settings and their values. To see the current values use these commands&lt;br /&gt;
 SHOW STATUS;&lt;br /&gt;
 SHOW VARIABLES; &lt;br /&gt;
&#039;&#039;&#039;Important&#039;&#039;&#039;: You must make backups of your database before attempting to change any MySQL server configuration. After any change to the my.cnf, restart mysqld.&lt;br /&gt;
&lt;br /&gt;
If you are able, the [http://mysqltuner.com/ MySQLTuner] tool can be run against your MySQL server and will calculate appropriate configuration values for most of the following settings based on your current load, status and variables automatically.&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;query cache&#039;&#039;&#039; with &lt;br /&gt;
 query_cache_type = 1. &lt;br /&gt;
For most Moodle installs, set the following:&lt;br /&gt;
 query_cache_size = 36M &lt;br /&gt;
 query_cache_min_res_unit = 2K. &lt;br /&gt;
The query cache will improve performance if you are doing few updates on the database. &lt;br /&gt;
* Set the &#039;&#039;&#039;table cache&#039;&#039;&#039; correctly. For Moodle 1.6 set &lt;br /&gt;
 table_cache = 256 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min), and for Moodle 1.7 set &lt;br /&gt;
 table_cache = 512 #(table_open_cache in MySQL &amp;gt; 5.1.2)&lt;br /&gt;
(min). The table cache is used by all threads (connections), so monitor the value of opened_tables to further adjust - if opened_tables &amp;gt; 3 * table_cache(table_open_cache in MySQL &amp;gt; 5.1.2) then increase table_cache upto your OS limit. Note also that the figure for table_cache will also change depending on the number of modules and plugins you have installed. Find the number for your server by executing the mysql statement below. Look at the number returned and set table_cache to this value.&lt;br /&gt;
 mysql&amp;gt;SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema=&#039;yourmoodledbname&#039;;&lt;br /&gt;
* Set the &#039;&#039;&#039;thread cache&#039;&#039;&#039; correctly. Adjust the value so that your thread cache utilization is as close to 100% as possible by this formula:&lt;br /&gt;
 thread cache utilization (%) = (threads_created / connections) * 100&lt;br /&gt;
* The &#039;&#039;&#039;key buffer&#039;&#039;&#039; can improve the access speed to Moodle&#039;s SELECT queries. The correct size depends on the size of the index files (.myi) and in Moodle 1.6 or later (without any additional modules and plugins), the recommendation for this value is key_buffer_size = 32M. Ideally you want the database to be reading once from the disk for every 100 requests so monitor that the value is suitable for your install by adjusting the value of key_buffer_size so that the following formulas are true:&lt;br /&gt;
 key_read / key_read_requests &amp;lt; 0.01&lt;br /&gt;
 key_write / key_write_requests &amp;lt;= 1.0&lt;br /&gt;
* Set the &#039;&#039;&#039;maximum number of connections&#039;&#039;&#039; so that your users will not see a &amp;quot;Too many connections&amp;quot; message. Be careful that this may have an impact on the total memory used. MySQL connections usually last for milliseconds, so it is unusual even for a heavily loaded server for this value to be over 200.&lt;br /&gt;
* Manage &#039;&#039;&#039;high burst activity&#039;&#039;&#039;. If your Moodle install uses a lot of quizzes and you are experiencing performance problems (check by monitoring the value of threads_connected - it should not be rising) consider increasing the value of back_log.&lt;br /&gt;
* &#039;&#039;&#039;Optimize your tables weekly and after upgrading Moodle&#039;&#039;&#039;. It is good practice to also optimize your tables after performing a large data deletion exercise, e.g. at the end of your semester or academic year. This will ensure that index files are up to date. Backup your database first and then use:&lt;br /&gt;
 mysql&amp;gt;CHECK TABLE mdl_tablename;&lt;br /&gt;
 mysql&amp;gt;OPTIMIZE TABLE mdl_tablename;&lt;br /&gt;
:The common tables in Moodle to check are mdl_course_sections, mdl_forum_posts, mdl_log and mdl_sessions (if using dbsessions). Any errors need to be corrected using REPAIR TABLE (see the [http://dev.mysql.com/doc/refman/5.0/en/repair-table.html MySQL manual] and this [http://moodle.org/mod/forum/discuss.php?d=58208#p279638 forum script]).&lt;br /&gt;
* &#039;&#039;&#039;Maintain the key distribution&#039;&#039;&#039;. Every month or so it is a good idea to stop the mysql server and run these myisamchk commands.&lt;br /&gt;
 #myisamchk -a -S /pathtomysql/data/moodledir/*.MYI&lt;br /&gt;
:&#039;&#039;&#039;Warning&#039;&#039;&#039;: You must stop the mysql database process (mysqld) before running any myisamchk command. If you do not, you risk data loss.&lt;br /&gt;
* Reduce the number of &#039;&#039;&#039;temporary tables saved to disk&#039;&#039;&#039;. Check this with the created_tmp_disk_tables value. If this is relatively large (&amp;gt;5%) increase tmp_table_size until you see a reduction. Note that this will have an impact on RAM usage.&lt;br /&gt;
* Moodle&#039;s tables are in the MyISAM format, so &#039;&#039;&#039;turn InnoDB off&#039;&#039;&#039; if you feel there is no performance gain. Add &amp;lt;code&amp;gt;skip-innodb&amp;lt;/code&amp;gt; to your &amp;lt;code&amp;gt;my.cnf&amp;lt;/code&amp;gt; file. If you must use InnoDB, you&#039;ll have to convert all of Moodle&#039;s tables. To do this run the innodb script:&lt;br /&gt;
&lt;br /&gt;
 http://www.mymoodle.com/admin/innodb.php&lt;br /&gt;
&lt;br /&gt;
:See also [http://moodle.org/mod/forum/discuss.php?d=12961 this forum discussion] which looks at the MyISAM vs InnoDB options.&lt;br /&gt;
&lt;br /&gt;
===PostgreSQL performance===&lt;br /&gt;
&lt;br /&gt;
There are some good papers around on tuning PostgreSQL, and Moodle&#039;s case does not seem to be different to the general case.&lt;br /&gt;
&lt;br /&gt;
The first thing to recognise is that if you really need to worry about tuning you should be using a separate machine for the database server. If you are not using a separate machine then the answers to many performance questions are substantially muddied by the memory requirements of the rest of the application.&lt;br /&gt;
&lt;br /&gt;
You should probably &#039;&#039;&#039;enable autovacuum&#039;&#039;&#039;, unless you know what you are doing. Many e-learning sites have predictable periods of low use, so disabling autovacuum and running a specific vacuum at those times can be a good option. Or perhaps leave autovacuum running but do a full vacuum weekly in a quiet period.&lt;br /&gt;
&lt;br /&gt;
Set &#039;&#039;&#039;shared_buffers&#039;&#039;&#039; to something reasonable. For versions up to 8.1 my testing has shown that peak performance is almost always obtained with buffers &amp;lt; 10000, so if you are using such a version, and have more than 512M of RAM just set shared_buffers to 10,000 (8MB).&lt;br /&gt;
&lt;br /&gt;
The buffer management had a big overhaul in 8.2 and &amp;quot;reasonable&amp;quot; is now a much larger number. I have not conducted performance tests with 8.2, but the recommendations from others are generally that you should now scale shared_buffers much more with memory and may continue to reap benefits even up to values like 100,000 (80MB). Consider using 1-2% of system RAM.&lt;br /&gt;
&lt;br /&gt;
PostgreSQL will also assume that the operating system is caching its files, so setting &#039;&#039;&#039;effective_cache_size&#039;&#039;&#039; to a reasonable value is also a good idea. A reasonable value will usually be (total RAM - RAM in use by programs). If you are running Linux and leave the system running for a day or two you can look at &#039;free&#039; and under the &#039;cached&#039; column you will see what it currently is. Consider taking that number (which is kB) and dividing it by 10 (i.e. allow 20% for other programs cache needs and then divide by 8 to get pages). If you are not using a dedicated database server you will need to decrease that value to account for usage by other programs.&lt;br /&gt;
&lt;br /&gt;
Some other useful parameters that can have positive effects, and the values I would typically set them to on a machine with 4G RAM, are:&lt;br /&gt;
&lt;br /&gt;
 work_mem = 10240&lt;br /&gt;
&lt;br /&gt;
That&#039;s 10M of RAM to use instead of on-disk sorting and so forth. That can give a big speed increase, but it is per connection and 200 connections * 10M is 2G, so it can theoretically chew up a lot of RAM.&lt;br /&gt;
&lt;br /&gt;
 maintenance_work_mem = 163840&lt;br /&gt;
&lt;br /&gt;
That&#039;s 160M of RAM which will be used by (e.g.) VACUUM, index rebuild, cluster and so forth. This should only be used periodically and should be freed when those processes exit, so I believe it is well worth while.&lt;br /&gt;
&lt;br /&gt;
 max_fsm_pages = 100000&lt;br /&gt;
 max_fsm_relations = 5000&lt;br /&gt;
&lt;br /&gt;
These are used to hold the free-space map, and if they are too small you will see performance degradation after the database has been operating for some time. The exact numbers to set can be gleaned from the output of VACUUM VERBOSE, which prints the required FSM pages at the end of it&#039;s run. The 5x increase seems to be useful for a Moodle installation, from experience.&lt;br /&gt;
&lt;br /&gt;
 wal_buffers = 64&lt;br /&gt;
&lt;br /&gt;
These buffers are used for the write-ahead log, and there have been a number of reports on the PostgreSQL mailing lists of improvement from this level of increase.&lt;br /&gt;
&lt;br /&gt;
This is a little out of date now (version 8.0) but still worth a read: http://www.powerpostgresql.com/Docs&lt;br /&gt;
&lt;br /&gt;
And there is lots of good stuff here as well: http://www.varlena.com/GeneralBits/Tidbits/index.php&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Based on Andrew McMillan&#039;s post at [http://moodle.org/mod/forum/discuss.php?d=68558 Tuning PostgreSQL] forum thread.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Other database performance links===&lt;br /&gt;
* Consider using a &#039;&#039;&#039;distributed cacheing system&#039;&#039;&#039; like [http://en.wikipedia.org/wiki/Memcached memcached] but note that memcached does not have any security features so it should be used behind a firewall.&lt;br /&gt;
* Consider using PostgreSQL. See [[Arguments in favour of PostgreSQL]] and [http://moodle.org/mod/forum/discuss.php?d=49195 how to migrate from MySQL to PostgreSQL] (forum discussion).&lt;br /&gt;
* [[Increasing the database connection lifetime | Try increasing the database connection lifetime]]&lt;br /&gt;
* [http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html General advice on tuning MySQL parameters] (advice from the MySQL manual)&lt;br /&gt;
* [http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ InnoDB performance optimization] taken from the [http://www.mysqlperformanceblog.com/ MySQL performance blog] site.&lt;br /&gt;
&lt;br /&gt;
==Moodle Admin settings==&lt;br /&gt;
* In Moodle 1.7 or later, set the &#039;&#039;&#039;Cache type&#039;&#039;&#039; for your server: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Cache type. There are several options available. &lt;br /&gt;
:*If you do not have eaccelerator or mmemcached installed, choose &amp;quot;internal&amp;quot; (which makes use of the record/internal cache - see the next bullet point). &lt;br /&gt;
:* If you have a single server and have compiled &#039;&#039;&#039;eaccelerator with shared memory support&#039;&#039;&#039;, set the cache type to the eaccelerator option. &lt;br /&gt;
:* If you have a &#039;&#039;&#039;separate memcached server&#039;&#039;&#039;, set the cache type to memcached and enter a csv list of server IP addresses.&lt;br /&gt;
* Enable the &#039;&#039;&#039;record/internal cache&#039;&#039;&#039;: Site Admin -&amp;gt; Server -&amp;gt; Performance -&amp;gt; Record cache = True. Set the maximum amount of memory allocated to the cache in the Int Cache Max box. This will enable a primary cache for database records, without using any database engine cache, e.g. MySQL/PostgreSQL cache. See [http://tracker.moodle.org/browse/MDL-7196 this Tracker entry] for a full discussion.&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting (Admin/Server/Cleanup).&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
* Don&#039;t use database sessions unless you really need them. On-disc sessions tend to be much faster.&lt;br /&gt;
&lt;br /&gt;
==Performance of different Moodle modules==&lt;br /&gt;
&lt;br /&gt;
Moodle&#039;s activity modules, filters, and other plugins can be activated/deactivated. If necessary, you may wish to deactivate some features (such as chat) if not required - but this isn&#039;t necessary. Some notes on the performance of certain modules:&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;Chat&#039;&#039;&#039; module is [http://moodle.org/mod/forum/discuss.php?d=37979&amp;amp;parent=175079 said] to be a hog in terms of frequent HTTP requests to the main server. This can be reduced by setting the module to use &#039;&#039;Streamed&#039;&#039; updates, or, if you&#039;re using a Unix-based webserver, by running the chat in daemon mode. When using the Chat module use the configuration settings to tune for your expected load. Pay particular attention to the &#039;&#039;chat_old_ping&#039;&#039; and &#039;&#039;chat_refresh&#039;&#039; parameters as these can have greatest impact on server load.&lt;br /&gt;
* The &#039;&#039;&#039;Quiz&#039;&#039;&#039; module is known to stretch database performance. Try to optimise your database server by tuning. See [http://moodle.org/mod/forum/discuss.php?d=25616&amp;amp;parent=120770 for a brief report on performance for 55 students simultaneously using quizzes]&lt;br /&gt;
** See this Case Study for an extensive server stress test with 300 quiz users.[http://moodle.org/mod/forum/discuss.php?d=68579]  And this accompanying report on network traffic and server loads. [http://elearning.sgu.ac.jp/doc/PT/]&lt;br /&gt;
* The Moodle &#039;&#039;&#039;Cron&#039;&#039;&#039; task is triggered by calling the script &#039;&#039;cron.php&#039;&#039;. If this is called over HTTP (e.g. using wget or curl) it can take a large amount of memory on large installations. If it is called by directly invoking the php command (e.g. &#039;&#039;php -f /path/to/moodle/directory/admin/cron.php&#039;&#039;) efficiency can be much improved.&lt;br /&gt;
* The &#039;&#039;&#039;Recent activities&#039;&#039;&#039; block is consuming to much resources if you have huge number of records &amp;lt;code&amp;gt;mdl_log&amp;lt;/code&amp;gt;. this is being tested to optimize the SQL query.&lt;br /&gt;
&lt;br /&gt;
==Moodle Image Optimization==&lt;br /&gt;
&lt;br /&gt;
The base images delivered in the original Moodle distribution package provide unoptimized graphics, most of which can benefit from lossless recompression utilizing [http://optipng.sourceforge.net/ optipng] for PNGs, [http://www.lcdf.org/gifsicle/ gifsicle] for GIFs and [http://www.kokkonen.net/tjko/projects.html jpegoptim] for JPGs.  Optimized graphics transfer faster and provide a faster perceived response for clients[http://www.websiteoptimization.com/speed/12/], especially distance learners.  The following example will recursively optimize (without any loss of quality) all the graphics and image files included in a base Moodle installation directory on a server with the above commands installed and available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname *.png -exec optipng -o7 {} \;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname *.gif -exec gifsicle -O2 -b {} \;&lt;br /&gt;
find /example/directory/moodle-1.9 -iname *.jpg -exec jpegoptim -p {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both [http://optipng.sourceforge.net/ optipng] and [http://www.lcdf.org/gifsicle/ gifsicle] are provided in the base repositories of most newer Linux distributions; [http://www.kokkonen.net/tjko/projects.html jpegoptim] must be downloaded and installed manually.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Performance FAQ]]&lt;br /&gt;
*Using Moodle: [http://moodle.org/mod/forum/view.php?f=94 Hardware and Performance] forum&lt;br /&gt;
&lt;br /&gt;
There have been a lot of discussions on moodle.org about performance, here are some of the more interesting and (potentially) useful ones:&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=83057 Performance woes!]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=88927 Comments on planned server hardware]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=102978#p461624 Moodle performance in a pil by Martin Langhoff]&lt;br /&gt;
[[Category:Performance]]&lt;br /&gt;
&lt;br /&gt;
[[es:Rendimiento]]&lt;br /&gt;
[[fr:Performance]]&lt;br /&gt;
[[ja:パフォーマンス]]&lt;br /&gt;
[[pl:Wydajnosc]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Upgrading&amp;diff=70856</id>
		<title>Upgrading</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Upgrading&amp;diff=70856"/>
		<updated>2010-04-09T07:51:09Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Standard install package */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Moodle is designed to upgrade cleanly from one version to the next.  Please refer to [[Upgrading to Moodle 1.6]], [[Upgrading to Moodle 1.8]] or [[Upgrading to Moodle 1.9]]  for particular considerations related to the upgraded version.  &lt;br /&gt;
&lt;br /&gt;
Changes that have been made to the original code, such as installing a contributed module (non-standard module) or a site edit of a php file, may not upgrade. This includes modifications to standard themes that might be overwritten during an upgrade.&lt;br /&gt;
&lt;br /&gt;
* For those using cpanel, you can use [http://ic.eflclasses.org/tutorials/howtoupgrademoodlewithcpanel.swf this tutorial]. It is a bit rough around the edges and is a little dated, but you should get the idea.&lt;br /&gt;
&lt;br /&gt;
* For those who have installed the package version of Moodle using an Ubuntu/Kubuntu/Debian package manager, upgrade instructions can be found [[Ubuntu_Debian_Upgrades|here]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
When upgrading a Moodle installation you should follow these steps:&lt;br /&gt;
&lt;br /&gt;
==Check the requirements==&lt;br /&gt;
Spend some time re-reading the [[Installing Moodle | installation documentation]] and documentation for the new version. Check the system requirements for the target version you want to upgrade-to in &#039;&#039;Administration &amp;gt; Server &amp;gt; [[Environment]]&#039;&#039;.&lt;br /&gt;
==Put your Site into Maintenance Mode==&lt;br /&gt;
Before you begin upgrading your site, you should put it into [[Maintenance_mode | Maintenance Mode]] to stop any non-admin users from logging in.&lt;br /&gt;
&lt;br /&gt;
== Backup important data ==&lt;br /&gt;
There are three areas that need backing up:&lt;br /&gt;
#Moodle software directory/folder (For example, everything in server/htdocs/moodle)&lt;br /&gt;
#Moodle data (For example, server/moodledata)&lt;br /&gt;
#Moodle SQL database&lt;br /&gt;
&lt;br /&gt;
Experienced site administrators know that it is a best practice (a very good idea) to make a backup of any production system before a major upgrade. In fact, it is a good idea to automate your server to backup your Moodle installation daily.  Most upgrades on sites that have used the standard Moodle packages (no contributed code and no little tweaks to the php files), will not have any major issue.  &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; One more time, &amp;quot;do not risk what you can not afford to lose&amp;quot;: do regular backups, make sure it backed up and know how to restore it! &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Moodle software directory ===&lt;br /&gt;
Make a separate copy of these files before the upgrade, so that you can retrieve your config.php and any modules you have added like themes, and languages.&lt;br /&gt;
&lt;br /&gt;
The best way is to rename the current Moodle directory to something else, then unpack the new Moodle archive into the old location.&lt;br /&gt;
&lt;br /&gt;
=== Moodle data directory ===&lt;br /&gt;
The default name for this folder is moodledata. This is where uploaded content resides (such as course resources and student assignments). It is very important to have a backup of these files on a regular basis as a best practice. Sometimes upgrades may move or rename directories within your data directory. &lt;br /&gt;
&lt;br /&gt;
In Linux you can use the cp (copy) command to make a temporary copy of the moodledata. example:&lt;br /&gt;
====Linux====&lt;br /&gt;
 mkdir /var/moodledata_backup&lt;br /&gt;
 cp -rv /var/moodledata/* /var/moodledata_backup&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== SQL database ===&lt;br /&gt;
Most Moodle upgrades will alter the SQL database tables, adding or changing fields. Each SQL server program (for example,MySQL, Postgresql, Oracle) has different ways to backup. In a MySQL server, one way of backing up is to &#039;dump&#039; it to a single SQL file. The following example shows Unix commands to dump the database called &amp;quot;moodle&amp;quot;: &lt;br /&gt;
&lt;br /&gt;
 mysqldump -u username -p -C -Q -e --create-options moodle &amp;gt; moodle-backup-2007-04-01.sql&lt;br /&gt;
&lt;br /&gt;
Substitute your database user account for username. The -p flag will prompt you for the password for the username specified by -u.&lt;br /&gt;
&lt;br /&gt;
If your database host is different from the host you want to execute the backup command (usually the web server), you have to specify it with the -h option to mysqldump:&lt;br /&gt;
&lt;br /&gt;
 mysqldump -u username -p -h databasehost -C -Q -e --create-options moodle &amp;gt; moodle-backup-2007-04-01.sql &lt;br /&gt;
&lt;br /&gt;
You can also use the &amp;quot;Export&amp;quot; feature in Moodle&#039;s optional &amp;quot;MySQL Admin&amp;quot; web interface to do the same thing on all platforms. In Moodle v1.9 and greater, this is located in &#039;&#039;&#039;Site Administration&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Server&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Database&#039;&#039;&#039;. This interface can also be downloaded from http://moodle.org/mod/data/view.php?d=13&amp;amp;rid=448. It is an integration of PHPMyAdmin for the Moodle administration interface.&lt;br /&gt;
&lt;br /&gt;
==== SQL dump caveats ====&lt;br /&gt;
There are a &#039;&#039;&#039;MANY&#039;&#039;&#039; options possible for mysqldump. &lt;br /&gt;
*Please talk with your Systems Administrator (if you have one) or similar to see if there are site-specific flags you should use for your SQL dump.&lt;br /&gt;
** For example, if your local installation is running MySQL 5.2 and you are moving to a system running MySQL 5.0 or 4.1, you really ought to use the &amp;quot;--compat=mysql40&amp;quot; flag. (This is not too uncommon of a situation given the nature of ISP hosting as compared to local user Moodle setups)&lt;br /&gt;
* This seems obvious, but should be said outright: These instructions only work for dumping from MySQL! Postgresql, Oracle, and other database servers have different tools to dump databases.&lt;br /&gt;
* Given the example mysql import lines, above, you really should use the --no-create-db flag. If your database locally is named something differently from the migration site, not including this flag could cause problems.&lt;br /&gt;
&lt;br /&gt;
== Install the new Moodle software ==&lt;br /&gt;
Upgrading can be a simple process or a more complicated process.  Sites that have not used contributed code and are migrating from say Moodle 1.x.1 to 1.x.3 &#039;&#039;&#039;should&#039;&#039;&#039; not have a problem.  However, we still recommend that with any production server that you have made a successful backup of the MySQL database, the moodledata directory and the moodle program folders and files.  &lt;br /&gt;
&lt;br /&gt;
*Do not overwrite an old installation unless you know what you are doing ... sometimes old files can cause problems in new installations. Review the backup section above.&lt;br /&gt;
&lt;br /&gt;
=== Standard install package ===&lt;br /&gt;
Having read the cautions about backups, download a copy of the standard install package. Here is a set of simple instructions for an average site.&lt;br /&gt;
*It is probably a good idea to use the site administration block&amp;gt;Server&amp;gt;Maintenance mode to prevent user activity as the site upgrades. &lt;br /&gt;
*Having moved your old Moodle software program files to another location, unzip or unpack the upgrade file so that all new the Moodle software program files are in the location the old files used to be in on the server.  Moodle will adjust SQL and moodledata if it needs to in the upgrade.&lt;br /&gt;
*Use the notification link in the site administration to start the upgrade process. You will see a series of lines indicating progress.  &lt;br /&gt;
*Copy your old config.php file back to the new Moodle directory, along with any custom themes, blocks or files you have in your old version.&lt;br /&gt;
*After a successful upgrade, turn off the maintenance mode for your users.&lt;br /&gt;
&lt;br /&gt;
=== Using a downloaded archive ===&lt;br /&gt;
*Do not overwrite an old installation unless you know what you are doing ... sometimes old files can cause problems in new installations. The best way is to rename the current Moodle directory to something else, then unpack the new Moodle archive into the old location.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
 mv moodle moodle.backup&lt;br /&gt;
 tar xvzf moodle-1.1.tgz&lt;br /&gt;
&lt;br /&gt;
Next, copy across your config.php, any other plugins such as custom themes, and your .htaccess file if you created one:&lt;br /&gt;
&lt;br /&gt;
 cp moodle.backup/config.php moodle&lt;br /&gt;
 cp -pr moodle.backup/theme/mytheme moodle/theme/mytheme&lt;br /&gt;
 cp -pr moodle.backup/mod/mymod moodle/mod/mymod&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to &lt;br /&gt;
&lt;br /&gt;
 sudo chown www-data moodle/config.php&lt;br /&gt;
&lt;br /&gt;
if necessary.&lt;br /&gt;
&lt;br /&gt;
where www-data is whatever user the Apache user is on your system. This is often &#039;apache&#039; or &#039;www&#039;.&lt;br /&gt;
You can find out by doing &#039;ls -l&#039; in your /var/www/moodle folder (or wherever your moodle site is)&lt;br /&gt;
and then looking at the owner and group.&lt;br /&gt;
&lt;br /&gt;
so you may see something like&lt;br /&gt;
&lt;br /&gt;
 ls -l&lt;br /&gt;
 ...lots of lines...&lt;br /&gt;
 -rw-r--r--   1 apache system     784 Jun 28  2007 config.php &lt;br /&gt;
 ...lots more lines...&lt;br /&gt;
&lt;br /&gt;
so the owner is apache and the group is system. &lt;br /&gt;
&lt;br /&gt;
To replicate this on your new system you can do  &#039;chown apache:system config.php&#039; &lt;br /&gt;
&lt;br /&gt;
or to do a whole group do&lt;br /&gt;
&lt;br /&gt;
 chown apache:system ./*&lt;br /&gt;
&lt;br /&gt;
and recursively&lt;br /&gt;
&lt;br /&gt;
 chown -R apache:system ./*&lt;br /&gt;
&lt;br /&gt;
=== Using CVS ===&lt;br /&gt;
&lt;br /&gt;
You can use CVS for updating or upgrading your Moodle.&lt;br /&gt;
First you need to do a CVS checkout in your (empty) Moodle root directory.&lt;br /&gt;
&lt;br /&gt;
You can use any of our [[CVS_for_Administrators#CVS_Servers|CVS Mirror servers]]. Just replace &#039;&#039;&#039;SERVER.cvs.moodle.org&#039;&#039;&#039; in the instructions below with the name of the mirror server you chose!.&lt;br /&gt;
&lt;br /&gt;
====For Linux servers====&lt;br /&gt;
&lt;br /&gt;
To do a CVS checkout of Moodle, you first have to logon to the Moodle CVS server.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;cvs -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle login&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  No password for anonymous, so just hit the Enter button.&lt;br /&gt;
&lt;br /&gt;
Go to the directory where you want the Moodle root to come and type&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;cvs -z3 -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle co -r MOODLE_18_STABLE moodle&amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  (where MOODLE_18_STABLE is the desired version)&lt;br /&gt;
&lt;br /&gt;
To update, just go into the Moodle root directory and update to the new files:&lt;br /&gt;
&lt;br /&gt;
  cvs update -dP&lt;br /&gt;
To update to a new version type in the following and change 18 to whatever newest version upgrade number is&lt;br /&gt;
  cvs -Q update -dP -r MOODLE_18_STABLE&lt;br /&gt;
&lt;br /&gt;
Make sure you use the &amp;quot;d&amp;quot; parameter to create new directories if necessary, and the &amp;quot;P&amp;quot; parameter to prune empty directories.&lt;br /&gt;
&lt;br /&gt;
====For Windows servers====&lt;br /&gt;
&lt;br /&gt;
You can use Tortoise CVS to do the initial checkout and the updates.&lt;br /&gt;
&lt;br /&gt;
If you have been editing Moodle files, watch the messages very closely for possible conflicts. All your customised themes and non-standard plugins will be untouched.&lt;br /&gt;
&lt;br /&gt;
Do not forget to trigger the install process in the site administration block (see below).&lt;br /&gt;
&lt;br /&gt;
== Finishing the upgrade ==&lt;br /&gt;
&lt;br /&gt;
The last step is to trigger the upgrade processes within Moodle. &lt;br /&gt;
&lt;br /&gt;
To do this just visit the site administration block admin page (or &#039;&#039;&amp;lt;nowiki&amp;gt;http://example.com/moodle/admin&amp;lt;/nowiki&amp;gt;&#039;&#039;) and the &amp;quot;Notifications&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
Moodle will automatically detect the new version and perform all the SQL database or file system upgrades that are necessary. If there is anything it can&#039;t do itself (very rare) then you will see messages telling you what you need to do.&lt;br /&gt;
&lt;br /&gt;
Assuming all goes well (no error messages) then you can start using your new version of Moodle and enjoy the new features!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; Use the site administration block&amp;gt;Server&amp;gt;Maintenance mode to prevent users from changing data during the upgrade.&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; If you are running a large scale Moodle site (e.g. have more tha 10,000+ courses and 40,000+ users), make sure that you do your own performance profiling testing.  Post a thread or check the [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum] and check [[Tracker]] for potential issues.&lt;br /&gt;
&lt;br /&gt;
== Verify the upgrade (optional) ==&lt;br /&gt;
&lt;br /&gt;
If you wish to confirm that the database definitions in the upgraded database match the definitions of a new, clean install (which they should) you might like to look at [[Verify Database Schema]].&lt;br /&gt;
&lt;br /&gt;
==Upgrading more than one version==&lt;br /&gt;
&lt;br /&gt;
In general, it is recommended to upgrade via each version of Moodle, for example 1.7 -&amp;gt; 1.9. An exception to this is when upgrading from 1.5 or 1.6, when it is recommended that 1.7 and 1.8 are skipped, in other words upgrade 1.5 -&amp;gt; 1.6 -&amp;gt; 1.9. (The main reason for this recommendation is that the default roles settings obtained when upgrading to 1.7 are not ideal for 1.8 onwards, 1.8 has problems with groups, etc.)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Installing Moodle]]&lt;br /&gt;
*[[Installation FAQ]]&lt;br /&gt;
*[[Upgrading to Moodle 1.6]]&lt;br /&gt;
*[[Upgrading to Moodle 1.8]]&lt;br /&gt;
*[[Upgrading to Moodle 1.9]]&lt;br /&gt;
*[[Upgrading to Moodle 2.0]]&lt;br /&gt;
*[[Environment]]&lt;br /&gt;
*[[Git]] Version control and upgrading&lt;br /&gt;
*Moodle.org [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum] &lt;br /&gt;
*[http://ic.eflclasses.org/tutorials/howtoupgrademoodlewithcpanel.swf How to upgrade Moodle with cpanel tutorial] - screencasts of older Moodle/Cpanel install but useful (also, a very large file that will take some time to load).&lt;br /&gt;
&lt;br /&gt;
Using Moodle.org forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=26731&amp;amp;parent=125858 Using cvs]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=56915 Upgrading from 1.5.2 to 1.7]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=56991 Upgrade nightmares.... any help appreciated]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=62463 After upgrading i get &amp;quot;Your site may not be secure.&amp;quot; msg]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=104887 Best practices for QA]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:Actualización de moodle]]&lt;br /&gt;
[[fr:Mise à jour]]&lt;br /&gt;
[[ja:アップグレード]]&lt;br /&gt;
[[nl:Upgraden]]&lt;br /&gt;
[[zh:升级]]&lt;br /&gt;
[[pl:Aktualizacja]]&lt;br /&gt;
[[de:Aktualisierung von Moodle]]&lt;br /&gt;
[[ru:Обновление]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Upgrading&amp;diff=70855</id>
		<title>Upgrading</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Upgrading&amp;diff=70855"/>
		<updated>2010-04-09T07:42:41Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Put your Site into Maintenance Mode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Moodle is designed to upgrade cleanly from one version to the next.  Please refer to [[Upgrading to Moodle 1.6]], [[Upgrading to Moodle 1.8]] or [[Upgrading to Moodle 1.9]]  for particular considerations related to the upgraded version.  &lt;br /&gt;
&lt;br /&gt;
Changes that have been made to the original code, such as installing a contributed module (non-standard module) or a site edit of a php file, may not upgrade. This includes modifications to standard themes that might be overwritten during an upgrade.&lt;br /&gt;
&lt;br /&gt;
* For those using cpanel, you can use [http://ic.eflclasses.org/tutorials/howtoupgrademoodlewithcpanel.swf this tutorial]. It is a bit rough around the edges and is a little dated, but you should get the idea.&lt;br /&gt;
&lt;br /&gt;
* For those who have installed the package version of Moodle using an Ubuntu/Kubuntu/Debian package manager, upgrade instructions can be found [[Ubuntu_Debian_Upgrades|here]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
When upgrading a Moodle installation you should follow these steps:&lt;br /&gt;
&lt;br /&gt;
==Check the requirements==&lt;br /&gt;
Spend some time re-reading the [[Installing Moodle | installation documentation]] and documentation for the new version. Check the system requirements for the target version you want to upgrade-to in &#039;&#039;Administration &amp;gt; Server &amp;gt; [[Environment]]&#039;&#039;.&lt;br /&gt;
==Put your Site into Maintenance Mode==&lt;br /&gt;
Before you begin upgrading your site, you should put it into [[Maintenance_mode | Maintenance Mode]] to stop any non-admin users from logging in.&lt;br /&gt;
&lt;br /&gt;
== Backup important data ==&lt;br /&gt;
There are three areas that need backing up:&lt;br /&gt;
#Moodle software directory/folder (For example, everything in server/htdocs/moodle)&lt;br /&gt;
#Moodle data (For example, server/moodledata)&lt;br /&gt;
#Moodle SQL database&lt;br /&gt;
&lt;br /&gt;
Experienced site administrators know that it is a best practice (a very good idea) to make a backup of any production system before a major upgrade. In fact, it is a good idea to automate your server to backup your Moodle installation daily.  Most upgrades on sites that have used the standard Moodle packages (no contributed code and no little tweaks to the php files), will not have any major issue.  &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; One more time, &amp;quot;do not risk what you can not afford to lose&amp;quot;: do regular backups, make sure it backed up and know how to restore it! &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Moodle software directory ===&lt;br /&gt;
Make a separate copy of these files before the upgrade, so that you can retrieve your config.php and any modules you have added like themes, and languages.&lt;br /&gt;
&lt;br /&gt;
The best way is to rename the current Moodle directory to something else, then unpack the new Moodle archive into the old location.&lt;br /&gt;
&lt;br /&gt;
=== Moodle data directory ===&lt;br /&gt;
The default name for this folder is moodledata. This is where uploaded content resides (such as course resources and student assignments). It is very important to have a backup of these files on a regular basis as a best practice. Sometimes upgrades may move or rename directories within your data directory. &lt;br /&gt;
&lt;br /&gt;
In Linux you can use the cp (copy) command to make a temporary copy of the moodledata. example:&lt;br /&gt;
====Linux====&lt;br /&gt;
 mkdir /var/moodledata_backup&lt;br /&gt;
 cp -rv /var/moodledata/* /var/moodledata_backup&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== SQL database ===&lt;br /&gt;
Most Moodle upgrades will alter the SQL database tables, adding or changing fields. Each SQL server program (for example,MySQL, Postgresql, Oracle) has different ways to backup. In a MySQL server, one way of backing up is to &#039;dump&#039; it to a single SQL file. The following example shows Unix commands to dump the database called &amp;quot;moodle&amp;quot;: &lt;br /&gt;
&lt;br /&gt;
 mysqldump -u username -p -C -Q -e --create-options moodle &amp;gt; moodle-backup-2007-04-01.sql&lt;br /&gt;
&lt;br /&gt;
Substitute your database user account for username. The -p flag will prompt you for the password for the username specified by -u.&lt;br /&gt;
&lt;br /&gt;
If your database host is different from the host you want to execute the backup command (usually the web server), you have to specify it with the -h option to mysqldump:&lt;br /&gt;
&lt;br /&gt;
 mysqldump -u username -p -h databasehost -C -Q -e --create-options moodle &amp;gt; moodle-backup-2007-04-01.sql &lt;br /&gt;
&lt;br /&gt;
You can also use the &amp;quot;Export&amp;quot; feature in Moodle&#039;s optional &amp;quot;MySQL Admin&amp;quot; web interface to do the same thing on all platforms. In Moodle v1.9 and greater, this is located in &#039;&#039;&#039;Site Administration&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Server&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Database&#039;&#039;&#039;. This interface can also be downloaded from http://moodle.org/mod/data/view.php?d=13&amp;amp;rid=448. It is an integration of PHPMyAdmin for the Moodle administration interface.&lt;br /&gt;
&lt;br /&gt;
==== SQL dump caveats ====&lt;br /&gt;
There are a &#039;&#039;&#039;MANY&#039;&#039;&#039; options possible for mysqldump. &lt;br /&gt;
*Please talk with your Systems Administrator (if you have one) or similar to see if there are site-specific flags you should use for your SQL dump.&lt;br /&gt;
** For example, if your local installation is running MySQL 5.2 and you are moving to a system running MySQL 5.0 or 4.1, you really ought to use the &amp;quot;--compat=mysql40&amp;quot; flag. (This is not too uncommon of a situation given the nature of ISP hosting as compared to local user Moodle setups)&lt;br /&gt;
* This seems obvious, but should be said outright: These instructions only work for dumping from MySQL! Postgresql, Oracle, and other database servers have different tools to dump databases.&lt;br /&gt;
* Given the example mysql import lines, above, you really should use the --no-create-db flag. If your database locally is named something differently from the migration site, not including this flag could cause problems.&lt;br /&gt;
&lt;br /&gt;
== Install the new Moodle software ==&lt;br /&gt;
Upgrading can be a simple process or a more complicated process.  Sites that have not used contributed code and are migrating from say Moodle 1.x.1 to 1.x.3 &#039;&#039;&#039;should&#039;&#039;&#039; not have a problem.  However, we still recommend that with any production server that you have made a successful backup of the MySQL database, the moodledata directory and the moodle program folders and files.  &lt;br /&gt;
&lt;br /&gt;
*Do not overwrite an old installation unless you know what you are doing ... sometimes old files can cause problems in new installations. Review the backup section above.&lt;br /&gt;
&lt;br /&gt;
=== Standard install package ===&lt;br /&gt;
Having read the cautions about backups, download a copy of the standard install package. Here is a set of simple instructions for an average site.&lt;br /&gt;
*It is probably a good idea to use the site administration block&amp;gt;Server&amp;gt;Maintenance mode to prevent user activity as the site upgrades. &lt;br /&gt;
*Unzip or unpack the upgrade file so that all the Moodle software program files are overwritten on the server.  Moodle will adjust SQL and moodledata if it needs to in the upgrade.&lt;br /&gt;
*Use the notification link in the site administration to start the upgrade process. You will see a series of lines indicating progress.  &lt;br /&gt;
*After a successful upgrade, turn off the maintenance mode for your users.&lt;br /&gt;
&lt;br /&gt;
=== Using a downloaded archive ===&lt;br /&gt;
*Do not overwrite an old installation unless you know what you are doing ... sometimes old files can cause problems in new installations. The best way is to rename the current Moodle directory to something else, then unpack the new Moodle archive into the old location.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
 mv moodle moodle.backup&lt;br /&gt;
 tar xvzf moodle-1.1.tgz&lt;br /&gt;
&lt;br /&gt;
Next, copy across your config.php, any other plugins such as custom themes, and your .htaccess file if you created one:&lt;br /&gt;
&lt;br /&gt;
 cp moodle.backup/config.php moodle&lt;br /&gt;
 cp -pr moodle.backup/theme/mytheme moodle/theme/mytheme&lt;br /&gt;
 cp -pr moodle.backup/mod/mymod moodle/mod/mymod&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to &lt;br /&gt;
&lt;br /&gt;
 sudo chown www-data moodle/config.php&lt;br /&gt;
&lt;br /&gt;
if necessary.&lt;br /&gt;
&lt;br /&gt;
where www-data is whatever user the Apache user is on your system. This is often &#039;apache&#039; or &#039;www&#039;.&lt;br /&gt;
You can find out by doing &#039;ls -l&#039; in your /var/www/moodle folder (or wherever your moodle site is)&lt;br /&gt;
and then looking at the owner and group.&lt;br /&gt;
&lt;br /&gt;
so you may see something like&lt;br /&gt;
&lt;br /&gt;
 ls -l&lt;br /&gt;
 ...lots of lines...&lt;br /&gt;
 -rw-r--r--   1 apache system     784 Jun 28  2007 config.php &lt;br /&gt;
 ...lots more lines...&lt;br /&gt;
&lt;br /&gt;
so the owner is apache and the group is system. &lt;br /&gt;
&lt;br /&gt;
To replicate this on your new system you can do  &#039;chown apache:system config.php&#039; &lt;br /&gt;
&lt;br /&gt;
or to do a whole group do&lt;br /&gt;
&lt;br /&gt;
 chown apache:system ./*&lt;br /&gt;
&lt;br /&gt;
and recursively&lt;br /&gt;
&lt;br /&gt;
 chown -R apache:system ./*&lt;br /&gt;
&lt;br /&gt;
=== Using CVS ===&lt;br /&gt;
&lt;br /&gt;
You can use CVS for updating or upgrading your Moodle.&lt;br /&gt;
First you need to do a CVS checkout in your (empty) Moodle root directory.&lt;br /&gt;
&lt;br /&gt;
You can use any of our [[CVS_for_Administrators#CVS_Servers|CVS Mirror servers]]. Just replace &#039;&#039;&#039;SERVER.cvs.moodle.org&#039;&#039;&#039; in the instructions below with the name of the mirror server you chose!.&lt;br /&gt;
&lt;br /&gt;
====For Linux servers====&lt;br /&gt;
&lt;br /&gt;
To do a CVS checkout of Moodle, you first have to logon to the Moodle CVS server.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;cvs -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle login&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  No password for anonymous, so just hit the Enter button.&lt;br /&gt;
&lt;br /&gt;
Go to the directory where you want the Moodle root to come and type&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;cvs -z3 -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle co -r MOODLE_18_STABLE moodle&amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  (where MOODLE_18_STABLE is the desired version)&lt;br /&gt;
&lt;br /&gt;
To update, just go into the Moodle root directory and update to the new files:&lt;br /&gt;
&lt;br /&gt;
  cvs update -dP&lt;br /&gt;
To update to a new version type in the following and change 18 to whatever newest version upgrade number is&lt;br /&gt;
  cvs -Q update -dP -r MOODLE_18_STABLE&lt;br /&gt;
&lt;br /&gt;
Make sure you use the &amp;quot;d&amp;quot; parameter to create new directories if necessary, and the &amp;quot;P&amp;quot; parameter to prune empty directories.&lt;br /&gt;
&lt;br /&gt;
====For Windows servers====&lt;br /&gt;
&lt;br /&gt;
You can use Tortoise CVS to do the initial checkout and the updates.&lt;br /&gt;
&lt;br /&gt;
If you have been editing Moodle files, watch the messages very closely for possible conflicts. All your customised themes and non-standard plugins will be untouched.&lt;br /&gt;
&lt;br /&gt;
Do not forget to trigger the install process in the site administration block (see below).&lt;br /&gt;
&lt;br /&gt;
== Finishing the upgrade ==&lt;br /&gt;
&lt;br /&gt;
The last step is to trigger the upgrade processes within Moodle. &lt;br /&gt;
&lt;br /&gt;
To do this just visit the site administration block admin page (or &#039;&#039;&amp;lt;nowiki&amp;gt;http://example.com/moodle/admin&amp;lt;/nowiki&amp;gt;&#039;&#039;) and the &amp;quot;Notifications&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
Moodle will automatically detect the new version and perform all the SQL database or file system upgrades that are necessary. If there is anything it can&#039;t do itself (very rare) then you will see messages telling you what you need to do.&lt;br /&gt;
&lt;br /&gt;
Assuming all goes well (no error messages) then you can start using your new version of Moodle and enjoy the new features!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; Use the site administration block&amp;gt;Server&amp;gt;Maintenance mode to prevent users from changing data during the upgrade.&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; If you are running a large scale Moodle site (e.g. have more tha 10,000+ courses and 40,000+ users), make sure that you do your own performance profiling testing.  Post a thread or check the [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum] and check [[Tracker]] for potential issues.&lt;br /&gt;
&lt;br /&gt;
== Verify the upgrade (optional) ==&lt;br /&gt;
&lt;br /&gt;
If you wish to confirm that the database definitions in the upgraded database match the definitions of a new, clean install (which they should) you might like to look at [[Verify Database Schema]].&lt;br /&gt;
&lt;br /&gt;
==Upgrading more than one version==&lt;br /&gt;
&lt;br /&gt;
In general, it is recommended to upgrade via each version of Moodle, for example 1.7 -&amp;gt; 1.9. An exception to this is when upgrading from 1.5 or 1.6, when it is recommended that 1.7 and 1.8 are skipped, in other words upgrade 1.5 -&amp;gt; 1.6 -&amp;gt; 1.9. (The main reason for this recommendation is that the default roles settings obtained when upgrading to 1.7 are not ideal for 1.8 onwards, 1.8 has problems with groups, etc.)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Installing Moodle]]&lt;br /&gt;
*[[Installation FAQ]]&lt;br /&gt;
*[[Upgrading to Moodle 1.6]]&lt;br /&gt;
*[[Upgrading to Moodle 1.8]]&lt;br /&gt;
*[[Upgrading to Moodle 1.9]]&lt;br /&gt;
*[[Upgrading to Moodle 2.0]]&lt;br /&gt;
*[[Environment]]&lt;br /&gt;
*[[Git]] Version control and upgrading&lt;br /&gt;
*Moodle.org [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum] &lt;br /&gt;
*[http://ic.eflclasses.org/tutorials/howtoupgrademoodlewithcpanel.swf How to upgrade Moodle with cpanel tutorial] - screencasts of older Moodle/Cpanel install but useful (also, a very large file that will take some time to load).&lt;br /&gt;
&lt;br /&gt;
Using Moodle.org forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=26731&amp;amp;parent=125858 Using cvs]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=56915 Upgrading from 1.5.2 to 1.7]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=56991 Upgrade nightmares.... any help appreciated]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=62463 After upgrading i get &amp;quot;Your site may not be secure.&amp;quot; msg]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=104887 Best practices for QA]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:Actualización de moodle]]&lt;br /&gt;
[[fr:Mise à jour]]&lt;br /&gt;
[[ja:アップグレード]]&lt;br /&gt;
[[nl:Upgraden]]&lt;br /&gt;
[[zh:升级]]&lt;br /&gt;
[[pl:Aktualizacja]]&lt;br /&gt;
[[de:Aktualisierung von Moodle]]&lt;br /&gt;
[[ru:Обновление]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Upgrading&amp;diff=70854</id>
		<title>Upgrading</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Upgrading&amp;diff=70854"/>
		<updated>2010-04-09T07:41:23Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Check the requirements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Moodle is designed to upgrade cleanly from one version to the next.  Please refer to [[Upgrading to Moodle 1.6]], [[Upgrading to Moodle 1.8]] or [[Upgrading to Moodle 1.9]]  for particular considerations related to the upgraded version.  &lt;br /&gt;
&lt;br /&gt;
Changes that have been made to the original code, such as installing a contributed module (non-standard module) or a site edit of a php file, may not upgrade. This includes modifications to standard themes that might be overwritten during an upgrade.&lt;br /&gt;
&lt;br /&gt;
* For those using cpanel, you can use [http://ic.eflclasses.org/tutorials/howtoupgrademoodlewithcpanel.swf this tutorial]. It is a bit rough around the edges and is a little dated, but you should get the idea.&lt;br /&gt;
&lt;br /&gt;
* For those who have installed the package version of Moodle using an Ubuntu/Kubuntu/Debian package manager, upgrade instructions can be found [[Ubuntu_Debian_Upgrades|here]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
When upgrading a Moodle installation you should follow these steps:&lt;br /&gt;
&lt;br /&gt;
==Check the requirements==&lt;br /&gt;
Spend some time re-reading the [[Installing Moodle | installation documentation]] and documentation for the new version. Check the system requirements for the target version you want to upgrade-to in &#039;&#039;Administration &amp;gt; Server &amp;gt; [[Environment]]&#039;&#039;.&lt;br /&gt;
==Put your Site into Maintenance Mode==&lt;br /&gt;
Before you begin upgrading your site, you should put it into maintenance mode to stop any non-admin users from logging in.&lt;br /&gt;
&lt;br /&gt;
== Backup important data ==&lt;br /&gt;
There are three areas that need backing up:&lt;br /&gt;
#Moodle software directory/folder (For example, everything in server/htdocs/moodle)&lt;br /&gt;
#Moodle data (For example, server/moodledata)&lt;br /&gt;
#Moodle SQL database&lt;br /&gt;
&lt;br /&gt;
Experienced site administrators know that it is a best practice (a very good idea) to make a backup of any production system before a major upgrade. In fact, it is a good idea to automate your server to backup your Moodle installation daily.  Most upgrades on sites that have used the standard Moodle packages (no contributed code and no little tweaks to the php files), will not have any major issue.  &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; One more time, &amp;quot;do not risk what you can not afford to lose&amp;quot;: do regular backups, make sure it backed up and know how to restore it! &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Moodle software directory ===&lt;br /&gt;
Make a separate copy of these files before the upgrade, so that you can retrieve your config.php and any modules you have added like themes, and languages.&lt;br /&gt;
&lt;br /&gt;
The best way is to rename the current Moodle directory to something else, then unpack the new Moodle archive into the old location.&lt;br /&gt;
&lt;br /&gt;
=== Moodle data directory ===&lt;br /&gt;
The default name for this folder is moodledata. This is where uploaded content resides (such as course resources and student assignments). It is very important to have a backup of these files on a regular basis as a best practice. Sometimes upgrades may move or rename directories within your data directory. &lt;br /&gt;
&lt;br /&gt;
In Linux you can use the cp (copy) command to make a temporary copy of the moodledata. example:&lt;br /&gt;
====Linux====&lt;br /&gt;
 mkdir /var/moodledata_backup&lt;br /&gt;
 cp -rv /var/moodledata/* /var/moodledata_backup&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== SQL database ===&lt;br /&gt;
Most Moodle upgrades will alter the SQL database tables, adding or changing fields. Each SQL server program (for example,MySQL, Postgresql, Oracle) has different ways to backup. In a MySQL server, one way of backing up is to &#039;dump&#039; it to a single SQL file. The following example shows Unix commands to dump the database called &amp;quot;moodle&amp;quot;: &lt;br /&gt;
&lt;br /&gt;
 mysqldump -u username -p -C -Q -e --create-options moodle &amp;gt; moodle-backup-2007-04-01.sql&lt;br /&gt;
&lt;br /&gt;
Substitute your database user account for username. The -p flag will prompt you for the password for the username specified by -u.&lt;br /&gt;
&lt;br /&gt;
If your database host is different from the host you want to execute the backup command (usually the web server), you have to specify it with the -h option to mysqldump:&lt;br /&gt;
&lt;br /&gt;
 mysqldump -u username -p -h databasehost -C -Q -e --create-options moodle &amp;gt; moodle-backup-2007-04-01.sql &lt;br /&gt;
&lt;br /&gt;
You can also use the &amp;quot;Export&amp;quot; feature in Moodle&#039;s optional &amp;quot;MySQL Admin&amp;quot; web interface to do the same thing on all platforms. In Moodle v1.9 and greater, this is located in &#039;&#039;&#039;Site Administration&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Server&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Database&#039;&#039;&#039;. This interface can also be downloaded from http://moodle.org/mod/data/view.php?d=13&amp;amp;rid=448. It is an integration of PHPMyAdmin for the Moodle administration interface.&lt;br /&gt;
&lt;br /&gt;
==== SQL dump caveats ====&lt;br /&gt;
There are a &#039;&#039;&#039;MANY&#039;&#039;&#039; options possible for mysqldump. &lt;br /&gt;
*Please talk with your Systems Administrator (if you have one) or similar to see if there are site-specific flags you should use for your SQL dump.&lt;br /&gt;
** For example, if your local installation is running MySQL 5.2 and you are moving to a system running MySQL 5.0 or 4.1, you really ought to use the &amp;quot;--compat=mysql40&amp;quot; flag. (This is not too uncommon of a situation given the nature of ISP hosting as compared to local user Moodle setups)&lt;br /&gt;
* This seems obvious, but should be said outright: These instructions only work for dumping from MySQL! Postgresql, Oracle, and other database servers have different tools to dump databases.&lt;br /&gt;
* Given the example mysql import lines, above, you really should use the --no-create-db flag. If your database locally is named something differently from the migration site, not including this flag could cause problems.&lt;br /&gt;
&lt;br /&gt;
== Install the new Moodle software ==&lt;br /&gt;
Upgrading can be a simple process or a more complicated process.  Sites that have not used contributed code and are migrating from say Moodle 1.x.1 to 1.x.3 &#039;&#039;&#039;should&#039;&#039;&#039; not have a problem.  However, we still recommend that with any production server that you have made a successful backup of the MySQL database, the moodledata directory and the moodle program folders and files.  &lt;br /&gt;
&lt;br /&gt;
*Do not overwrite an old installation unless you know what you are doing ... sometimes old files can cause problems in new installations. Review the backup section above.&lt;br /&gt;
&lt;br /&gt;
=== Standard install package ===&lt;br /&gt;
Having read the cautions about backups, download a copy of the standard install package. Here is a set of simple instructions for an average site.&lt;br /&gt;
*It is probably a good idea to use the site administration block&amp;gt;Server&amp;gt;Maintenance mode to prevent user activity as the site upgrades. &lt;br /&gt;
*Unzip or unpack the upgrade file so that all the Moodle software program files are overwritten on the server.  Moodle will adjust SQL and moodledata if it needs to in the upgrade.&lt;br /&gt;
*Use the notification link in the site administration to start the upgrade process. You will see a series of lines indicating progress.  &lt;br /&gt;
*After a successful upgrade, turn off the maintenance mode for your users.&lt;br /&gt;
&lt;br /&gt;
=== Using a downloaded archive ===&lt;br /&gt;
*Do not overwrite an old installation unless you know what you are doing ... sometimes old files can cause problems in new installations. The best way is to rename the current Moodle directory to something else, then unpack the new Moodle archive into the old location.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
 mv moodle moodle.backup&lt;br /&gt;
 tar xvzf moodle-1.1.tgz&lt;br /&gt;
&lt;br /&gt;
Next, copy across your config.php, any other plugins such as custom themes, and your .htaccess file if you created one:&lt;br /&gt;
&lt;br /&gt;
 cp moodle.backup/config.php moodle&lt;br /&gt;
 cp -pr moodle.backup/theme/mytheme moodle/theme/mytheme&lt;br /&gt;
 cp -pr moodle.backup/mod/mymod moodle/mod/mymod&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to &lt;br /&gt;
&lt;br /&gt;
 sudo chown www-data moodle/config.php&lt;br /&gt;
&lt;br /&gt;
if necessary.&lt;br /&gt;
&lt;br /&gt;
where www-data is whatever user the Apache user is on your system. This is often &#039;apache&#039; or &#039;www&#039;.&lt;br /&gt;
You can find out by doing &#039;ls -l&#039; in your /var/www/moodle folder (or wherever your moodle site is)&lt;br /&gt;
and then looking at the owner and group.&lt;br /&gt;
&lt;br /&gt;
so you may see something like&lt;br /&gt;
&lt;br /&gt;
 ls -l&lt;br /&gt;
 ...lots of lines...&lt;br /&gt;
 -rw-r--r--   1 apache system     784 Jun 28  2007 config.php &lt;br /&gt;
 ...lots more lines...&lt;br /&gt;
&lt;br /&gt;
so the owner is apache and the group is system. &lt;br /&gt;
&lt;br /&gt;
To replicate this on your new system you can do  &#039;chown apache:system config.php&#039; &lt;br /&gt;
&lt;br /&gt;
or to do a whole group do&lt;br /&gt;
&lt;br /&gt;
 chown apache:system ./*&lt;br /&gt;
&lt;br /&gt;
and recursively&lt;br /&gt;
&lt;br /&gt;
 chown -R apache:system ./*&lt;br /&gt;
&lt;br /&gt;
=== Using CVS ===&lt;br /&gt;
&lt;br /&gt;
You can use CVS for updating or upgrading your Moodle.&lt;br /&gt;
First you need to do a CVS checkout in your (empty) Moodle root directory.&lt;br /&gt;
&lt;br /&gt;
You can use any of our [[CVS_for_Administrators#CVS_Servers|CVS Mirror servers]]. Just replace &#039;&#039;&#039;SERVER.cvs.moodle.org&#039;&#039;&#039; in the instructions below with the name of the mirror server you chose!.&lt;br /&gt;
&lt;br /&gt;
====For Linux servers====&lt;br /&gt;
&lt;br /&gt;
To do a CVS checkout of Moodle, you first have to logon to the Moodle CVS server.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;cvs -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle login&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  No password for anonymous, so just hit the Enter button.&lt;br /&gt;
&lt;br /&gt;
Go to the directory where you want the Moodle root to come and type&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;cvs -z3 -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle co -r MOODLE_18_STABLE moodle&amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  (where MOODLE_18_STABLE is the desired version)&lt;br /&gt;
&lt;br /&gt;
To update, just go into the Moodle root directory and update to the new files:&lt;br /&gt;
&lt;br /&gt;
  cvs update -dP&lt;br /&gt;
To update to a new version type in the following and change 18 to whatever newest version upgrade number is&lt;br /&gt;
  cvs -Q update -dP -r MOODLE_18_STABLE&lt;br /&gt;
&lt;br /&gt;
Make sure you use the &amp;quot;d&amp;quot; parameter to create new directories if necessary, and the &amp;quot;P&amp;quot; parameter to prune empty directories.&lt;br /&gt;
&lt;br /&gt;
====For Windows servers====&lt;br /&gt;
&lt;br /&gt;
You can use Tortoise CVS to do the initial checkout and the updates.&lt;br /&gt;
&lt;br /&gt;
If you have been editing Moodle files, watch the messages very closely for possible conflicts. All your customised themes and non-standard plugins will be untouched.&lt;br /&gt;
&lt;br /&gt;
Do not forget to trigger the install process in the site administration block (see below).&lt;br /&gt;
&lt;br /&gt;
== Finishing the upgrade ==&lt;br /&gt;
&lt;br /&gt;
The last step is to trigger the upgrade processes within Moodle. &lt;br /&gt;
&lt;br /&gt;
To do this just visit the site administration block admin page (or &#039;&#039;&amp;lt;nowiki&amp;gt;http://example.com/moodle/admin&amp;lt;/nowiki&amp;gt;&#039;&#039;) and the &amp;quot;Notifications&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
Moodle will automatically detect the new version and perform all the SQL database or file system upgrades that are necessary. If there is anything it can&#039;t do itself (very rare) then you will see messages telling you what you need to do.&lt;br /&gt;
&lt;br /&gt;
Assuming all goes well (no error messages) then you can start using your new version of Moodle and enjoy the new features!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; Use the site administration block&amp;gt;Server&amp;gt;Maintenance mode to prevent users from changing data during the upgrade.&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; If you are running a large scale Moodle site (e.g. have more tha 10,000+ courses and 40,000+ users), make sure that you do your own performance profiling testing.  Post a thread or check the [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum] and check [[Tracker]] for potential issues.&lt;br /&gt;
&lt;br /&gt;
== Verify the upgrade (optional) ==&lt;br /&gt;
&lt;br /&gt;
If you wish to confirm that the database definitions in the upgraded database match the definitions of a new, clean install (which they should) you might like to look at [[Verify Database Schema]].&lt;br /&gt;
&lt;br /&gt;
==Upgrading more than one version==&lt;br /&gt;
&lt;br /&gt;
In general, it is recommended to upgrade via each version of Moodle, for example 1.7 -&amp;gt; 1.9. An exception to this is when upgrading from 1.5 or 1.6, when it is recommended that 1.7 and 1.8 are skipped, in other words upgrade 1.5 -&amp;gt; 1.6 -&amp;gt; 1.9. (The main reason for this recommendation is that the default roles settings obtained when upgrading to 1.7 are not ideal for 1.8 onwards, 1.8 has problems with groups, etc.)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Installing Moodle]]&lt;br /&gt;
*[[Installation FAQ]]&lt;br /&gt;
*[[Upgrading to Moodle 1.6]]&lt;br /&gt;
*[[Upgrading to Moodle 1.8]]&lt;br /&gt;
*[[Upgrading to Moodle 1.9]]&lt;br /&gt;
*[[Upgrading to Moodle 2.0]]&lt;br /&gt;
*[[Environment]]&lt;br /&gt;
*[[Git]] Version control and upgrading&lt;br /&gt;
*Moodle.org [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum] &lt;br /&gt;
*[http://ic.eflclasses.org/tutorials/howtoupgrademoodlewithcpanel.swf How to upgrade Moodle with cpanel tutorial] - screencasts of older Moodle/Cpanel install but useful (also, a very large file that will take some time to load).&lt;br /&gt;
&lt;br /&gt;
Using Moodle.org forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=26731&amp;amp;parent=125858 Using cvs]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=56915 Upgrading from 1.5.2 to 1.7]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=56991 Upgrade nightmares.... any help appreciated]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=62463 After upgrading i get &amp;quot;Your site may not be secure.&amp;quot; msg]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=104887 Best practices for QA]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:Actualización de moodle]]&lt;br /&gt;
[[fr:Mise à jour]]&lt;br /&gt;
[[ja:アップグレード]]&lt;br /&gt;
[[nl:Upgraden]]&lt;br /&gt;
[[zh:升级]]&lt;br /&gt;
[[pl:Aktualizacja]]&lt;br /&gt;
[[de:Aktualisierung von Moodle]]&lt;br /&gt;
[[ru:Обновление]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Upgrading&amp;diff=70853</id>
		<title>Upgrading</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Upgrading&amp;diff=70853"/>
		<updated>2010-04-09T07:39:03Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Moodle is designed to upgrade cleanly from one version to the next.  Please refer to [[Upgrading to Moodle 1.6]], [[Upgrading to Moodle 1.8]] or [[Upgrading to Moodle 1.9]]  for particular considerations related to the upgraded version.  &lt;br /&gt;
&lt;br /&gt;
Changes that have been made to the original code, such as installing a contributed module (non-standard module) or a site edit of a php file, may not upgrade. This includes modifications to standard themes that might be overwritten during an upgrade.&lt;br /&gt;
&lt;br /&gt;
* For those using cpanel, you can use [http://ic.eflclasses.org/tutorials/howtoupgrademoodlewithcpanel.swf this tutorial]. It is a bit rough around the edges and is a little dated, but you should get the idea.&lt;br /&gt;
&lt;br /&gt;
* For those who have installed the package version of Moodle using an Ubuntu/Kubuntu/Debian package manager, upgrade instructions can be found [[Ubuntu_Debian_Upgrades|here]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
When upgrading a Moodle installation you should follow these steps:&lt;br /&gt;
&lt;br /&gt;
==Check the requirements==&lt;br /&gt;
Spend some time re-reading the [[Installing Moodle | installation documentation]] and documentation for the new version. Check the system requirements for the target version you want to upgrade-to in &#039;&#039;Administration &amp;gt; Server &amp;gt; [[Environment]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Backup important data ==&lt;br /&gt;
There are three areas that need backing up:&lt;br /&gt;
#Moodle software directory/folder (For example, everything in server/htdocs/moodle)&lt;br /&gt;
#Moodle data (For example, server/moodledata)&lt;br /&gt;
#Moodle SQL database&lt;br /&gt;
&lt;br /&gt;
Experienced site administrators know that it is a best practice (a very good idea) to make a backup of any production system before a major upgrade. In fact, it is a good idea to automate your server to backup your Moodle installation daily.  Most upgrades on sites that have used the standard Moodle packages (no contributed code and no little tweaks to the php files), will not have any major issue.  &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; One more time, &amp;quot;do not risk what you can not afford to lose&amp;quot;: do regular backups, make sure it backed up and know how to restore it! &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Moodle software directory ===&lt;br /&gt;
Make a separate copy of these files before the upgrade, so that you can retrieve your config.php and any modules you have added like themes, and languages.&lt;br /&gt;
&lt;br /&gt;
The best way is to rename the current Moodle directory to something else, then unpack the new Moodle archive into the old location.&lt;br /&gt;
&lt;br /&gt;
=== Moodle data directory ===&lt;br /&gt;
The default name for this folder is moodledata. This is where uploaded content resides (such as course resources and student assignments). It is very important to have a backup of these files on a regular basis as a best practice. Sometimes upgrades may move or rename directories within your data directory. &lt;br /&gt;
&lt;br /&gt;
In Linux you can use the cp (copy) command to make a temporary copy of the moodledata. example:&lt;br /&gt;
====Linux====&lt;br /&gt;
 mkdir /var/moodledata_backup&lt;br /&gt;
 cp -rv /var/moodledata/* /var/moodledata_backup&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== SQL database ===&lt;br /&gt;
Most Moodle upgrades will alter the SQL database tables, adding or changing fields. Each SQL server program (for example,MySQL, Postgresql, Oracle) has different ways to backup. In a MySQL server, one way of backing up is to &#039;dump&#039; it to a single SQL file. The following example shows Unix commands to dump the database called &amp;quot;moodle&amp;quot;: &lt;br /&gt;
&lt;br /&gt;
 mysqldump -u username -p -C -Q -e --create-options moodle &amp;gt; moodle-backup-2007-04-01.sql&lt;br /&gt;
&lt;br /&gt;
Substitute your database user account for username. The -p flag will prompt you for the password for the username specified by -u.&lt;br /&gt;
&lt;br /&gt;
If your database host is different from the host you want to execute the backup command (usually the web server), you have to specify it with the -h option to mysqldump:&lt;br /&gt;
&lt;br /&gt;
 mysqldump -u username -p -h databasehost -C -Q -e --create-options moodle &amp;gt; moodle-backup-2007-04-01.sql &lt;br /&gt;
&lt;br /&gt;
You can also use the &amp;quot;Export&amp;quot; feature in Moodle&#039;s optional &amp;quot;MySQL Admin&amp;quot; web interface to do the same thing on all platforms. In Moodle v1.9 and greater, this is located in &#039;&#039;&#039;Site Administration&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Server&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Database&#039;&#039;&#039;. This interface can also be downloaded from http://moodle.org/mod/data/view.php?d=13&amp;amp;rid=448. It is an integration of PHPMyAdmin for the Moodle administration interface.&lt;br /&gt;
&lt;br /&gt;
==== SQL dump caveats ====&lt;br /&gt;
There are a &#039;&#039;&#039;MANY&#039;&#039;&#039; options possible for mysqldump. &lt;br /&gt;
*Please talk with your Systems Administrator (if you have one) or similar to see if there are site-specific flags you should use for your SQL dump.&lt;br /&gt;
** For example, if your local installation is running MySQL 5.2 and you are moving to a system running MySQL 5.0 or 4.1, you really ought to use the &amp;quot;--compat=mysql40&amp;quot; flag. (This is not too uncommon of a situation given the nature of ISP hosting as compared to local user Moodle setups)&lt;br /&gt;
* This seems obvious, but should be said outright: These instructions only work for dumping from MySQL! Postgresql, Oracle, and other database servers have different tools to dump databases.&lt;br /&gt;
* Given the example mysql import lines, above, you really should use the --no-create-db flag. If your database locally is named something differently from the migration site, not including this flag could cause problems.&lt;br /&gt;
&lt;br /&gt;
== Install the new Moodle software ==&lt;br /&gt;
Upgrading can be a simple process or a more complicated process.  Sites that have not used contributed code and are migrating from say Moodle 1.x.1 to 1.x.3 &#039;&#039;&#039;should&#039;&#039;&#039; not have a problem.  However, we still recommend that with any production server that you have made a successful backup of the MySQL database, the moodledata directory and the moodle program folders and files.  &lt;br /&gt;
&lt;br /&gt;
*Do not overwrite an old installation unless you know what you are doing ... sometimes old files can cause problems in new installations. Review the backup section above.&lt;br /&gt;
&lt;br /&gt;
=== Standard install package ===&lt;br /&gt;
Having read the cautions about backups, download a copy of the standard install package. Here is a set of simple instructions for an average site.&lt;br /&gt;
*It is probably a good idea to use the site administration block&amp;gt;Server&amp;gt;Maintenance mode to prevent user activity as the site upgrades. &lt;br /&gt;
*Unzip or unpack the upgrade file so that all the Moodle software program files are overwritten on the server.  Moodle will adjust SQL and moodledata if it needs to in the upgrade.&lt;br /&gt;
*Use the notification link in the site administration to start the upgrade process. You will see a series of lines indicating progress.  &lt;br /&gt;
*After a successful upgrade, turn off the maintenance mode for your users.&lt;br /&gt;
&lt;br /&gt;
=== Using a downloaded archive ===&lt;br /&gt;
*Do not overwrite an old installation unless you know what you are doing ... sometimes old files can cause problems in new installations. The best way is to rename the current Moodle directory to something else, then unpack the new Moodle archive into the old location.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
 mv moodle moodle.backup&lt;br /&gt;
 tar xvzf moodle-1.1.tgz&lt;br /&gt;
&lt;br /&gt;
Next, copy across your config.php, any other plugins such as custom themes, and your .htaccess file if you created one:&lt;br /&gt;
&lt;br /&gt;
 cp moodle.backup/config.php moodle&lt;br /&gt;
 cp -pr moodle.backup/theme/mytheme moodle/theme/mytheme&lt;br /&gt;
 cp -pr moodle.backup/mod/mymod moodle/mod/mymod&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to &lt;br /&gt;
&lt;br /&gt;
 sudo chown www-data moodle/config.php&lt;br /&gt;
&lt;br /&gt;
if necessary.&lt;br /&gt;
&lt;br /&gt;
where www-data is whatever user the Apache user is on your system. This is often &#039;apache&#039; or &#039;www&#039;.&lt;br /&gt;
You can find out by doing &#039;ls -l&#039; in your /var/www/moodle folder (or wherever your moodle site is)&lt;br /&gt;
and then looking at the owner and group.&lt;br /&gt;
&lt;br /&gt;
so you may see something like&lt;br /&gt;
&lt;br /&gt;
 ls -l&lt;br /&gt;
 ...lots of lines...&lt;br /&gt;
 -rw-r--r--   1 apache system     784 Jun 28  2007 config.php &lt;br /&gt;
 ...lots more lines...&lt;br /&gt;
&lt;br /&gt;
so the owner is apache and the group is system. &lt;br /&gt;
&lt;br /&gt;
To replicate this on your new system you can do  &#039;chown apache:system config.php&#039; &lt;br /&gt;
&lt;br /&gt;
or to do a whole group do&lt;br /&gt;
&lt;br /&gt;
 chown apache:system ./*&lt;br /&gt;
&lt;br /&gt;
and recursively&lt;br /&gt;
&lt;br /&gt;
 chown -R apache:system ./*&lt;br /&gt;
&lt;br /&gt;
=== Using CVS ===&lt;br /&gt;
&lt;br /&gt;
You can use CVS for updating or upgrading your Moodle.&lt;br /&gt;
First you need to do a CVS checkout in your (empty) Moodle root directory.&lt;br /&gt;
&lt;br /&gt;
You can use any of our [[CVS_for_Administrators#CVS_Servers|CVS Mirror servers]]. Just replace &#039;&#039;&#039;SERVER.cvs.moodle.org&#039;&#039;&#039; in the instructions below with the name of the mirror server you chose!.&lt;br /&gt;
&lt;br /&gt;
====For Linux servers====&lt;br /&gt;
&lt;br /&gt;
To do a CVS checkout of Moodle, you first have to logon to the Moodle CVS server.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;cvs -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle login&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  No password for anonymous, so just hit the Enter button.&lt;br /&gt;
&lt;br /&gt;
Go to the directory where you want the Moodle root to come and type&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;cvs -z3 -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle co -r MOODLE_18_STABLE moodle&amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  (where MOODLE_18_STABLE is the desired version)&lt;br /&gt;
&lt;br /&gt;
To update, just go into the Moodle root directory and update to the new files:&lt;br /&gt;
&lt;br /&gt;
  cvs update -dP&lt;br /&gt;
To update to a new version type in the following and change 18 to whatever newest version upgrade number is&lt;br /&gt;
  cvs -Q update -dP -r MOODLE_18_STABLE&lt;br /&gt;
&lt;br /&gt;
Make sure you use the &amp;quot;d&amp;quot; parameter to create new directories if necessary, and the &amp;quot;P&amp;quot; parameter to prune empty directories.&lt;br /&gt;
&lt;br /&gt;
====For Windows servers====&lt;br /&gt;
&lt;br /&gt;
You can use Tortoise CVS to do the initial checkout and the updates.&lt;br /&gt;
&lt;br /&gt;
If you have been editing Moodle files, watch the messages very closely for possible conflicts. All your customised themes and non-standard plugins will be untouched.&lt;br /&gt;
&lt;br /&gt;
Do not forget to trigger the install process in the site administration block (see below).&lt;br /&gt;
&lt;br /&gt;
== Finishing the upgrade ==&lt;br /&gt;
&lt;br /&gt;
The last step is to trigger the upgrade processes within Moodle. &lt;br /&gt;
&lt;br /&gt;
To do this just visit the site administration block admin page (or &#039;&#039;&amp;lt;nowiki&amp;gt;http://example.com/moodle/admin&amp;lt;/nowiki&amp;gt;&#039;&#039;) and the &amp;quot;Notifications&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
Moodle will automatically detect the new version and perform all the SQL database or file system upgrades that are necessary. If there is anything it can&#039;t do itself (very rare) then you will see messages telling you what you need to do.&lt;br /&gt;
&lt;br /&gt;
Assuming all goes well (no error messages) then you can start using your new version of Moodle and enjoy the new features!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; Use the site administration block&amp;gt;Server&amp;gt;Maintenance mode to prevent users from changing data during the upgrade.&lt;br /&gt;
:&#039;&#039;TIP:&#039;&#039; If you are running a large scale Moodle site (e.g. have more tha 10,000+ courses and 40,000+ users), make sure that you do your own performance profiling testing.  Post a thread or check the [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum] and check [[Tracker]] for potential issues.&lt;br /&gt;
&lt;br /&gt;
== Verify the upgrade (optional) ==&lt;br /&gt;
&lt;br /&gt;
If you wish to confirm that the database definitions in the upgraded database match the definitions of a new, clean install (which they should) you might like to look at [[Verify Database Schema]].&lt;br /&gt;
&lt;br /&gt;
==Upgrading more than one version==&lt;br /&gt;
&lt;br /&gt;
In general, it is recommended to upgrade via each version of Moodle, for example 1.7 -&amp;gt; 1.9. An exception to this is when upgrading from 1.5 or 1.6, when it is recommended that 1.7 and 1.8 are skipped, in other words upgrade 1.5 -&amp;gt; 1.6 -&amp;gt; 1.9. (The main reason for this recommendation is that the default roles settings obtained when upgrading to 1.7 are not ideal for 1.8 onwards, 1.8 has problems with groups, etc.)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Installing Moodle]]&lt;br /&gt;
*[[Installation FAQ]]&lt;br /&gt;
*[[Upgrading to Moodle 1.6]]&lt;br /&gt;
*[[Upgrading to Moodle 1.8]]&lt;br /&gt;
*[[Upgrading to Moodle 1.9]]&lt;br /&gt;
*[[Upgrading to Moodle 2.0]]&lt;br /&gt;
*[[Environment]]&lt;br /&gt;
*[[Git]] Version control and upgrading&lt;br /&gt;
*Moodle.org [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum] &lt;br /&gt;
*[http://ic.eflclasses.org/tutorials/howtoupgrademoodlewithcpanel.swf How to upgrade Moodle with cpanel tutorial] - screencasts of older Moodle/Cpanel install but useful (also, a very large file that will take some time to load).&lt;br /&gt;
&lt;br /&gt;
Using Moodle.org forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=26731&amp;amp;parent=125858 Using cvs]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=56915 Upgrading from 1.5.2 to 1.7]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=56991 Upgrade nightmares.... any help appreciated]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=62463 After upgrading i get &amp;quot;Your site may not be secure.&amp;quot; msg]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=104887 Best practices for QA]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:Actualización de moodle]]&lt;br /&gt;
[[fr:Mise à jour]]&lt;br /&gt;
[[ja:アップグレード]]&lt;br /&gt;
[[nl:Upgraden]]&lt;br /&gt;
[[zh:升级]]&lt;br /&gt;
[[pl:Aktualizacja]]&lt;br /&gt;
[[de:Aktualisierung von Moodle]]&lt;br /&gt;
[[ru:Обновление]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr&amp;diff=69968</id>
		<title>admin/repository/flickr</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr&amp;diff=69968"/>
		<updated>2010-03-20T21:32:07Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* See Also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle_2.0}}&lt;br /&gt;
=Flickr Configuration=&lt;br /&gt;
This page lets you configure access to a Flickr repository. It will allow a user to log into their Flickr account and copy files from their account into any of the Moodle file interfaces.&lt;br /&gt;
&lt;br /&gt;
To set this repository up you need to set the following two fields:&lt;br /&gt;
*API Key&lt;br /&gt;
*Secret&lt;br /&gt;
&lt;br /&gt;
==Setting up a Flickr API==&lt;br /&gt;
To get your API Key and Secret you need to create an App inside your Flickr account. Visit [http://www.flickr.com/services/api/keys/ this link] to start creating your own API Key and secret.&lt;br /&gt;
#Click the &amp;quot;Get Another Key&amp;quot; button to start creating your App. [[Image:get-another-key.png]]&lt;br /&gt;
#Choose &amp;quot;Apply for a Non-commercial Key&amp;quot;&lt;br /&gt;
#Enter a title and brief description for the App (i.e. Moodle to Flickr Access - App to allow Moodle to access Flickr through it&#039;s repository API)&lt;br /&gt;
#Tick the two boxes to show your agreement to Flickr&#039;s terms of use and then click submit.&lt;br /&gt;
#You will now have the key and secret for the new app. Copy and paste these into the fields in your Moodle Flickr configuration page.&lt;br /&gt;
#Click save on the Moodle Flickr configuration page.&lt;br /&gt;
#Revisit the settings of your Flickr repository in Moodle and copy the callback URL from that page.&lt;br /&gt;
#Revisit your Flickr App page and click on the &amp;quot;Edit Auth Flow for this App&amp;quot; link&lt;br /&gt;
#Paste the URL from your Moodle page into the Callback URL field on your Flickr App&lt;br /&gt;
#Click &amp;quot;Save Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You should now have a working Flickr repository. Try adding a file from your Flickr account as a resource in Moodle to test it!&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Manage_repositories|Manage Repositories]]&lt;br /&gt;
*[[admin/repository/flickr_public|Flickr Public Repository]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr_public&amp;diff=69967</id>
		<title>admin/repository/flickr public</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr_public&amp;diff=69967"/>
		<updated>2010-03-20T21:31:31Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* See Also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle_2.0}}&lt;br /&gt;
=Flickr Public Configuration=&lt;br /&gt;
This page lets you configure access to a Flickr Public repository. It will allow a user to search Flickr and copy files from there into any of the Moodle file interfaces.&lt;br /&gt;
&lt;br /&gt;
To set this repository up you need to set the following field:&lt;br /&gt;
*API Key&lt;br /&gt;
&lt;br /&gt;
==Setting up a Flickr API==&lt;br /&gt;
To get your API Key you need to create an App inside your Flickr account. Visit [http://www.flickr.com/services/api/keys/ this link] to start creating your own API Key.&lt;br /&gt;
#Click the &amp;quot;Get Another Key&amp;quot; button to start creating your App. [[Image:get-another-key.png]]&lt;br /&gt;
#Choose &amp;quot;Apply for a Non-commercial Key&amp;quot;&lt;br /&gt;
#Enter a title and brief description for the App (i.e. Moodle to Flickr Access - App to allow Moodle to access Flickr through it&#039;s repository API)&lt;br /&gt;
#Tick the two boxes to show your agreement to Flickr&#039;s terms of use and then click submit.&lt;br /&gt;
#You will now have the key for the new app. Copy and paste this into the field in your Moodle Flickr public configuration page.&lt;br /&gt;
#Click save on the Moodle Flickr public configuration page.&lt;br /&gt;
#Click &amp;quot;Save Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You should now have a working Flickr public repository. Try adding a file from Flickr as a resource in Moodle to test it!&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Manage_repositories|Manage Repositories]]&lt;br /&gt;
*[[admin/repository/flickr|Flickr Repository]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Repositories&amp;diff=69966</id>
		<title>Repositories</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Repositories&amp;diff=69966"/>
		<updated>2010-03-20T21:30:53Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* See Also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 2.0}}Location: &#039;&#039;Administration &amp;gt; Plugins &amp;gt; Repositories &amp;gt; Manage repositories&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;br /&gt;
&lt;br /&gt;
==Vocabulary==&lt;br /&gt;
&#039;&#039;&#039;Repository plugin&#039;&#039;&#039;: it is also called a repository type. It can be named Box.net, Flickr, Mahara, Youtube... Adding a plugin allow users to create instances of this plugin. Only instances are displayed into the file picker. Type only exist in order to let a Moodle administrator to deactivate/delete all instances of a type in one click.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Repository instance&#039;&#039;&#039;: An instance is displayed into the file picker and it is the access point to an external repository. An instance can have specific settings (for example be linked to a personal account).&lt;br /&gt;
 &lt;br /&gt;
*First case: when you add the plugin, an instance is automatically created and can not be edited. The Moodle administrator cannot change the instance name. The instance name displayed into the file picker will be exactly the same as the plugin name. For example Youtube, Box.net...&lt;br /&gt;
*Second case: the plugin allow the Moodle administrator to add multiple instances. An instance has a name for example Flickr Public access to Martin account, Martin&#039;s Mahara... &amp;lt;br/&amp;gt;For this second case it is important to identify two different kind of instances:&lt;br /&gt;
#Common instances: The instances set by Moodle administrator in these same administration pages will be available into any file picker.&lt;br /&gt;
#Private instance: A teacher can set some instances available only for a course, and an user can set some instances only available for himself. In order to set instances for a course the teacher will go to the course page, and in order to set instances for a personal use, a user will go on his profile page. An administrator cannot add/edit private instances from the administration pages.&lt;br /&gt;
&lt;br /&gt;
==Operations==&lt;br /&gt;
&#039;&#039;&#039;Add a repository plugin:&#039;&#039;&#039; you can add a repository plugin to your Moodle site. They are set &#039;&#039;hidden&#039;&#039; by default, so you can edit them without impacting users.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Delete:&#039;&#039;&#039; you can delete a repository plugin here. It will delete all settings and common and private instances forever. You will still be able to re-add the plugin, but the previously set instances will be lost.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hide/Show:&#039;&#039;&#039; if you hide a plugin, this plugin will not appear into file picker and no private instances can be added.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Sort:&#039;&#039;&#039; you can change the display order into the file picker. Instances are always grouped by plugin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; set the plugin options, create/edit common instances.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[admin/repository/flickr_public|Flickr Public Repository]]&lt;br /&gt;
*[[admin/repository/flickr|Flickr Repository]]&lt;br /&gt;
&lt;br /&gt;
[[eu:Biltegiak_kudeatu]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=Repositories&amp;diff=69965</id>
		<title>Repositories</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=Repositories&amp;diff=69965"/>
		<updated>2010-03-20T21:30:27Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 2.0}}Location: &#039;&#039;Administration &amp;gt; Plugins &amp;gt; Repositories &amp;gt; Manage repositories&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;br /&gt;
&lt;br /&gt;
==Vocabulary==&lt;br /&gt;
&#039;&#039;&#039;Repository plugin&#039;&#039;&#039;: it is also called a repository type. It can be named Box.net, Flickr, Mahara, Youtube... Adding a plugin allow users to create instances of this plugin. Only instances are displayed into the file picker. Type only exist in order to let a Moodle administrator to deactivate/delete all instances of a type in one click.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Repository instance&#039;&#039;&#039;: An instance is displayed into the file picker and it is the access point to an external repository. An instance can have specific settings (for example be linked to a personal account).&lt;br /&gt;
 &lt;br /&gt;
*First case: when you add the plugin, an instance is automatically created and can not be edited. The Moodle administrator cannot change the instance name. The instance name displayed into the file picker will be exactly the same as the plugin name. For example Youtube, Box.net...&lt;br /&gt;
*Second case: the plugin allow the Moodle administrator to add multiple instances. An instance has a name for example Flickr Public access to Martin account, Martin&#039;s Mahara... &amp;lt;br/&amp;gt;For this second case it is important to identify two different kind of instances:&lt;br /&gt;
#Common instances: The instances set by Moodle administrator in these same administration pages will be available into any file picker.&lt;br /&gt;
#Private instance: A teacher can set some instances available only for a course, and an user can set some instances only available for himself. In order to set instances for a course the teacher will go to the course page, and in order to set instances for a personal use, a user will go on his profile page. An administrator cannot add/edit private instances from the administration pages.&lt;br /&gt;
&lt;br /&gt;
==Operations==&lt;br /&gt;
&#039;&#039;&#039;Add a repository plugin:&#039;&#039;&#039; you can add a repository plugin to your Moodle site. They are set &#039;&#039;hidden&#039;&#039; by default, so you can edit them without impacting users.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Delete:&#039;&#039;&#039; you can delete a repository plugin here. It will delete all settings and common and private instances forever. You will still be able to re-add the plugin, but the previously set instances will be lost.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Hide/Show:&#039;&#039;&#039; if you hide a plugin, this plugin will not appear into file picker and no private instances can be added.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Sort:&#039;&#039;&#039; you can change the display order into the file picker. Instances are always grouped by plugin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Settings:&#039;&#039;&#039; set the plugin options, create/edit common instances.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[admin/repository/flickr_public Flickr Public Repository]]&lt;br /&gt;
*[[admin/repository/flickr Flickr Repository]]&lt;br /&gt;
&lt;br /&gt;
[[eu:Biltegiak_kudeatu]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr&amp;diff=69964</id>
		<title>admin/repository/flickr</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr&amp;diff=69964"/>
		<updated>2010-03-20T21:28:44Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* See Also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle_2.0}}&lt;br /&gt;
=Flickr Configuration=&lt;br /&gt;
This page lets you configure access to a Flickr repository. It will allow a user to log into their Flickr account and copy files from their account into any of the Moodle file interfaces.&lt;br /&gt;
&lt;br /&gt;
To set this repository up you need to set the following two fields:&lt;br /&gt;
*API Key&lt;br /&gt;
*Secret&lt;br /&gt;
&lt;br /&gt;
==Setting up a Flickr API==&lt;br /&gt;
To get your API Key and Secret you need to create an App inside your Flickr account. Visit [http://www.flickr.com/services/api/keys/ this link] to start creating your own API Key and secret.&lt;br /&gt;
#Click the &amp;quot;Get Another Key&amp;quot; button to start creating your App. [[Image:get-another-key.png]]&lt;br /&gt;
#Choose &amp;quot;Apply for a Non-commercial Key&amp;quot;&lt;br /&gt;
#Enter a title and brief description for the App (i.e. Moodle to Flickr Access - App to allow Moodle to access Flickr through it&#039;s repository API)&lt;br /&gt;
#Tick the two boxes to show your agreement to Flickr&#039;s terms of use and then click submit.&lt;br /&gt;
#You will now have the key and secret for the new app. Copy and paste these into the fields in your Moodle Flickr configuration page.&lt;br /&gt;
#Click save on the Moodle Flickr configuration page.&lt;br /&gt;
#Revisit the settings of your Flickr repository in Moodle and copy the callback URL from that page.&lt;br /&gt;
#Revisit your Flickr App page and click on the &amp;quot;Edit Auth Flow for this App&amp;quot; link&lt;br /&gt;
#Paste the URL from your Moodle page into the Callback URL field on your Flickr App&lt;br /&gt;
#Click &amp;quot;Save Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You should now have a working Flickr repository. Try adding a file from your Flickr account as a resource in Moodle to test it!&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Manage_repositories]]&lt;br /&gt;
*[[admin/repository/flickr_public]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr&amp;diff=69963</id>
		<title>admin/repository/flickr</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr&amp;diff=69963"/>
		<updated>2010-03-20T21:27:56Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle_2.0}}&lt;br /&gt;
=Flickr Configuration=&lt;br /&gt;
This page lets you configure access to a Flickr repository. It will allow a user to log into their Flickr account and copy files from their account into any of the Moodle file interfaces.&lt;br /&gt;
&lt;br /&gt;
To set this repository up you need to set the following two fields:&lt;br /&gt;
*API Key&lt;br /&gt;
*Secret&lt;br /&gt;
&lt;br /&gt;
==Setting up a Flickr API==&lt;br /&gt;
To get your API Key and Secret you need to create an App inside your Flickr account. Visit [http://www.flickr.com/services/api/keys/ this link] to start creating your own API Key and secret.&lt;br /&gt;
#Click the &amp;quot;Get Another Key&amp;quot; button to start creating your App. [[Image:get-another-key.png]]&lt;br /&gt;
#Choose &amp;quot;Apply for a Non-commercial Key&amp;quot;&lt;br /&gt;
#Enter a title and brief description for the App (i.e. Moodle to Flickr Access - App to allow Moodle to access Flickr through it&#039;s repository API)&lt;br /&gt;
#Tick the two boxes to show your agreement to Flickr&#039;s terms of use and then click submit.&lt;br /&gt;
#You will now have the key and secret for the new app. Copy and paste these into the fields in your Moodle Flickr configuration page.&lt;br /&gt;
#Click save on the Moodle Flickr configuration page.&lt;br /&gt;
#Revisit the settings of your Flickr repository in Moodle and copy the callback URL from that page.&lt;br /&gt;
#Revisit your Flickr App page and click on the &amp;quot;Edit Auth Flow for this App&amp;quot; link&lt;br /&gt;
#Paste the URL from your Moodle page into the Callback URL field on your Flickr App&lt;br /&gt;
#Click &amp;quot;Save Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You should now have a working Flickr repository. Try adding a file from your Flickr account as a resource in Moodle to test it!&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[manage_respositories]]&lt;br /&gt;
*[[admin/repository/flickr_public]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr_public&amp;diff=69962</id>
		<title>admin/repository/flickr public</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr_public&amp;diff=69962"/>
		<updated>2010-03-20T21:27:15Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle_2.0}}&lt;br /&gt;
=Flickr Public Configuration=&lt;br /&gt;
This page lets you configure access to a Flickr Public repository. It will allow a user to search Flickr and copy files from there into any of the Moodle file interfaces.&lt;br /&gt;
&lt;br /&gt;
To set this repository up you need to set the following field:&lt;br /&gt;
*API Key&lt;br /&gt;
&lt;br /&gt;
==Setting up a Flickr API==&lt;br /&gt;
To get your API Key you need to create an App inside your Flickr account. Visit [http://www.flickr.com/services/api/keys/ this link] to start creating your own API Key.&lt;br /&gt;
#Click the &amp;quot;Get Another Key&amp;quot; button to start creating your App. [[Image:get-another-key.png]]&lt;br /&gt;
#Choose &amp;quot;Apply for a Non-commercial Key&amp;quot;&lt;br /&gt;
#Enter a title and brief description for the App (i.e. Moodle to Flickr Access - App to allow Moodle to access Flickr through it&#039;s repository API)&lt;br /&gt;
#Tick the two boxes to show your agreement to Flickr&#039;s terms of use and then click submit.&lt;br /&gt;
#You will now have the key for the new app. Copy and paste this into the field in your Moodle Flickr public configuration page.&lt;br /&gt;
#Click save on the Moodle Flickr public configuration page.&lt;br /&gt;
#Click &amp;quot;Save Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You should now have a working Flickr public repository. Try adding a file from Flickr as a resource in Moodle to test it!&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Manage_repositories]]&lt;br /&gt;
*[[admin/repository/flickr]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr_public&amp;diff=69961</id>
		<title>admin/repository/flickr public</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr_public&amp;diff=69961"/>
		<updated>2010-03-20T21:26:19Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle_2.0}}&lt;br /&gt;
=Flickr Public Configuration=&lt;br /&gt;
This page lets you configure access to a Flickr Public repository. It will allow a user to search Flickr and copy files from there into any of the Moodle file interfaces.&lt;br /&gt;
&lt;br /&gt;
To set this repository up you need to set the following field:&lt;br /&gt;
*API Key&lt;br /&gt;
&lt;br /&gt;
==Setting up a Flickr API==&lt;br /&gt;
To get your API Key you need to create an App inside your Flickr account. Visit [http://www.flickr.com/services/api/keys/ this link] to start creating your own API Key.&lt;br /&gt;
#Click the &amp;quot;Get Another Key&amp;quot; button to start creating your App. [[Image:get-another-key.png]]&lt;br /&gt;
#Choose &amp;quot;Apply for a Non-commercial Key&amp;quot;&lt;br /&gt;
#Enter a title and brief description for the App (i.e. Moodle to Flickr Access - App to allow Moodle to access Flickr through it&#039;s repository API)&lt;br /&gt;
#Tick the two boxes to show your agreement to Flickr&#039;s terms of use and then click submit.&lt;br /&gt;
#You will now have the key for the new app. Copy and paste this into the field in your Moodle Flickr public configuration page.&lt;br /&gt;
#Click save on the Moodle Flickr public configuration page.&lt;br /&gt;
#Click &amp;quot;Save Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You should now have a working Flickr public repository. Try adding a file from Flickr as a resource in Moodle to test it!&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[Manage_repositories]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr_public&amp;diff=69959</id>
		<title>admin/repository/flickr public</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/22/en/index.php?title=admin/repository/flickr_public&amp;diff=69959"/>
		<updated>2010-03-20T21:25:30Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle_2.0}}&lt;br /&gt;
=Flickr Public Configuration=&lt;br /&gt;
This page lets you configure access to a Flickr Public repository. It will allow a user to search Flickr and copy files from there into any of the Moodle file interfaces.&lt;br /&gt;
&lt;br /&gt;
To set this repository up you need to set the following field:&lt;br /&gt;
*API Key&lt;br /&gt;
&lt;br /&gt;
==Setting up a Flickr API==&lt;br /&gt;
To get your API Key you need to create an App inside your Flickr account. Visit [http://www.flickr.com/services/api/keys/ this link] to start creating your own API Key.&lt;br /&gt;
#Click the &amp;quot;Get Another Key&amp;quot; button to start creating your App. [[Image:get-another-key.png]]&lt;br /&gt;
#Choose &amp;quot;Apply for a Non-commercial Key&amp;quot;&lt;br /&gt;
#Enter a title and brief description for the App (i.e. Moodle to Flickr Access - App to allow Moodle to access Flickr through it&#039;s repository API)&lt;br /&gt;
#Tick the two boxes to show your agreement to Flickr&#039;s terms of use and then click submit.&lt;br /&gt;
#You will now have the key for the new app. Copy and paste this into the field in your Moodle Flickr public configuration page.&lt;br /&gt;
#Click save on the Moodle Flickr public configuration page.&lt;br /&gt;
#Click &amp;quot;Save Changes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You should now have a working Flickr public repository. Try adding a file from Flickr as a resource in Moodle to test it!&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
</feed>