<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/39/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dschwa</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/39/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dschwa"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/Special:Contributions/Dschwa"/>
	<updated>2026-04-23T10:52:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Global_search&amp;diff=135769</id>
		<title>Global search</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Global_search&amp;diff=135769"/>
		<updated>2019-10-23T18:38:12Z</updated>

		<summary type="html">&lt;p&gt;Dschwa: Added a SQL query fix for a common error&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{More features}}&lt;br /&gt;
==What is Global search?==&lt;br /&gt;
*Global search lets you search everywhere on the Moodle site that you have access to. A student can search their courses for particular lecture notes, for example, or a teacher could search for subject-related activities.&lt;br /&gt;
*The feature needs to be enabled by the administrator in Advanced features and then, from the Manage Global search page, the search engine must be selected.&lt;br /&gt;
&lt;br /&gt;
When Global search is enabled,  search box is then available next to the user menu.&lt;br /&gt;
&lt;br /&gt;
[[File:NFGlobalsearchbox.png|thumb|center|480px|Searching the site (when global search is enabled)]]&lt;br /&gt;
&lt;br /&gt;
*A [[Global search block]] may also be added to course pages.&lt;br /&gt;
&lt;br /&gt;
==What can I search for?==&lt;br /&gt;
You can search for your courses, activities information and some activities contents like forum posts, book chapters, glossary entries or collaborative wikis pages. &lt;br /&gt;
&lt;br /&gt;
HTML block content may be searched and, if the administrator sets the setting &amp;quot;Searchable courses&amp;quot; to &#039;&#039;Search within all courses the user can access&#039;&#039; then courses which are visible to users but which they are not enrolled in may also be searched. (These courses are courses with guest access or if the user has the capability to view all courses.)&lt;br /&gt;
&lt;br /&gt;
==How does it work?==&lt;br /&gt;
*Click the search icon by the user menu and type a search term into the box that appears, or type into the box in the [[Global search block]] if enabled.&lt;br /&gt;
*On the next screen, you can simply click the search button to search everywhere, or expand the Filter to search in specific areas:&lt;br /&gt;
&lt;br /&gt;
[[File:NFFilteringGlobalSearch2.png|thumb|center|600px|Filtering the search]]&lt;br /&gt;
&lt;br /&gt;
*You will then see results displayed from all areas of Moodle you have access to:&lt;br /&gt;
&lt;br /&gt;
[[File:31GSResults2a.png|thumb|center|600px|Search results]]&lt;br /&gt;
&lt;br /&gt;
===Solr-specific features===&lt;br /&gt;
&#039;&#039;These features are only available if you use &#039;&#039;&#039;Solr&#039;&#039;&#039; as your search engine.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Search query features====&lt;br /&gt;
You can improve your search using any of the following search query features:&lt;br /&gt;
&lt;br /&gt;
* Specifying the field to be searched by prefixing the search query with &#039;title:&#039;, &#039;content:&#039;, &#039;name:&#039;, or &#039;intro:&#039; e.g.&#039;title:news&#039; returns results with the word &#039;news&#039; in the title&lt;br /&gt;
* Boolean operators (&#039;AND&#039;, &#039;OR&#039;, &#039;NOT&#039;) to combine or exclude keywords&lt;br /&gt;
* Wildcard characters (&#039;*&#039; or &#039;?&#039; ) to represent characters in the search query&lt;br /&gt;
* Proximity searches (&#039;~&#039;) e.g. mood~2 returns &amp;quot;moodle&amp;quot; (2 letters away from &amp;quot;mood&amp;quot;), Moodle Australia~3 returns results containing &amp;quot;Moodle HQ in Perth, Australia&amp;quot; (the queried terms were within 3 words of each other)&lt;br /&gt;
* Boosting terms (&#039;^&#039;) to boost certain words or phrases e.g. &amp;quot;Perth Australia&amp;quot;^5 &amp;quot;Australia&amp;quot; will return results with the phrase &amp;quot;Perth Australia&amp;quot; as more relevant.&lt;br /&gt;
&lt;br /&gt;
====File contents indexing====&lt;br /&gt;
Solr has the ability to index the contents of files, such as File resources and attachments to Forum posts.&lt;br /&gt;
&lt;br /&gt;
====Extra filters====&lt;br /&gt;
&#039;&#039;&#039;New in 3.5&#039;&#039;&#039; : New fields now facilitate filtering by user ID and searching by group.&lt;br /&gt;
&lt;br /&gt;
==How is it set up?==&lt;br /&gt;
&lt;br /&gt;
Note: Global search needs a search engine. It&#039;s recommended you set everything up first, index the site contents &#039;&#039;and only then&#039;&#039; enable Global search.&lt;br /&gt;
&lt;br /&gt;
Moodle core includes two search engines: Simple Global search and Solr. See the [https://docs.moodle.org/dev/Search_engines Developer docs on Search engine plugins] if you wish to write your own.&lt;br /&gt;
&lt;br /&gt;
===Setting up Simple search===&lt;br /&gt;
&lt;br /&gt;
Simple Global search provides global search features without the need to install an external search engine.&lt;br /&gt;
&lt;br /&gt;
{{MediaPlayer | url = https://youtu.be/4JJhOd2XAiY | desc = Simple global search}}&lt;br /&gt;
&lt;br /&gt;
===Setting up Solr===&lt;br /&gt;
&lt;br /&gt;
* The latest Solr 5 available version is the recommended one.&lt;br /&gt;
* Moodle supports Solr server from 4.0 onwards, although you can only use the Solr schema setup script that we provide with Moodle from Solr 5. The latest Solr 5 available version is the recommended one; the same will apply to Solr 6 once it is released.&lt;br /&gt;
&lt;br /&gt;
====General Setup====&lt;br /&gt;
&lt;br /&gt;
# Set the feature up in &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Search &amp;gt; Manage global search&#039;&#039; by selecting Solr as the search engine and ticking search area checkboxes as required&lt;br /&gt;
# In &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Search &amp;gt; Solr&#039;&#039;, set &#039;&#039;&#039;Host name&#039;&#039;&#039; to localhost, &#039;&#039;&#039;Port&#039;&#039;&#039; to 8983 and &#039;&#039;&#039;Index name&#039;&#039;&#039; to &#039;moodle&#039; (the name of the index in Solr) &lt;br /&gt;
# If you are using Solr with SSL encryption and basic authentication (see below if you want to use client certificates instead), you will need to configure this.This is important if solr is not installed in the web server server.&lt;br /&gt;
## Go to &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Search &amp;gt; Solr&#039;&#039;&lt;br /&gt;
## Set &#039;&#039;&#039;Secure mode&#039;&#039;&#039; to Yes&lt;br /&gt;
## Set port number if required (sometimes SSL installations use port 443).&lt;br /&gt;
## Type in the username and password.&lt;br /&gt;
# If you are using Solr with SSL encryption via client certificates, you will need to configure Moodle as such. This is important if solr is not installed in the web server server.&lt;br /&gt;
## You will need a separate key file and cacert file, both in pem format, located on your server Moodle, and readable by the PHP process.&lt;br /&gt;
## Go to &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Search &amp;gt; Solr&#039;&#039;&lt;br /&gt;
## Set &#039;&#039;&#039;Secure mode&#039;&#039;&#039; to Yes&lt;br /&gt;
## &#039;&#039;&#039;SSL certificate&#039;&#039;&#039; to /path/to/certs/solr-ssl.cacert.pem&lt;br /&gt;
## &#039;&#039;&#039;SSL key&#039;&#039;&#039; to /path/to/certs/solr-ssl.key.pem&lt;br /&gt;
## &#039;&#039;&#039;SSL key Password&#039;&#039;&#039; to The password used to lock the SSL Key&lt;br /&gt;
## &#039;&#039;&#039;SSL CA certificates name&#039;&#039;&#039; to /path/to/certs/solr-ssl.cacert.pem&lt;br /&gt;
# You now need to populate the created Solr index with your site&#039;s data. You can do it via the web interface by going to &#039;&#039;Site administration &amp;gt; Reports &amp;gt; Global search info&#039;&#039; or from the CLI by running the &amp;lt;tt&amp;gt;search/cli/indexer.php&amp;lt;/tt&amp;gt; script. The CLI script is the recommended option for big sites.&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;# sudo -u www-run php search/cli/indexer.php --force&amp;lt;/code&amp;gt;&lt;br /&gt;
# Enable Global search in &#039;&#039;Site administration &amp;gt; Advanced features&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====File Indexing====&lt;br /&gt;
&lt;br /&gt;
Solr has the ability to index the contents of files, such as File resources and attachments to Forum posts. This uses the [https://tika.apache.org/ Tika] engine which comes bundled with Solr. To enable this feature:&lt;br /&gt;
# In &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Search &amp;gt; Solr&#039;&#039; enable the checkbox &#039;&#039;&#039;Enable file indexing&#039;&#039;&#039;&lt;br /&gt;
# Set &#039;&#039;&#039;Maximum file size to index (kB)&#039;&#039;&#039; to some value - the default is &#039;&#039;&#039;2097152&#039;&#039;&#039; (2GB)&lt;br /&gt;
#* Files larger than this limit will not be sent for Solr for indexing, but the file name will still be indexed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;New in 34:&#039;&#039;&#039; File indexing now works retroactively -ie, if you set up Global search without file indexing enabled and a later date you enable file indexing, files associated with existing objects will be included.&lt;br /&gt;
&lt;br /&gt;
====How to install Solr====&lt;br /&gt;
&lt;br /&gt;
You need PHP Solr extension installed. You can download the official latest versions from [http://pecl.php.net/package/solr PECL: Package: solr]. The minimum required version is PECL Solr 2.1 for PHP 5 branch and PECL Solr 2.4 for PHP 7 branch.&lt;br /&gt;
&lt;br /&gt;
Basic installation steps (using apache web server):&lt;br /&gt;
&lt;br /&gt;
===== Linux (Debian/Ubuntu) =====&lt;br /&gt;
Using APT:&lt;br /&gt;
    sudo apt install php-solr&lt;br /&gt;
    sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
If you can&#039;t install the SOLR PHP module via APT, try the following:&lt;br /&gt;
&lt;br /&gt;
With PHP5.x&lt;br /&gt;
    sudo apt-get install libpcre3-dev libxml2-dev libcurl4-openssl-dev&lt;br /&gt;
    sudo apt-get install php5-dev&lt;br /&gt;
    sudo apt-get install php-pear&lt;br /&gt;
    sudo pecl install solr&lt;br /&gt;
    sudo sh -c &amp;quot;echo &#039;extension=solr.so&#039; &amp;gt; /etc/php5/apache2/conf.d/solr.ini&amp;quot;&lt;br /&gt;
    sudo sh -c &amp;quot;echo &#039;extension=solr.so&#039; &amp;gt; /etc/php5/cli/conf.d/solr.ini&amp;quot;&lt;br /&gt;
    sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
With PHP 7&lt;br /&gt;
    sudo apt-get install libpcre3-dev libxml2-dev libcurl4-openssl-dev&lt;br /&gt;
    sudo apt-get install php7.0-dev&lt;br /&gt;
    sudo apt-get install php-pear&lt;br /&gt;
    sudo pecl install solr&lt;br /&gt;
    sudo sh -c &amp;quot;echo &#039;extension=solr.so&#039; &amp;gt; /etc/php/7.0/apache2/conf.d/solr.ini&amp;quot;&lt;br /&gt;
    sudo sh -c &amp;quot;echo &#039;extension=solr.so&#039; &amp;gt; /etc/php/7.0/cli/conf.d/solr.ini&amp;quot;&lt;br /&gt;
    sudo service apache2 restart&lt;br /&gt;
&lt;br /&gt;
===== Linux (Redhat/Centos 6 &amp;amp; 7) =====&lt;br /&gt;
&lt;br /&gt;
====== Using built in php5 packages ======&lt;br /&gt;
  yum install php-pecl-solr2&lt;br /&gt;
  service httpd restart&lt;br /&gt;
&lt;br /&gt;
====== Using 3rd party php7 packages (webtactic) ======&lt;br /&gt;
  yum install libxml2-devel pcre-devel libcurl-devel php70w-devel php70w-pear&lt;br /&gt;
  pecl install solr&lt;br /&gt;
  echo &amp;quot;extension=solr.so&amp;quot; &amp;gt; /etc/php.d/solr.ini&lt;br /&gt;
  service httpd restart&lt;br /&gt;
&lt;br /&gt;
===== OSX using macports =====&lt;br /&gt;
&lt;br /&gt;
    sudo port install apache-solr4&lt;br /&gt;
    sudo port install php54-solr&lt;br /&gt;
&lt;br /&gt;
===== OSX using homebrew =====&lt;br /&gt;
&lt;br /&gt;
    brew install homebrew/php/php56-solr&lt;br /&gt;
&lt;br /&gt;
===== Windows =====&lt;br /&gt;
&lt;br /&gt;
Install the pecl package as usual. (This has not yet been tested.)&lt;br /&gt;
&lt;br /&gt;
===== The Solr server =====&lt;br /&gt;
&lt;br /&gt;
Note that for medium/large sites you may need to increase maxBooleanClauses setting. In [https://tracker.moodle.org/browse/MDL-54992 MDL-54992] we are working on an alternative way to query the server. &lt;br /&gt;
&lt;br /&gt;
Please note that there is a security issue that affects some Solr versions. The patched versions are 5.5.5, 6.6.2, 7.1, 7.2 and all new versions are patched. If your Solr server version is lower but you can&#039;t upgrade to one of the patched versions it is recommended to disable the XML Query Parser.&lt;br /&gt;
 &lt;br /&gt;
The following example snippet (feel free to copy &amp;amp; paste into a .sh script with execution permissions) will download Solr 5.5.5 (replace it with latest 5.x) in the current directory, start the solr server and create an index in it named &#039;&#039;&#039;moodle&#039;&#039;&#039; to add moodle data to it. If wget gives an error, check  http://www-us.apache.org/dist/lucene/solr and update SOLRVERSION&lt;br /&gt;
&lt;br /&gt;
    #!/bin/bash&lt;br /&gt;
    set -e&lt;br /&gt;
    SOLRVERSION=5.5.5&lt;br /&gt;
    SOLRNAME=solr-$SOLRVERSION&lt;br /&gt;
    SOLRTAR=$SOLRNAME&#039;.tgz&#039;&lt;br /&gt;
    INDEXNAME=moodle&lt;br /&gt;
    if [ -d $SOLRNAME ]; then&lt;br /&gt;
        echo &amp;quot;Error: Directory $SOLRNAME already exists, remove it before starting the setup again.&amp;quot;&lt;br /&gt;
        exit 1&lt;br /&gt;
    fi&lt;br /&gt;
    if [ ! -f $SOLRTAR ]; then&lt;br /&gt;
        wget http://www-us.apache.org/dist/lucene/solr/$SOLRVERSION/$SOLRTAR&lt;br /&gt;
    fi&lt;br /&gt;
    tar -xvzf $SOLRTAR&lt;br /&gt;
    cd $SOLRNAME&lt;br /&gt;
    bin/solr start&lt;br /&gt;
    bin/solr create -c $INDEXNAME&lt;br /&gt;
    # After setting it up and creating the index use:&lt;br /&gt;
    # - &amp;quot;/yourdirectory/solrdir/bin/solr start&amp;quot; from CLI to start the server&lt;br /&gt;
    # - &amp;quot;/yourdirectory/solrdir/bin/solr stop&amp;quot; from CLI to stop the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
======Solr 5/6 schema setup======&lt;br /&gt;
&lt;br /&gt;
Moodle will use Solr&#039;s managed schema interface to install the required fields. You will be directed on what to do from the Manage global search page.&lt;br /&gt;
&lt;br /&gt;
For very large or busy sites, it is recommended that you manually remove the &#039;&#039;&#039;_text_&#039;&#039;&#039; field, and associated copy directive from, the default Solr schema. This field is not used by Moodle, and will significantly slow indexing, and increase the size of the resulting Solr core.&lt;br /&gt;
&lt;br /&gt;
======Solr 4 schema setup======&lt;br /&gt;
&lt;br /&gt;
You cannot  use the schema setup script when using a Solr 4 server. If you really want to use the Solr 4x branch, here are the field types descriptions:&lt;br /&gt;
&lt;br /&gt;
Extracted from search/classes/document.php&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field name&lt;br /&gt;
! Field type&lt;br /&gt;
! Stored&lt;br /&gt;
! Indexed&lt;br /&gt;
! Query field&lt;br /&gt;
|-&lt;br /&gt;
| id&lt;br /&gt;
| org.apache.solr.schema.StrField&lt;br /&gt;
| true&lt;br /&gt;
| false&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| org.apache.solr.schema.TrieIntField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| title&lt;br /&gt;
| org.apache.solr.schema.TextField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| content&lt;br /&gt;
| org.apache.solr.schema.TextField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| contextid&lt;br /&gt;
| org.apache.solr.schema.TrieIntField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| areaid&lt;br /&gt;
| org.apache.solr.schema.StrField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| type&lt;br /&gt;
| org.apache.solr.schema.TrieIntField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| courseid&lt;br /&gt;
| org.apache.solr.schema.TrieIntField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| owneruserid&lt;br /&gt;
| org.apache.solr.schema.TrieIntField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| modified&lt;br /&gt;
| org.apache.solr.schema.TrieDateField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| userid&lt;br /&gt;
| org.apache.solr.schema.TrieIntField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| description1&lt;br /&gt;
| org.apache.solr.schema.TextField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| description2&lt;br /&gt;
| org.apache.solr.schema.TextField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
|-&lt;br /&gt;
| solr_filegroupingid&lt;br /&gt;
| org.apache.solr.schema.StrField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| solr_fileid&lt;br /&gt;
| org.apache.solr.schema.StrField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| solr_filecontenthash&lt;br /&gt;
| org.apache.solr.schema.StrField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| solr_fileindexstatus&lt;br /&gt;
| org.apache.solr.schema.TrieIntField&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
| false&lt;br /&gt;
|-&lt;br /&gt;
| solr_filecontent&lt;br /&gt;
| org.apache.solr.schema.TextField&lt;br /&gt;
| false&lt;br /&gt;
| true&lt;br /&gt;
| true&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
======Memory and File indexing considerations======&lt;br /&gt;
&lt;br /&gt;
For large sites, and particularly if you are using the File indexing feature, it&#039;s a good idea to give Solr plenty of memory, eg aound 10-20GB. To start Solr with more than its default 512MB of RAM, use the &#039;&#039;-m&#039;&#039; option: &lt;br /&gt;
 solr start -m 12g&lt;br /&gt;
&lt;br /&gt;
See the documents for your version of Solr on how to increases memory when Solr is started automatically.&lt;br /&gt;
&lt;br /&gt;
======Too many boolean clauses error======&lt;br /&gt;
&lt;br /&gt;
Because of the way Moodle handles permissions for searches, if you have non-admin users with access to a large number of activities (&amp;gt;1000), they may an error similar to the following:&lt;br /&gt;
&lt;br /&gt;
    The query you provided could not be parsed by the search engine: org.apache.solr.search.SyntaxError: Cannot parse &lt;br /&gt;
    ...&lt;br /&gt;
    too many boolean clauses&lt;br /&gt;
&lt;br /&gt;
To correct this, you need to increase the &#039;&#039;maxBooleanClauses&#039;&#039; setting in your Solr core. The setting is located in &#039;&#039;corename/conf/solrconfig.xml&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
This important note is included in the config file:&lt;br /&gt;
    ** WARNING **&lt;br /&gt;
    &lt;br /&gt;
    This option actually modifies a global Lucene property that&lt;br /&gt;
    will affect all SolrCores.  If multiple solrconfig.xml files&lt;br /&gt;
    disagree on this property, the value at any given moment will&lt;br /&gt;
    be based on the last SolrCore to be initialized.&lt;br /&gt;
&lt;br /&gt;
This means that for consistent behavior you should update this value for all cores in the Solr server.&lt;br /&gt;
&lt;br /&gt;
=====Commannd for installing Solr Server on Centos 7=====&lt;br /&gt;
First of all install java (openjdk)&lt;br /&gt;
 yum install java-1.8.0-openjdk&lt;br /&gt;
Add user for solr&lt;br /&gt;
 adduser solr&lt;br /&gt;
Download solr server, find latest here : http://lucene.apache.org/solr/mirrors-solr-latest-redir.html, from the list there download latest solr-[version].tgz&lt;br /&gt;
&lt;br /&gt;
Here is the list of needed commands (note that latest solr is suggested, change command to appropriate version) &lt;br /&gt;
 cd /opt&lt;br /&gt;
 wget http://www-eu.apache.org/dist/lucene/solr/6.6.0/solr-6.6.0.tgz&lt;br /&gt;
 tar zxvf solr-6.6.0.tgz&lt;br /&gt;
 cp solr-6.6.0/bin/install_solr_service.sh .&lt;br /&gt;
 rm -rf solr-6.6.0&lt;br /&gt;
 ./install_solr_service.sh solr-6.6.0.tgz&lt;br /&gt;
 chkconfig solr on&lt;br /&gt;
Create the index&lt;br /&gt;
 su - solr -c &amp;quot;/opt/solr/bin/solr create_core -c moodle&amp;quot;&lt;br /&gt;
Then go to your Moodle and set index name as created (moodle)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
Forum discussions:&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=334938 Global search doesn&#039;t index plugins?]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=339819 Global Search on Moodle 3.1]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=384884 Global Search index repair]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MySQL Database Connection error with Simple Search:&#039;&#039;&#039; This SQL query should solve the issue&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;ALTER TABLE mdl_search_simpledb_index ADD FULLTEXT(title, content, description1, description2)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A quick introduction to Moodle global search, followed by a description of the new features and fixes in Moodle 3.4 (and some of those in Moodle 3.5).&lt;br /&gt;
*[https://www.slideshare.net/sammarshall_ou/moodle-global-search-nows-the-time-to-jump-in Presentation by Sam Marshall from the Open University]&lt;br /&gt;
&lt;br /&gt;
[[es:Búsqueda global]]&lt;br /&gt;
[[de:Globale Suche]]&lt;br /&gt;
[[fr:Recherche globale]]&lt;/div&gt;</summary>
		<author><name>Dschwa</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Moodle_XML_format&amp;diff=135456</id>
		<title>Moodle XML format</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Moodle_XML_format&amp;diff=135456"/>
		<updated>2019-09-15T18:03:38Z</updated>

		<summary type="html">&lt;p&gt;Dschwa: /* Useful utilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Export questions}}&lt;br /&gt;
The XML Format is a Moodle-specific format for importing and exporting questions to be used with the [[Quiz module]]. The format has been developed within the Moodle Community but other software may support it to a greater or lesser degree.&lt;br /&gt;
&lt;br /&gt;
==A word about validity (and CDATA)==&lt;br /&gt;
&lt;br /&gt;
The XML parser assumes that the XML file is well formed and does not detect or report errors. If it is not you are very likely to get unexpected errors. If you are hand-coding the XML file it is strongly recommended that you pass it through some sort of XML verifier before importing into Moodle. A simple way to do this is to open the XML file using Firefox or Internet Explorer. &lt;br /&gt;
&lt;br /&gt;
Note particularly that embedded HTML fragments should be within [http://en.wikipedia.org/wiki/CDATA CDATA sections]. CDATA example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
 &amp;lt;questiontext format=&amp;quot;html&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;text&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
              Now I can include &amp;lt;strong&amp;gt;any&amp;lt;/strong&amp;gt; HTML that I&amp;lt;br /&amp;gt;&lt;br /&gt;
              wish. Without the CDATA, the &amp;lt;i&amp;gt;HTML&amp;lt;/i&amp;gt; tags would break&lt;br /&gt;
              the XML!!&lt;br /&gt;
              ]]&amp;gt;&lt;br /&gt;
        &amp;lt;/text&amp;gt;&lt;br /&gt;
 &amp;lt;/questiontext&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Overall structure of XML file==&lt;br /&gt;
&lt;br /&gt;
The file is enclosed by tags as follows. It is &#039;&#039;&#039;important&#039;&#039;&#039; to make sure the xml tag only is really the first line of the file. A blank first line, or additional tags on the first line will confuse the Moodle XML parser.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; ?&amp;gt;&lt;br /&gt;
&amp;lt;quiz&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
&amp;lt;/quiz&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Within the &amp;lt;quiz&amp;gt; tags are any number of &amp;lt;question&amp;gt; tags. One of these &amp;lt;question&amp;gt; tags can be a dummy question with a &#039;&#039;category&#039;&#039; type to specify a category for the import/export. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
&amp;lt;question type=&amp;quot;category&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;category&amp;gt;&lt;br /&gt;
        &amp;lt;text&amp;gt;$course$/XXXX&amp;lt;/text&amp;gt;&lt;br /&gt;
    &amp;lt;/category&amp;gt;&lt;br /&gt;
&amp;lt;/question&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where XXXX is the new category name. If the category exists, the question(s) will be added to the existing course; otherwise a new category will be created. This only works if you have &amp;quot;Get category from file&amp;quot; checked.&lt;br /&gt;
&lt;br /&gt;
Multiple categories can be specified in the same file. Just add another dummy &#039;category&#039; question each time you would like to establish a new category and the questions that follow it will be placed there.&lt;br /&gt;
&lt;br /&gt;
The file must be encoded in [[UTF8]]&lt;br /&gt;
&lt;br /&gt;
Moodle XML import and export are balanced in functionality, so if you need to understand the format you can simply create some questions and export them to see what it looks like.&lt;br /&gt;
&lt;br /&gt;
==Tags common to all question types==&lt;br /&gt;
&lt;br /&gt;
A question is written as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
&amp;lt;question type=&amp;quot;multichoice|truefalse|shortanswer|matching|cloze|essay|numerical|description&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;name&amp;gt;&lt;br /&gt;
         &amp;lt;text&amp;gt;Name of question&amp;lt;/text&amp;gt;&lt;br /&gt;
     &amp;lt;/name&amp;gt;&lt;br /&gt;
     &amp;lt;questiontext format=&amp;quot;html&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;text&amp;gt;What is the answer to this question?&amp;lt;/text&amp;gt;&lt;br /&gt;
     &amp;lt;/questiontext&amp;gt;&lt;br /&gt;
     .&lt;br /&gt;
     .&lt;br /&gt;
     .&lt;br /&gt;
&amp;lt;/question&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each question requires a &amp;lt;name&amp;gt; tag and &amp;lt;question-text&amp;gt; tag for the XML file to import into Moodle properly.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Format&amp;quot; selects the [[Formatting options]] for the question text. The options are &#039;&#039;&#039;html&#039;&#039;&#039; (the default), &#039;&#039;&#039;moodle_auto_format&#039;&#039;&#039;, &#039;&#039;&#039;plain_text&#039;&#039;&#039; and &#039;&#039;&#039;markdown&#039;&#039;&#039;. The choice effects the way in which the text will be displayed. &lt;br /&gt;
&lt;br /&gt;
Further tags, which usually include at least one &amp;lt;answer&amp;gt; tag, follow in the space marked with dots as child nodes to the &amp;lt;question&amp;gt; tag. The response-related tags are listed further down on this page. Various (optional?) tags are possible. &lt;br /&gt;
&lt;br /&gt;
* tags (non-hierarchical keywords)&lt;br /&gt;
* penalty&lt;br /&gt;
* generalfeedback&lt;br /&gt;
* defaultgrade&lt;br /&gt;
* hidden&lt;br /&gt;
&lt;br /&gt;
Even though question tags (non-hierarchical keyowords) are not fully supported in the question engine, they can be imported and exported via XML. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
&amp;lt;question ...&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
  &amp;lt;tags&amp;gt;&lt;br /&gt;
    &amp;lt;tag&amp;gt;&lt;br /&gt;
      &amp;lt;text&amp;gt;keyword1&amp;lt;/text&amp;gt;&lt;br /&gt;
    &amp;lt;/tag&amp;gt;&lt;br /&gt;
    &amp;lt;tag&amp;gt;&lt;br /&gt;
      &amp;lt;text&amp;gt;keyword2&amp;lt;/text&amp;gt;&lt;br /&gt;
    &amp;lt;/tag&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
  &amp;lt;/tags&amp;gt;&lt;br /&gt;
  ...&lt;br /&gt;
&amp;lt;/question&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;image&amp;gt; tag contains the url of any included image. Nested within the &amp;lt;image&amp;gt; tag may be an &amp;lt;image_base64&amp;gt; tag which contains the actual image data encoded in base64 [http://www.php.net/manual/en/function.base64-encode.php].&lt;br /&gt;
&lt;br /&gt;
{{Note|If you export questions from a Moodle 1.9 server, the exported file might contain only the relative URL to the image hosted in the 1.9 server, while exported questions from Moodle 2.x and 3.x severs might contain the actual image encoded in base 64. This explains why some question bank import-export operations include all the images and some others don&#039;t.}}&lt;br /&gt;
&#039;&#039;&#039;In the following question type examples the common parts of the question are not shown to improve clarity. It&#039;s a good idea to export some examples yourself to see a full example.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
&lt;br /&gt;
MC questions have one &amp;lt;answer&amp;gt; tag for each choice. Each choice can carry feedback and score weighting (by using the fraction attribute). In addition, an MC question has the following tags:&lt;br /&gt;
&lt;br /&gt;
* single &#039;&#039;(values: true/false)&#039;&#039;&lt;br /&gt;
* shuffleanswers &#039;&#039;(values: 1/0)&#039;&#039;&lt;br /&gt;
* correctfeedback &lt;br /&gt;
* partiallycorrectfeedback &lt;br /&gt;
* incorrectfeedback&lt;br /&gt;
* answernumbering (allowed values: &#039;none&#039;, &#039;abc&#039;, &#039;ABCD&#039; or &#039;123&#039;)&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;single&amp;gt; tag is used to distinguish single response (radio button) and multiple response (checkbox) variants.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
&amp;lt;question type=&amp;quot;multichoice&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;answer fraction=&amp;quot;100&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;text&amp;gt;The correct answer&amp;lt;/text&amp;gt;&lt;br /&gt;
    &amp;lt;feedback&amp;gt;&amp;lt;text&amp;gt;Correct!&amp;lt;/text&amp;gt;&amp;lt;/feedback&amp;gt;&lt;br /&gt;
 &amp;lt;/answer&amp;gt;&lt;br /&gt;
 &amp;lt;answer fraction=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;text&amp;gt;A distractor&amp;lt;/text&amp;gt;&lt;br /&gt;
    &amp;lt;feedback&amp;gt;&amp;lt;text&amp;gt;Ooops!&amp;lt;/text&amp;gt;&amp;lt;/feedback&amp;gt;&lt;br /&gt;
 &amp;lt;/answer&amp;gt;&lt;br /&gt;
 &amp;lt;answer fraction=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;text&amp;gt;Another distractor&amp;lt;/text&amp;gt;&lt;br /&gt;
    &amp;lt;feedback&amp;gt;&amp;lt;text&amp;gt;Ooops!&amp;lt;/text&amp;gt;&amp;lt;/feedback&amp;gt;&lt;br /&gt;
 &amp;lt;/answer&amp;gt;&lt;br /&gt;
 &amp;lt;shuffleanswers&amp;gt;1&amp;lt;/shuffleanswers&amp;gt;&lt;br /&gt;
 &amp;lt;single&amp;gt;true&amp;lt;/single&amp;gt;&lt;br /&gt;
 &amp;lt;answernumbering&amp;gt;abc&amp;lt;/answernumbering&amp;gt;&lt;br /&gt;
&amp;lt;/question&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== True/false ==&lt;br /&gt;
&lt;br /&gt;
Two answer tags are given, one which is true, and one which is false. The fraction attribute of the answer tag identifies which option is correct (100) and which is false (0). Feedback is supported. The following example shows the format when true is the correct answer and false is wrong.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
 &amp;lt;question type=&amp;quot;truefalse&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;answer fraction=&amp;quot;100&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;text&amp;gt;true&amp;lt;/text&amp;gt;&lt;br /&gt;
    &amp;lt;feedback&amp;gt;&amp;lt;text&amp;gt;Correct!&amp;lt;/text&amp;gt;&amp;lt;/feedback&amp;gt;&lt;br /&gt;
 &amp;lt;/answer&amp;gt;&lt;br /&gt;
 &amp;lt;answer fraction=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;text&amp;gt;false&amp;lt;/text&amp;gt;&lt;br /&gt;
    &amp;lt;feedback&amp;gt;&amp;lt;text&amp;gt;Ooops!&amp;lt;/text&amp;gt;&amp;lt;/feedback&amp;gt;&lt;br /&gt;
 &amp;lt;/answer&amp;gt;&lt;br /&gt;
&amp;lt;/question&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Short answer  ==&lt;br /&gt;
&lt;br /&gt;
The short answer question type supports alternative correct responses, each with its own weighting and feedback.  The Moodle XML format uses one &amp;lt;answer&amp;gt; tag for each of the alternative correct answers.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;usecase&amp;gt; tag toggles case-sensitivity with the values 1/0. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
 &amp;lt;question type=&amp;quot;shortanswer&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;answer fraction=&amp;quot;100&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;text&amp;gt;The correct answer&amp;lt;/text&amp;gt;&lt;br /&gt;
     &amp;lt;feedback&amp;gt;&amp;lt;text&amp;gt;Correct!&amp;lt;/text&amp;gt;&amp;lt;/feedback&amp;gt;&lt;br /&gt;
 &amp;lt;/answer&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;question type=&amp;quot;shortanswer&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;answer fraction=&amp;quot;100&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;text&amp;gt;The correct answer&amp;lt;/text&amp;gt;&lt;br /&gt;
     &amp;lt;feedback&amp;gt;&amp;lt;text&amp;gt;Correct!&amp;lt;/text&amp;gt;&amp;lt;/feedback&amp;gt;&lt;br /&gt;
 &amp;lt;/answer&amp;gt;&lt;br /&gt;
 &amp;lt;answer fraction=&amp;quot;100&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;text&amp;gt;An alternative answer&amp;lt;/text&amp;gt;&lt;br /&gt;
     &amp;lt;feedback&amp;gt;&amp;lt;text&amp;gt;Correct!&amp;lt;/text&amp;gt;&amp;lt;/feedback&amp;gt;&lt;br /&gt;
 &amp;lt;/answer&amp;gt;&lt;br /&gt;
&amp;lt;/question&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Numerical response ==&lt;br /&gt;
&lt;br /&gt;
The following is a simplified version of the Moodle XML format for numerical responses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
 &amp;lt;question type=&amp;quot;numerical&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;answer fraction=&amp;quot;100&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;text&amp;gt;23&amp;lt;/text&amp;gt;&lt;br /&gt;
     &amp;lt;feedback&amp;gt;&amp;lt;text&amp;gt;Feedback&amp;lt;/text&amp;gt;&amp;lt;/feedback&amp;gt;&lt;br /&gt;
 &amp;lt;/answer&amp;gt;&lt;br /&gt;
&amp;lt;/question&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moodle also supports a &amp;lt;tolerance&amp;gt; tag (how accurate must the number be?) and one or more &amp;lt;unit&amp;gt; tags. Unit tags have names and multipliers. E.g. if the main answer is in kilometres, an additional answer could be the equivalent in metres with a multiplier of 1000.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; prior to 1.7.2 the fraction was expressed as a value between 0 and 1 in a &amp;lt;fraction&amp;gt; element and the answer value was &#039;&#039;&#039;not&#039;&#039;&#039; enclosed in &amp;lt;text&amp;gt; tags. This format of the numerical question type is deprecated but will still be correctly imported if found (for now).&lt;br /&gt;
&lt;br /&gt;
== Matching ==&lt;br /&gt;
&lt;br /&gt;
Pair matching responses use the &amp;lt;shuffleanswers&amp;gt; tag to determine whether the order of the items should be randomized.&lt;br /&gt;
Each pair is contained inside a &amp;lt;subquestion&amp;gt; tag. The first item of each pair is contained with a &amp;lt;text&amp;gt; tag, while the second has an &amp;lt;answer&amp;gt; tag around it as well. Feedback and score weighting is not supported by Moodle for this response type.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
 &amp;lt;question type=&amp;quot;matching&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;subquestion&amp;gt;&lt;br /&gt;
     &amp;lt;text&amp;gt;This is the 1st item in the 1st pair.&amp;lt;/text&amp;gt;&lt;br /&gt;
     &amp;lt;answer&amp;gt;&lt;br /&gt;
         &amp;lt;text&amp;gt;This is the 2nd item in the 1st pair.&amp;lt;/text&amp;gt;&lt;br /&gt;
     &amp;lt;/answer&amp;gt;&lt;br /&gt;
 &amp;lt;/subquestion&amp;gt;&lt;br /&gt;
 &amp;lt;subquestion&amp;gt;&lt;br /&gt;
     &amp;lt;text&amp;gt;This is the 1st item in the 2nd pair.&amp;lt;/text&amp;gt;&lt;br /&gt;
     &amp;lt;answer&amp;gt;&lt;br /&gt;
         &amp;lt;text&amp;gt;This is the 2nd item in the 2nd pair.&amp;lt;/text&amp;gt;&lt;br /&gt;
     &amp;lt;/answer&amp;gt;&lt;br /&gt;
 &amp;lt;/subquestion&amp;gt;&lt;br /&gt;
 &amp;lt;shuffleanswers&amp;gt;true&amp;lt;/shuffleanswers&amp;gt;&lt;br /&gt;
&amp;lt;/question&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Essay ==&lt;br /&gt;
&lt;br /&gt;
An example of the essay type question...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code xml&amp;gt;&lt;br /&gt;
  &amp;lt;question type=&amp;quot;essay&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;answer fraction=&amp;quot;0&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;text&amp;gt;&amp;lt;/text&amp;gt;&lt;br /&gt;
    &amp;lt;/answer&amp;gt;&lt;br /&gt;
  &amp;lt;/question&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There isn&#039;t an answer and there isn&#039;t a grade in this case. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; prior to 1.7.2 the fraction was expressed as a value between 0 and 1 in a &amp;lt;fraction&amp;gt; element and the answer value was &#039;&#039;&#039;not&#039;&#039;&#039; enclosed in &amp;lt;text&amp;gt; tags. This format of the essay question type is deprecated but will still be correctly imported if found (for now).&lt;br /&gt;
&lt;br /&gt;
== Other question types ==&lt;br /&gt;
&lt;br /&gt;
=== Cloze ===&lt;br /&gt;
&lt;br /&gt;
It is supported, and depends on a special format for the &amp;lt;questiontext&amp;gt; tag.&lt;br /&gt;
&lt;br /&gt;
=== Description response type===&lt;br /&gt;
&lt;br /&gt;
This response type has no further tags other than those contained in the question header (such as &amp;lt;questiontext&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Random matching ===&lt;br /&gt;
&lt;br /&gt;
Moodle has a question type which consists of taking short answer questions in the same quiz and displaying them as a pair matching exercise. However Moodle is neither able to export nor import this question type.&lt;br /&gt;
&lt;br /&gt;
==Text formats==&lt;br /&gt;
&lt;br /&gt;
Moodle XML files should explicity specify the text format (&#039;&#039;&#039;html&#039;&#039;&#039;, &#039;&#039;&#039;moodle_auto_format&#039;&#039;&#039;, &#039;&#039;&#039;plain_text&#039;&#039;&#039; and &#039;&#039;&#039;markdown&#039;&#039;&#039; - these correspond to the constants , FORMAT_HTML, FORMAT_MOODLE, etc used in the Moodle code) for each piece of content. Note that, by default, the format should be specified on the parent of the &amp;lt;text&amp;gt; element. This is slightly odd, but a remnant of history.&lt;br /&gt;
&lt;br /&gt;
If the format is not specified for the questiontext, then &#039;&#039;&#039;html&#039;&#039;&#039; is the default. If the format is not specified on any other part of the question, then the format of the questiontext is the default.&lt;br /&gt;
&lt;br /&gt;
(This default changed around November 2011. Before that, the default was &#039;&#039;&#039;moodle_auto_format&#039;&#039;&#039; whenever the format was not specified.)&lt;br /&gt;
&lt;br /&gt;
==Useful utilities==&lt;br /&gt;
*[http://vletools.com Online Moodle XML converter] Convert from existing text files glossaries and quizzes to Moodle XML format. Also can convert from Moodle XMl to text. &lt;br /&gt;
*[http://finemetronome.com/moodle/ Word Template for generating Moodle XML].- URL appears to be degraded and no longer working&lt;br /&gt;
*[http://www.learningseekers.com/products MoXMLE - A Java based application] MoXMLE is a Java based application that converts a Simple TXT file into a Moodle XML format.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [http://www.qedoc.org/index.php?title=Moodle_XML_format Quedoc&#039;s Moodle XML documentation]&lt;br /&gt;
* [[User:Frank Ralf/Moodle XML1]] (work in progress)&lt;br /&gt;
*[[Aiken format]]&lt;br /&gt;
*[[XML FAQ]]&lt;br /&gt;
*[[Import and export FAQ]] &lt;br /&gt;
&lt;br /&gt;
[[ja:Moodle XMLフォーマット]]&lt;br /&gt;
[[de: Moodle XML-Format]]&lt;br /&gt;
[[fr:Format XML Moodle]]&lt;br /&gt;
[[es:Formato Moodle XML]]&lt;/div&gt;</summary>
		<author><name>Dschwa</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Git_for_Administrators&amp;diff=131642</id>
		<title>Git for Administrators</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Git_for_Administrators&amp;diff=131642"/>
		<updated>2018-08-08T15:09:28Z</updated>

		<summary type="html">&lt;p&gt;Dschwa: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
This page describes how to maintain a copy of Moodle on your production server which can easily be upgraded using Git. If you have customisations of Moodle core code, you are advised to follow the instructions in the [[:dev:Git for developers|Git for developers guide]].&lt;br /&gt;
&lt;br /&gt;
To get the most of Git it is worth making the effort to understand its basic concepts - see the section below. It can be a bit of a steep learning curve, especially if you are used to CVS or Subversion. &lt;br /&gt;
&lt;br /&gt;
== Getting hold of Git (Windows, OSX, Linux and others) ==&lt;br /&gt;
&lt;br /&gt;
Support for Git was, up until recently, mostly confined to Linux but builds are now available for most popular operating systems:&lt;br /&gt;
&lt;br /&gt;
* List of downloads from Git site - http://git-scm.com/download&lt;br /&gt;
&lt;br /&gt;
Once you have downloaded and installed your OS relevant git installation, the git commands in this document should work with your operating system.&lt;br /&gt;
&lt;br /&gt;
== Obtaining the code from Git ==&lt;br /&gt;
&lt;br /&gt;
The command line version of Git is discussed here. Graphical clients are little more than wrappers around the command line version, so you should be able to deduce the correct parameters quite easily. &lt;br /&gt;
&lt;br /&gt;
You can find the official Moodle git repository at git://git.moodle.org/moodle.git (with an official clone at git://github.com/moodle/moodle.git). To initialize your local checkout, use&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cd /path/to/your/webroot&lt;br /&gt;
$ git clone git://git.moodle.org/moodle.git                       (1)&lt;br /&gt;
$ cd moodle&lt;br /&gt;
$ git branch -a                                                   (2)&lt;br /&gt;
$ git branch --track MOODLE_35_STABLE origin/MOODLE_35_STABLE     (3)&lt;br /&gt;
$ git checkout MOODLE_35_STABLE                                   (4)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* The command (1) initializes the new local repository as a clone of the &#039;upstream&#039; (i.e. the remote server based) moodle.git repository. The upstream repository is called &#039;origin&#039; by default. It creates a new directory named &#039;&#039;moodle&#039;&#039;, where it downloads all the files. This operation can take a while as it is actually getting the entire history of all Moodle versions&lt;br /&gt;
* The command (2) lists all available branches.&lt;br /&gt;
* Use the command (3) to create a new local branch called MOODLE_35_STABLE and set it to track the remote branch MOODLE_35_STABLE from the upstream repository.&lt;br /&gt;
* The command (4) actually switches to the newly created local branch. &lt;br /&gt;
==Git Connection Refused Error==&lt;br /&gt;
*If connection refused, use: $ git clone https://github.com/moodle/moodle.git&lt;br /&gt;
&#039;&#039;fatal: unable to connect to git.moodle.org:&lt;br /&gt;
git.moodle.org[0: 34.210.133.53]: errno=Connection refused&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Note that Git has a huge number of options for each command and it&#039;s actually possible to do the above process with a single command (left as an exercise!!).&lt;br /&gt;
&lt;br /&gt;
==Git from behind a firewall==&lt;br /&gt;
&lt;br /&gt;
Git uses a read-only protocol that may be blocked by your firewall (port 9418). If this is a problem, you can use Github&#039;s http version &amp;lt;nowiki&amp;gt;https://github.com/moodle/moodle.git&amp;lt;/nowiki&amp;gt;. It&#039;s a bit slower, so use the Git protocol if you can.&lt;br /&gt;
&lt;br /&gt;
== Updating your installation ==&lt;br /&gt;
&lt;br /&gt;
The Moodle development team performs integration and testing of fixed bugs every Monday and Tuesday. On Wednesday you can install all patches by updating your code. Check the [http://git.moodle.org/gw?p=moodle.git;a=summary shortlog] to see if the official repository has been already updated or not.&lt;br /&gt;
&lt;br /&gt;
To update your code to the latest version (on the MOODLE_35_STABLE branch) &#039;&#039;&#039;all&#039;&#039;&#039; you have to do is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cd /path/to/your/moodle/&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If this is a production site you should still consider the [[Upgrade]] instructions (e.g. take backups).&lt;br /&gt;
&lt;br /&gt;
== Installing a contributed extension from its Git repository ==&lt;br /&gt;
&lt;br /&gt;
This is one way to handle adding plugins from other Git repositories into your Moodle repository. Another way is to use Git Submodules. However, at the time of writing, this is one of Git&#039;s rougher features and should be regarded as an advanced option. &lt;br /&gt;
&lt;br /&gt;
For example, let us say we want to install the [[Certificate module]] from its Git repository into our Moodle {{Version}}.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cd /path/to/your/moodle/&lt;br /&gt;
$ cd mod                                                          (1)&lt;br /&gt;
$ git clone https://github.com/markn86/moodle-mod_certificate.git certificate     (2)&lt;br /&gt;
$ cd certificate&lt;br /&gt;
$ git checkout -b MOODLE_35_STABLE origin/MOODLE_35_STABLE        (3)&lt;br /&gt;
$ git branch -d master                                            (4)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The command (1) changes the current directory into the &#039;&#039;mod&#039;&#039; folder of your local Moodle clone. The command (2) creates a new subdirectory &#039;&#039;certificate&#039;&#039; and makes a local clone of vanilla Certificate repository. The command (3) creates a new local branch that will track the remote branch with a Certificate version for Moodle {{Version}}. The command (4) deletes the &#039;&#039;master&#039;&#039; that was created automatically by git-clone in (2) as we do not want it in this production checkout.&lt;br /&gt;
&lt;br /&gt;
Note: you should check first the compatibility of a module with your Moodle branch by asking directly to the Maintainer before cloning the repo or - if you want to guess it - by issuing the command below before running the command (3), in order to verify what is available among the branches:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
* master&lt;br /&gt;
  remotes/origin/HEAD -&amp;gt; origin/master&lt;br /&gt;
  remotes/origin/MOODLE_20_STABLE&lt;br /&gt;
  remotes/origin/MOODLE_21_STABLE&lt;br /&gt;
  remotes/origin/MOODLE_22_STABLE&lt;br /&gt;
  remotes/origin/MOODLE_23_STABLE&lt;br /&gt;
  remotes/origin/MOODLE_24_STABLE&lt;br /&gt;
  remotes/origin/MOODLE_25_STABLE&lt;br /&gt;
  remotes/origin/MOODLE_26_STABLE&lt;br /&gt;
  remotes/origin/MOODLE_27_STABLE&lt;br /&gt;
  remotes/origin/MOODLE_28_STABLE&lt;br /&gt;
  remotes/origin/MOODLE_29_STABLE&lt;br /&gt;
  remotes/origin/MOODLE_30_STABLE&lt;br /&gt;
 remotes/origin/MOODLE_31_STABLE&lt;br /&gt;
  remotes/origin/master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will avoid an error message when you issue the command (3) against a nonexistent branch, e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
§ git checkout -b MOODLE_31_STABLE origin/MOODLE_31_STABLE&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/MOODLE_31_STABLE&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Note: To fix above error, use: &amp;quot;git fetch origin MOODLE_31_STABLE:LOCAL_MOODLE_31_STABLE&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Now it is wise to add the new directory mod/certificate/ to the list of ignored files of the main Moodle clone, otherwise a status of the main clone will keep reminding you that the new code has not been checked in.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cd /path/to/your/moodle/&lt;br /&gt;
$ echo /mod/certificate/ &amp;gt;&amp;gt; .git/info/exclude&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
To update your Moodle installation now, you must visit both Git repositories and pull changes from upstream.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cd /path/to/your/moodle/&lt;br /&gt;
$ git pull&lt;br /&gt;
$ cd mod/certificate&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Writing a shell script with these lines in the root of Moodle installation is a very good idea. Otherwise it is easy to forget what Git repositories are there within the main Moodle repository.&lt;br /&gt;
&lt;br /&gt;
== Installing and maintaining contributed extensions using Git submodules ==&lt;br /&gt;
&lt;br /&gt;
As it was said in the previous section, this is for advanced users only.&lt;br /&gt;
Therefore it is necessary, that you have some experience with Git and its commands.&lt;br /&gt;
A step-by-step explanation will be provided, but in order to follow these steps it is helpful to understand, what these commands do.&lt;br /&gt;
&lt;br /&gt;
Advanced options and commands can be found at [[https://git-scm.com/book/en/v2/Git-Tools-Submodules|the Git book]].&lt;br /&gt;
If you have any questions about Git submodules, please visit the site above first.&lt;br /&gt;
&lt;br /&gt;
=== Installing a new extension into an existing Moodle ===&lt;br /&gt;
&lt;br /&gt;
As an example we use the [[Certificate module]] from the previous section.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cd /path/to/your/moodle&lt;br /&gt;
$ git submodule add https://github.com/markn86/moodle-mod_certificate.git mod/certificate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, that Git is reporting two new files in the repository:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
# On branch MOODLE_29_STABLE&lt;br /&gt;
# Changes to be committed:&lt;br /&gt;
#   (use &amp;quot;git reset HEAD &amp;lt;file&amp;gt;...&amp;quot; to unstage)&lt;br /&gt;
#&lt;br /&gt;
#	new file:   .gitmodules&lt;br /&gt;
#	new file:   mod/certificate&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file &#039;&#039;&#039;.gitmodules&#039;&#039;&#039; contains the local path and url of all your submodules.&lt;br /&gt;
It has to be commited, if you intend to clone the repository later (see the page [[Moodle development environment with Git submodules]]).&lt;br /&gt;
Before commiting, make sure to check the configuration of the plugin&#039;s Git repository, since the automatically generated settings may be not sufficient.&lt;br /&gt;
For future updates it is helpful, to track the remote branch, which corresponds to the Moodle version of your repository.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cd mod/certificate&lt;br /&gt;
$ git branch -avv&lt;br /&gt;
* master                          345f5b1 [origin/master] Replaced deprecated function&lt;br /&gt;
  remotes/origin/HEAD             -&amp;gt; origin/master&lt;br /&gt;
  remotes/origin/MOODLE_20_STABLE 1aa1040 Added option to print &#039;grade category&#039; grade&lt;br /&gt;
  remotes/origin/MOODLE_21_STABLE 1aa1040 Added option to print &#039;grade category&#039; grade&lt;br /&gt;
  remotes/origin/MOODLE_22_STABLE 1aa1040 Added option to print &#039;grade category&#039; grade&lt;br /&gt;
  remotes/origin/MOODLE_23_STABLE fe047de Check that the function exists rather than relying on the Moodle version&lt;br /&gt;
  remotes/origin/MOODLE_24_STABLE 1051f7d CONTRIB-4892 Fixed the email to others functionality&lt;br /&gt;
  remotes/origin/MOODLE_25_STABLE cdb221a CONTRIB-4946: Removed character from language file breaking AMOS&lt;br /&gt;
  remotes/origin/MOODLE_26_STABLE 696802a Increased version&lt;br /&gt;
  remotes/origin/MOODLE_27_STABLE d3c0379 Increased version&lt;br /&gt;
  remotes/origin/MOODLE_28_STABLE fa8df83 Increased version&lt;br /&gt;
  remotes/origin/MOODLE_29_STABLE 3f03740 Replaced deprecated function&lt;br /&gt;
  remotes/origin/master           345f5b1 Replaced deprecated function&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Git created the branch &#039;&#039;&#039;master&#039;&#039;&#039; which tracks &#039;&#039;&#039;origin/master&#039;&#039;&#039; automatically, because the remote repository has checked out &#039;&#039;&#039;master&#039;&#039;&#039;.&lt;br /&gt;
Therefore, create a new branch, which tracks the appropriate remote branch.&lt;br /&gt;
Of course, this is only possible, if the remote repository offers those branches. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ git checkout -b MOODLE_29_STABLE origin/MOODLE_29_STABLE&lt;br /&gt;
Branch MOODLE_29_STABLE set up to track remote branch MOODLE_29_STABLE from origin.&lt;br /&gt;
Switched to a new branch &#039;MOODLE_29_STABLE&#039;&lt;br /&gt;
$ git branch -D master&lt;br /&gt;
Deleted branch master (was 345f5b1).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It is not necessary to delete the &#039;&#039;&#039;master&#039;&#039;&#039; branch, but it&#039;s useless to keep it.&lt;br /&gt;
In fact, these settings don&#039;t need to be touched afterwards.&lt;br /&gt;
&lt;br /&gt;
The final step is to commit the changes to the main repository.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cd /path/to/your/moodle&lt;br /&gt;
$ git commit -a -m &amp;quot;New extension mod_certificate installed&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It has to be ensured, that the commit includes only the changes for the new Git submodule (since &#039;&#039;&#039;-a&#039;&#039;&#039; commits all non-staged changes).&lt;br /&gt;
&lt;br /&gt;
=== Maintaining Git submodules ===&lt;br /&gt;
&lt;br /&gt;
Maintaining a set of submodules is extremly easy.&lt;br /&gt;
Consider a Moodle repository with several submodules installed.&lt;br /&gt;
Keep in mind, that the extension &#039;&#039;&#039;mod_mylittleextension&#039;&#039;&#039; is a fake plugin, created for a test scenario in this example.&lt;br /&gt;
It is not an official Moodle module. For updating all your submodules at once, type in:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cd /path/to/your/moodle&lt;br /&gt;
$ git submodule foreach git pull&lt;br /&gt;
Entering &#039;block/coursefeedback&#039;&lt;br /&gt;
Already up-to-date.&lt;br /&gt;
Entering &#039;mod/certificate&#039;&lt;br /&gt;
Already up-to-date.&lt;br /&gt;
Entering &#039;mod/mylittleextension&#039;&lt;br /&gt;
remote: Counting objects: 6, done.&lt;br /&gt;
remote: Compressing objects: 100% (4/4), done.&lt;br /&gt;
remote: Total 4 (delta 0), reused 0 (delta 0)&lt;br /&gt;
Unpacking objects: 100% (4/4), done.&lt;br /&gt;
From /local/repositories/mle&lt;br /&gt;
   89d9eae..64c122d  master     -&amp;gt; origin/master&lt;br /&gt;
Updating 89d9eae..64c122d&lt;br /&gt;
Fast-forward&lt;br /&gt;
 index.html  |    9 +++++++++&lt;br /&gt;
 version.php |    6 +++---&lt;br /&gt;
 2 files changed, 12 insertions(+), 3 deletions(-)&lt;br /&gt;
 create mode 100644 index.html&lt;br /&gt;
$ git status&lt;br /&gt;
# On branch MOODLE_29_STABLE&lt;br /&gt;
# Changes not staged for commit:&lt;br /&gt;
#   (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)&lt;br /&gt;
#   (use &amp;quot;git checkout -- &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)&lt;br /&gt;
#&lt;br /&gt;
#	modified:   mod/mylittleextension (new commits)&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;git submodule foreach [another command]&#039;&#039;&#039; walks through all submodule repositiories and executes what is specified by &#039;&#039;&#039;[another command]&#039;&#039;&#039;.&lt;br /&gt;
In this case it is &#039;&#039;&#039;git pull&#039;&#039;&#039;.&lt;br /&gt;
Therefore the module mylittleextension was updated and the main repository isn&#039;t clean anymore until changes are committed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ git commit -a -m &amp;quot;Plugin updates&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maintaining plugins with Git submodules has also another application than simplyfying the update process.&lt;br /&gt;
In a greater scale it can be used to maintain a Moodle project, where multiple developers need to have an exact copy of your moodle without organizing external plugins manually.&lt;br /&gt;
You can read more about this topic at the page [[Moodle development environment with Git submodules]].&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Windows installation using Git]]&lt;br /&gt;
* [[Git for Mac]]&lt;br /&gt;
* [[:dev:Moodle versions]]&lt;br /&gt;
* For fixing a Tracker Issue (MDL) / Forking Moodle / CONTRIButing code [[:dev:User:Sam_Hemelryk/My_Moodle_Git_workflow|User:Sam_Hemelryk/My_Moodle_Git_workflow]]&lt;br /&gt;
* [[Moodle_Production_Server_with_GIT|Case study Git + Moodle from Technical University Berlin]]&lt;br /&gt;
&lt;br /&gt;
; Moodle forum discussions&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=255175 Github and Moodle deployment for production]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=168094 GIT help needed]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=231046 Clear git guide for Admins (not developers)]&lt;br /&gt;
&lt;br /&gt;
; External resources &lt;br /&gt;
* [http://thamblings.blogspot.com.au/2013/07/upgrading-moodle-from-git.html Deploying Moodle from git - Blog post from a production experience]&lt;br /&gt;
* [http://gitref.org/ Git Reference]&lt;br /&gt;
* [http://progit.org/book/ Pro Git book]&lt;br /&gt;
&lt;br /&gt;
[[ja:管理者用Git]]&lt;br /&gt;
[[fr:Git_pour_administrateurs]]&lt;br /&gt;
[[es:Git para Administradores]]&lt;/div&gt;</summary>
		<author><name>Dschwa</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=Word_censorship_filter&amp;diff=130880</id>
		<title>Word censorship filter</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=Word_censorship_filter&amp;diff=130880"/>
		<updated>2018-04-20T13:09:38Z</updated>

		<summary type="html">&lt;p&gt;Dschwa: /* Tips and Tricks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Filters}}&lt;br /&gt;
The word censorship filter enables certain user-selected words to be &amp;quot;blacked out&amp;quot; in the flow of any text submitted within a course. The primary use is for censoring obscene or other unwanted words entered by learners in activities like Forums and Wikis.&lt;br /&gt;
&lt;br /&gt;
==Custom list of censored Words==&lt;br /&gt;
&lt;br /&gt;
The word censorship settings page &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Word censorship&#039;&#039; allows a site administrator to edit a custom list of words (bad words) to be censored within your Moodle installation.&lt;br /&gt;
&lt;br /&gt;
To avoid inadvertently causing offence, there is no default bad word list on the Word censorship settings page.  If the custom list is empty, the default list from the language pack will be used.&lt;br /&gt;
&lt;br /&gt;
==Default censored Words==&lt;br /&gt;
&lt;br /&gt;
The default bad word list is contained within the censor.php file within each language pack installed on your Moodle site. To change the default bad word list go to &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Language &amp;gt; Language Customization&#039;&#039; and check out the required language pack.  Select the censor.php file under the &#039;&#039;&#039;filters&#039;&#039;&#039; subheading from the strings list and click &#039;&#039;&#039;Show strings&#039;&#039;&#039;.  Warning: You may find the content of this file offensive.&lt;br /&gt;
&lt;br /&gt;
==Tips and Tricks==&lt;br /&gt;
*If you would prefer not to display a custom list of censored words on the Word Censorship Settings page, customize the censor.php file the language directly&lt;br /&gt;
*If you have multiple language packs installed and in use within your Moodle site, remember to edit each language pack and/or add custom censored words in all languages.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=79711 filtering profanity] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[Category:Site administration]]&lt;br /&gt;
&lt;br /&gt;
[[de:Wortzensur]]&lt;br /&gt;
[[es:Palabras censuradas (filtro)]]&lt;br /&gt;
[[fr:Filtre censure de mots inadéquats]]&lt;br /&gt;
[[ja:ワードセンサーシップ]]&lt;/div&gt;</summary>
		<author><name>Dschwa</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=ad-hoc_contributed_reports&amp;diff=73404</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=ad-hoc_contributed_reports&amp;diff=73404"/>
		<updated>2010-06-28T13:46:00Z</updated>

		<summary type="html">&lt;p&gt;Dschwa: &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;/div&gt;</summary>
		<author><name>Dschwa</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=ad-hoc_contributed_reports&amp;diff=73403</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=ad-hoc_contributed_reports&amp;diff=73403"/>
		<updated>2010-06-28T13:45:40Z</updated>

		<summary type="html">&lt;p&gt;Dschwa: /* = */&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;
===Your Personal Resource View Report &amp;quot;Where did I leave off?&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;This report we wrote returns errors.&#039;&#039;&#039;  It is showing resource views that never happened. &#039;&#039;&#039;DO NOT USE&#039;&#039;&#039;.  I can delete it or people can look at the code here.  I&#039;ll be posting it in the forums for some debug.&lt;/div&gt;</summary>
		<author><name>Dschwa</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=ad-hoc_contributed_reports&amp;diff=73402</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=ad-hoc_contributed_reports&amp;diff=73402"/>
		<updated>2010-06-28T13:44:56Z</updated>

		<summary type="html">&lt;p&gt;Dschwa: /* Your Personal Resource View Report &amp;quot;Where did I leave off?&amp;quot; */&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;
===Your Personal Resource View Report &amp;quot;Where did I leave off?&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;This report we wrote returns errors.&#039;&#039;&#039;  It is showing resource views that never happened. &#039;&#039;&#039;DO NOT USE&#039;&#039;&#039;.  I can delete it or people can look at the code here.  I&#039;ll be posting it in the forums for some debug.&lt;br /&gt;
===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT FROM_UNIXTIME(prefix_log.time),&lt;br /&gt;
prefix_user.firstname,&lt;br /&gt;
prefix_user.lastname,&lt;br /&gt;
prefix_course.fullname,&lt;br /&gt;
prefix_resource.name&lt;br /&gt;
FROM prefix_log&lt;br /&gt;
INNER JOIN prefix_user ON prefix_log.userid=prefix_user.id&lt;br /&gt;
INNER JOIN prefix_course ON prefix_log.course=prefix_course.id&lt;br /&gt;
INNER JOIN prefix_resource ON prefix_log.info=prefix_resource.id&lt;br /&gt;
Where userid = %%USERID%%&lt;br /&gt;
ORDER by FROM_UNIXTIME(prefix_log.time)DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Report]]&lt;/div&gt;</summary>
		<author><name>Dschwa</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/39/en/index.php?title=ad-hoc_contributed_reports&amp;diff=73243</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/39/en/index.php?title=ad-hoc_contributed_reports&amp;diff=73243"/>
		<updated>2010-06-21T12:24:15Z</updated>

		<summary type="html">&lt;p&gt;Dschwa: &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;
===Your Personal Resource View Report &amp;quot;Where did I leave off?&amp;quot;===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT FROM_UNIXTIME(prefix_log.time),&lt;br /&gt;
prefix_user.firstname,&lt;br /&gt;
prefix_user.lastname,&lt;br /&gt;
prefix_course.fullname,&lt;br /&gt;
prefix_resource.name&lt;br /&gt;
FROM prefix_log&lt;br /&gt;
INNER JOIN prefix_user ON prefix_log.userid=prefix_user.id&lt;br /&gt;
INNER JOIN prefix_course ON prefix_log.course=prefix_course.id&lt;br /&gt;
INNER JOIN prefix_resource ON prefix_log.info=prefix_resource.id&lt;br /&gt;
Where userid = %%USERID%%&lt;br /&gt;
ORDER by FROM_UNIXTIME(prefix_log.time)DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Report]]&lt;/div&gt;</summary>
		<author><name>Dschwa</name></author>
	</entry>
</feed>