<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Azoltay</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Azoltay"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/Special:Contributions/Azoltay"/>
	<updated>2026-06-11T14:11:04Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Local_plugins&amp;diff=7717</id>
		<title>Local plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Local_plugins&amp;diff=7717"/>
		<updated>2010-11-02T22:17:15Z</updated>

		<summary type="html">&lt;p&gt;Azoltay: /* 2.0 pre-upgrade script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Local customisations&lt;br /&gt;
|state = Implemented&lt;br /&gt;
|tracker = MDL-17376, MDL-16438&lt;br /&gt;
|discussion = http://moodle.org/mod/forum/discuss.php?d=126017 http://moodle.org/mod/forum/discuss.php?d=86903&lt;br /&gt;
|assignee = [[User:Petr Škoda (škoďák)|Petr Škoda (škoďák)]], some parts were originally proposed and implemented in 1.9 by Penny Leach&lt;br /&gt;
}}&lt;br /&gt;
{{Moodle 2.0}}&lt;br /&gt;
&lt;br /&gt;
The recommended way to add new functionality to Moodle is to create a new standard plugin (module, block, auth, enrol, etc.).The /local/ plugins are mostly suitable for things that do not fit standard plugins.&lt;br /&gt;
&lt;br /&gt;
=Custom /local/ plugins=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Local plugins are used in cases when no standard plugin fits, examples are:&lt;br /&gt;
* event consumers communicating with external systems&lt;br /&gt;
* custom definitions of web services and external functions&lt;br /&gt;
* applications that extend moodle at the system level (hub server, amos server, etc.)&lt;br /&gt;
* new database tables used in core hacks (discouraged)&lt;br /&gt;
* new capability definitions used in core hacks&lt;br /&gt;
* custom admin settings&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Standard plugin features:&lt;br /&gt;
* /local/xxx/db/version.php - version of script (must be incremented after changes)&lt;br /&gt;
* /local/xxx/db/install.xml - executed during install (new version.php found)&lt;br /&gt;
* /local/xxx/db/install.php - executed right after install.xml&lt;br /&gt;
* /local/xxx/db/uninstall.php - executed during uninstallation&lt;br /&gt;
* /local/xxx/db/upgrade.php - executed after version.php change&lt;br /&gt;
* /local/xxx/db/access.php - definition of capabilities&lt;br /&gt;
* /local/xxx/db/events.php - event handlers and subscripts&lt;br /&gt;
* /local/xxx/db/messages.php - messaging registration&lt;br /&gt;
* /local/xxx/db/external.php - web services and external functions descriptions&lt;br /&gt;
* /local/xxx/lang/en/local_pluginname.php - language file&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;xxx&#039;&#039; is used instead of your local plugin name, plugins of the same type are installed/upgraded in alphabetical order.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
List of differences from normal plugins:&lt;br /&gt;
* always executed last during install/upgrade - guaranteed by order of plugins in &amp;lt;code&amp;gt;get_plugin_types()&amp;lt;/code&amp;gt;&lt;br /&gt;
* are expected to use event handlers - events are intended for communication core--&amp;gt;plugins only, local plugins are the best candidates for event handlers&lt;br /&gt;
* can add admin settings to any settings page - loaded last when constructing admin tree&lt;br /&gt;
* do not need to have any UI - other plugins are usually visible somewhere&lt;br /&gt;
* some extra hooks (not implemented yet)&lt;br /&gt;
&lt;br /&gt;
=Other /local/ customisation files=&lt;br /&gt;
&lt;br /&gt;
==Customised site defaults==&lt;br /&gt;
&lt;br /&gt;
Different default site settings can be stored in file /local/defaults.php.&lt;br /&gt;
These new defaults are used during installation, upgrade and later are&lt;br /&gt;
displayed as default values in admin settings. This means that the content&lt;br /&gt;
of the defaults files is usually updated BEFORE installation or upgrade.&lt;br /&gt;
&lt;br /&gt;
These customised defaults are useful especially when using CLI tools&lt;br /&gt;
for installation and upgrade.&lt;br /&gt;
&lt;br /&gt;
Sample /local/defaults.php file content:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$defaults[&#039;moodle&#039;][&#039;forcelogin&#039;] = 1;  // new default for $CFG-&amp;gt;forcelogin&lt;br /&gt;
$defaults[&#039;scorm&#039;][&#039;maxgrade&#039;] = 20;    // default for get_config(&#039;scorm&#039;, &#039;maxgrade&#039;)&lt;br /&gt;
$defaults[&#039;moodlecourse&#039;][&#039;numsections&#039;] = 11;&lt;br /&gt;
$defaults[&#039;moodle&#039;][&#039;hiddenuserfields&#039;] = array(&#039;city&#039;, &#039;country&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
First bracket contains string from column plugin of config_plugins table.&lt;br /&gt;
Second bracket is the name of setting. In the admin settings UI the plugin and&lt;br /&gt;
name of setting is separated by &amp;quot;|&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The values usually correspond to the raw string in config table, with the exception&lt;br /&gt;
of comma separated lists that are usually entered as real arrays.&lt;br /&gt;
&lt;br /&gt;
Please note that not all settings are converted to admin_tree,&lt;br /&gt;
they are mostly intended to be set directly in config.php.&lt;br /&gt;
&lt;br /&gt;
==2.0 pre-upgrade script==&lt;br /&gt;
&lt;br /&gt;
You can use /local/upgrade_pre20.php script for any code that needs to&lt;br /&gt;
be executed before the main upgrade to 2.0. Most probably this will&lt;br /&gt;
be used for undoing of old hacks that would otherwise break normal&lt;br /&gt;
2.0 upgrade.&lt;br /&gt;
&lt;br /&gt;
This file is just included directly, there does not need to be any&lt;br /&gt;
function inside. If the execution stops the script is executed again&lt;br /&gt;
during the next upgrade. The first execution of lib/db/upgrade.php&lt;br /&gt;
increments the version number and the pre upgrade script is not&lt;br /&gt;
executed any more.&lt;br /&gt;
&lt;br /&gt;
=Customisations outside of /local/ directory=&lt;br /&gt;
&lt;br /&gt;
==Forced settings==&lt;br /&gt;
&lt;br /&gt;
Sometimes it is useful to force some settings and prevent any changes of these settings via the standard admin UI. It is possible to hardcode these settings in config.php.&lt;br /&gt;
&lt;br /&gt;
In case of course settings it is very simply, the values are assigned directly to $CFG properties. In case of plugins the values are specified in a multidimensional array in $CFG-&amp;gt;force_plugin_settings.&lt;br /&gt;
&lt;br /&gt;
Sample code in config.php&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;allowobjectembed = 0;&lt;br /&gt;
$CFG-&amp;gt;forced_plugin_settings = array(&#039;page&#039;=&amp;gt;array(&#039;displayoptions&#039;=&amp;gt;5, &#039;requiremodintro&#039;=&amp;gt;1), &#039;folder&#039;=&amp;gt;&#039;requiremodintro&#039;=&amp;gt;1);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Local language customisations==&lt;br /&gt;
&lt;br /&gt;
Moodle supports other type of local customisation of standard language&lt;br /&gt;
packs. If you want to create your own language pack based on another&lt;br /&gt;
language create new dataroot directory with &amp;quot;_local&amp;quot; suffix, for example&lt;br /&gt;
following file with content changes string &amp;quot;Login&amp;quot; to &amp;quot;Sign in&amp;quot;:&lt;br /&gt;
moodledata/lang/en_local&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
  $string[&#039;login&#039;] = &#039;Sign in&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
See also https://docs.moodle.org/en/Language_editing&lt;br /&gt;
&lt;br /&gt;
==Custom script injection==&lt;br /&gt;
&lt;br /&gt;
Very old customisation option that allows you to modify scripts by injecting&lt;br /&gt;
code right after the require &#039;config.php&#039; call.&lt;br /&gt;
&lt;br /&gt;
This setting is enabled by manually setting $CFG-&amp;gt;customscripts variable&lt;br /&gt;
in config.php script. The value is expected to be full path to directory&lt;br /&gt;
with the same structure as dirroot. Please note this hack only affects&lt;br /&gt;
files that actually include the config.php!&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
* disable one specific moodle page without code modification&lt;br /&gt;
* alter page parameters on the fly&lt;br /&gt;
&lt;br /&gt;
==Direct code modifications==&lt;br /&gt;
This is usually the last resort, if possible do not do it. And if you still do it use some version control system (preferably git).&lt;br /&gt;
&lt;br /&gt;
==Direct database modifications==&lt;br /&gt;
Very strongly discouraged! Sometimes field lengths may be modified without side effects. Adding or removing of db fields will most probably cause major problems during future upgrades. New database tables should be added only from plugins.&lt;br /&gt;
&lt;br /&gt;
=Local customisations in previous versions=&lt;br /&gt;
Previous versions include only partial support for customisations in /local/ directory.&lt;br /&gt;
&lt;br /&gt;
List of local customisations in 1.9.x:&lt;br /&gt;
* /local/cron.php - custom cron jobs&lt;br /&gt;
* /local/settings.php - custom admin settings&lt;br /&gt;
* /local/db/upgrade.php - general modifications&lt;br /&gt;
* /local/lang/* - custom strings&lt;br /&gt;
* /local/lib.php - local_delete_course()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Migration from old 1.9.x /local/:&lt;br /&gt;
* &amp;lt;code&amp;gt;local/*&amp;lt;/code&amp;gt; needs to be copied to new directory&lt;br /&gt;
* &amp;lt;code&amp;gt;local/xxxx/db/install.php&amp;lt;/code&amp;gt; is intended for first installation, originally everything was in upgrade.php&lt;br /&gt;
* events are used instead of hooks&lt;br /&gt;
* upgrade code needs to migrate old settings, events, etc. directly in core db tables - such as change component strings and capability names from db/install.php or manually before/after upgrade&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=86903 Local Customisations] forum discussion&lt;br /&gt;
* http://cvs.moodle.org/moodle/local/readme.txt?view=markup&lt;br /&gt;
* [[Local customisation (Moodle 1.9)]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Local customisation]]&lt;/div&gt;</summary>
		<author><name>Azoltay</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Unit_test_API&amp;diff=3978</id>
		<title>Unit test API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Unit_test_API&amp;diff=3978"/>
		<updated>2010-01-21T00:32:16Z</updated>

		<summary type="html">&lt;p&gt;Azoltay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 1.7}}Location: &#039;&#039;Administration &amp;gt; Reports &amp;gt; Unit tests&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The purpose of Unit Tests is to evaluate the individual parts of a program (functions, and methods of classes) to make sure that each element individually does the right thing. Unit Tests can be one of the first steps in a quality control process for developing or tweaking Moodle code.  The next steps will involve other forms of testing to ensure that these different parts work together properly. &lt;br /&gt;
&lt;br /&gt;
The unit testing framework is based on the [http://www.simpletest.org/ SimpleTest] framework.&lt;br /&gt;
&lt;br /&gt;
== Running the unit tests in Moodle ==&lt;br /&gt;
&lt;br /&gt;
=== Running the basic tests ===&lt;br /&gt;
&lt;br /&gt;
# Log in with an admin account. &lt;br /&gt;
# Administration ► Development ► Unit tests (moodle &amp;gt;= 2.0, Administration ► Reports ► Unit tests Moodle &amp;lt;= 1.9)&lt;br /&gt;
# Click on the &#039;&#039;&#039;Reports&#039;&#039;&#039; link near the bottom of the page.&lt;br /&gt;
# Click the &#039;&#039;&#039;Run tests&#039;&#039;&#039; button and wait.&lt;br /&gt;
&lt;br /&gt;
This finds all the tests in Moodle and runs them. You can run a subset of the tests by entering a path (for example question/type) in the &#039;Only run tests in&#039; box. Similarly, if a test fails, you get some links in the failure message to make it easy to re-run just those tests.&lt;br /&gt;
&lt;br /&gt;
== Writing new tests ==&lt;br /&gt;
&lt;br /&gt;
As an example, suppose we wanted to write some tests for the string_manager class in mod/quiz/editlib.php.&lt;br /&gt;
&lt;br /&gt;
=== Where to put the tests ===&lt;br /&gt;
&lt;br /&gt;
The unit test report finds tests by looking for files called &#039;test....php&#039; inside folders called &#039;simpletest&#039;.&lt;br /&gt;
&lt;br /&gt;
So, for our example, we want to create called something like &#039;&#039;&#039;mod/quiz/simpletest/testeditlib.php&#039;&#039;&#039;. The skeleton of this file should look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Unit tests for (some of) mod/quiz/editlib.php.&lt;br /&gt;
 *&lt;br /&gt;
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License&lt;br /&gt;
 * @package question&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
if (!defined(&#039;MOODLE_INTERNAL&#039;)) {&lt;br /&gt;
    die(&#039;Direct access to this script is forbidden.&#039;); //  It must be included from a Moodle page&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Make sure the code being tested is accessible.&lt;br /&gt;
require_once($CFG-&amp;gt;dirroot . &#039;/mod/quiz/editlib.php&#039;); // Include the code to test&lt;br /&gt;
&lt;br /&gt;
/** This class contains the test cases for the functions in editlib.php. */&lt;br /&gt;
class quiz_editlib_test extends UnitTestCase {&lt;br /&gt;
    function test_something() {&lt;br /&gt;
        // Do the test here.&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // ... more test methods.&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That is, you have a class called something_test, and in that class you have lots of methods called test_something. Normally, you have one test method for each particular thing you want to test, and you should try to name the function to describe what is being tested - without making the name too ridiculously long!&lt;br /&gt;
&lt;br /&gt;
=== A test function ===&lt;br /&gt;
&lt;br /&gt;
The a test function typically looks like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function test_move_question_up() {&lt;br /&gt;
    // Setup fixture&lt;br /&gt;
&lt;br /&gt;
    // Exercise SUT&lt;br /&gt;
    $newlayout = quiz_move_question_up(&#039;1,2,0&#039;, 2);&lt;br /&gt;
&lt;br /&gt;
    // Validate outcome&lt;br /&gt;
    $this-&amp;gt;assertEqual($newlayout, &#039;2,1,0&#039;);&lt;br /&gt;
&lt;br /&gt;
    // Teardown fixture&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the [http://xunitpatterns.com/Four%20Phase%20Test.html four phase test pattern]. Those comments use a lot of testing jargon. The fixture is the background situation that needs to be set up before the test runs. SUT is short for &#039;situation under test&#039;. This is where you call the function or method that you want to test. Then you check to see if the function did the right thing. Finally, you have to clean up the fixture you created. With luck there is nothing to do here&lt;br /&gt;
&lt;br /&gt;
In this simple example, there is no setup or teardown to do. We just call the function we are testing with some sample input, and check that the return value is what we expect.&lt;br /&gt;
&lt;br /&gt;
=== Shared setUp and tearDown methods ===&lt;br /&gt;
&lt;br /&gt;
If all your test cases relate to the same area of code, then they may all need to same bit of fixture set up. For example, all the tests in lib/simpletest/teststringmanager.php need an instance of the string_manager class to test.&lt;br /&gt;
&lt;br /&gt;
To avoid duplicating code, you can override a method called &amp;lt;code&amp;gt;setUp()&amp;lt;/code&amp;gt; that sets up the test data. If present, this method will be called before each test method. You can write a matching &amp;lt;code&amp;gt;tearDown()&amp;lt;/code&amp;gt; method if there is any clean-up that needs to be done after each test case has run. For example, in lib/simpletest/teststringmanager.php there are setUp and tearDown methods that do something like:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function setUp() {&lt;br /&gt;
    // ...&lt;br /&gt;
    $this-&amp;gt;stringmanager = new string_manager(...);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public function tearDown() {&lt;br /&gt;
    $this-&amp;gt;stringmanager = null;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Then, each test can use $this-&amp;gt;stringmanager without having to worry about the details of how it is set up.&lt;br /&gt;
&lt;br /&gt;
=== Further information ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;SimpleTest&#039;&#039; documentation is at: http://www.simpletest.org/.&lt;br /&gt;
&lt;br /&gt;
== Changes to your existing code to make it work with unit testing ==&lt;br /&gt;
&lt;br /&gt;
The whole point of unit testing is to test each piece of functionality separately. You can only do this is by isolating that function and call it individually, perhaps after setting up a few other things.&lt;br /&gt;
&lt;br /&gt;
Therefore, it is good if you can write your code to depend on as few other things as possible. &lt;br /&gt;
&lt;br /&gt;
=== Include paths ===&lt;br /&gt;
&lt;br /&gt;
Includes like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
require_once(&#039;../../config.php&#039;); // Won&#039;t work.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
won&#039;t work. Instead, the more robust option is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
require_once(dirname(__FILE__) . &#039;/../../config.php&#039;); // Do this.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Access to global variables ===&lt;br /&gt;
&lt;br /&gt;
Because your code was included from within a function, you can&#039;t access global variables until you have done a global statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
require_once(dirname(__FILE__) . &#039;/../../config.php&#039;);&lt;br /&gt;
require_once($CFG-&amp;gt;libdir . &#039;/moodlelib.php&#039;); // Won&#039;t work.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
require_once(dirname(__FILE__) . &#039;/../../config.php&#039;);&lt;br /&gt;
&lt;br /&gt;
global $CFG; // You need this.&lt;br /&gt;
require_once($CFG-&amp;gt;libdir . &#039;/moodlelib.php&#039;); // Will work now.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Calls to global functions ===&lt;br /&gt;
Testing a class method that calls global functions can be problematic. At least, it&#039;s always complex, because we can&#039;t control what goes on in the global functions. We can&#039;t override the global functions or mock them in our unit tests. If the global functions themselves are well tested, this may not be a big problem, but most global functions are not well tested.&lt;br /&gt;
&lt;br /&gt;
==== Bridge Pattern ====&lt;br /&gt;
If your code needs to rely extensively on some public API, you could use the [http://en.wikipedia.org/wiki/Bridge_pattern bridge pattern] to decouple your code from that API. This way, when you write unit tests, you can override the bridging class or mock it, and control its outputs while you focus exclusively on testing your code.&lt;br /&gt;
&lt;br /&gt;
An basic example follows: Imagine that I do not trust the &#039;&#039;get_string()&#039;&#039; global function, but my code needs to use it. Initially my code has strong coupling with &#039;&#039;get_string()&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
class myclass {&lt;br /&gt;
    public function print_stuff($stuff) {&lt;br /&gt;
        echo get_string($stuff);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s write a bridging class to solve this coupling issue and use it instead of &#039;&#039;get_string()&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
class languageBridge {&lt;br /&gt;
    public function get_string($stuff,$module=&#039;moodle&#039;) {&lt;br /&gt;
        echo get_string($stuff, $module);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class myclass {&lt;br /&gt;
    public $lang_bridge;&lt;br /&gt;
    public function __construct() {&lt;br /&gt;
        $this-&amp;gt;lang_bridge = new languageBridge();&lt;br /&gt;
    }&lt;br /&gt;
    public function print_stuff($stuff) {&lt;br /&gt;
        echo $this-&amp;gt;lang_bridge-&amp;gt;get_string($stuff);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following is yet another example using a bridging method to decouple from the Moodle core API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
class workshop_api {&lt;br /&gt;
    /**&lt;br /&gt;
     * This is a method we want to unittest&lt;br /&gt;
     */&lt;br /&gt;
    public function get_peer_reviewers($context) {&lt;br /&gt;
        static $users=null;&lt;br /&gt;
        if (is_null($users)) {&lt;br /&gt;
            $users = $this-&amp;gt;get_users_by_capability($context, &#039;mod/workshop:peerassess&#039;, &lt;br /&gt;
                        &#039;u.id, u.lastname, u.firstname&#039;, &#039;u.lastname,u.firstname&#039;, &#039;&#039;, &#039;&#039;, &#039;&#039;, &#039;&#039;, false, false, true);&lt;br /&gt;
        }&lt;br /&gt;
        return $users;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**  &lt;br /&gt;
     * Bridging method to decouple from Moodle core API&lt;br /&gt;
     */&lt;br /&gt;
    protected function get_users_by_capability() {&lt;br /&gt;
        $args = func_get_args();&lt;br /&gt;
        return call_user_func_array(&#039;get_users_by_capability&#039;, $args);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning:&#039;&#039;&#039; Here are some comments on the examples above expressing that the bridge pattern should be used very carefully.&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;I think that is a case of unit tests leading to worse software design, in that you are not using the standard API for something. But if you really want to unit test, I can&#039;t think of a better solution.&amp;quot;&lt;br /&gt;
* &amp;quot;I think this can be OK if used very selectively. Unfortunately I don&#039;t think it&#039;s the solution if you want to decouple the very complex and deeply nested Moodle functions from each other&amp;quot;&lt;br /&gt;
* &amp;quot;...your code is designed to be part of Moodle, so decoupling from a standard Moodle API is perverse.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Unit testing in 2.0 ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 2.0}}&lt;br /&gt;
With the Objectification of the Database libraries in Moodle 2.0, new and better approaches to Unit testing can be used. Here is a sample of a simple test case: (in course/simpletest)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
 require_once($CFG-&amp;gt;dirroot . &#039;/course/lib.php&#039;);&lt;br /&gt;
 &lt;br /&gt;
 global $DB;&lt;br /&gt;
 Mock::generate(get_class($DB), &#039;mockDB&#039;);&lt;br /&gt;
 &lt;br /&gt;
 class courselib_test extends UnitTestCase {&lt;br /&gt;
     var $realDB;&lt;br /&gt;
 &lt;br /&gt;
     function setUp() {&lt;br /&gt;
         global $DB;&lt;br /&gt;
         $this-&amp;gt;realDB = $DB;&lt;br /&gt;
         $DB           = new mockDB();&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     function tearDown() {&lt;br /&gt;
         global $DB;&lt;br /&gt;
         $DB = $this-&amp;gt;realDB;&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     function testMoveSection() {&lt;br /&gt;
         global $DB;&lt;br /&gt;
         $course = new stdClass();&lt;br /&gt;
         $course-&amp;gt;id = 1;&lt;br /&gt;
 &lt;br /&gt;
         $sections = array();&lt;br /&gt;
         for ($i = 1; $i &amp;lt; 11; $i++) {&lt;br /&gt;
             $sections[$i]          = new stdClass();&lt;br /&gt;
             $sections[$i]-&amp;gt;id      = $i;&lt;br /&gt;
             $sections[$i]-&amp;gt;section = $i - 1;&lt;br /&gt;
         }&lt;br /&gt;
 &lt;br /&gt;
         $DB-&amp;gt;expectOnce(&#039;get_records&#039;, array(&#039;course_sections&#039;, array(&#039;course&#039; =&amp;gt; $course-&amp;gt;id)));&lt;br /&gt;
         $DB-&amp;gt;setReturnValue(&#039;get_records&#039;, $sections);&lt;br /&gt;
         $this-&amp;gt;assertFalse(move_section($course, 2, 3));&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also &#039;&#039;&#039;UnitTestCaseUsingDatabase&#039;&#039;&#039; in lib/simpletestlib.php.&lt;br /&gt;
&lt;br /&gt;
=== Testing HTML output ===&lt;br /&gt;
&lt;br /&gt;
(work in progress - to be documented properly once the API stabilizes)&lt;br /&gt;
&lt;br /&gt;
* ContainsTagWithAttribute($tag, $attribute, $value)&lt;br /&gt;
* ContainsTagWithAttributes($tag, $attributes)&lt;br /&gt;
* ContainsTagWithContents($tag, $content)&lt;br /&gt;
* ContainsEmptyTag($tag)&lt;br /&gt;
&lt;br /&gt;
The syntax is &lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$this-&amp;gt;assert(new ContainsTagWithAttribute($tag, $attribute, $value), $html);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code coverage analysis==&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; This section is a work in progress. Please use the [[{{TALKPAGENAME}}|page comments]] or an appropriate [http://moodle.org/course/view.php?id=5 moodle.org forum] for any recommendations/suggestions for improvement.{{{info|}}}&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Moodle 2.0}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[[Wikipedia:Code_coverage|Code coverage]]&#039;&#039;&#039; is a technique, strongly tied with software testing, that allows to &#039;&#039;&#039;check and improve the quality of the tests&#039;&#039;&#039; by measuring the degree of source code that is being covered by them. With Moodle supporting more and more tests each day (slowly towards a &#039;&#039;&#039;Test Driven Development&#039;&#039;&#039; model) we need to integrate some tool into our development process helping to analyse the quality of ours tests.&lt;br /&gt;
&lt;br /&gt;
Right now (in Moodle 2.0) we are using [http://www.simpletest.org/ SimpleTest], one simple and great tool to perform all the tests. Unluckily, it doesn&#039;t support code coverage analysis at all. In the other hand, other PHP unit testing products like [http://www.phpunit.de/ PHPUnit], more complex and powerful, have built-in support for that technique, but switching to a new product is out from our current [[Roadmap]] plans.&lt;br /&gt;
&lt;br /&gt;
So, after some readings and comparisons, Moodle will implement its own extensions to SimpleTest, in order to fulfil the main goal of having statement/line code coverage analysis working under Moodle 2.0 onwards. To achieve this, also [http://developer.spikesource.com/projects/phpcoverage Spike PHPCoverage], a basic code-coverage tool, will be used and extended. You can find the details of the implementation of this tool at MDL-19579.&lt;br /&gt;
&lt;br /&gt;
=== Changes ===&lt;br /&gt;
&lt;br /&gt;
To enable code coverage in your tests, only a few modifications need to be performed to your current code:&lt;br /&gt;
&lt;br /&gt;
# Change your test classes by adding two (public static) attributes: &#039;&#039;&#039;$includecoverage&#039;&#039;&#039; and &#039;&#039;&#039;$excludecoverage&#039;&#039;&#039;, both arrays, being used to inform to the code coverage tool (via reflection) about which source code files and dirs must be covered/skipped by the analysis.&lt;br /&gt;
# Use &#039;&#039;&#039;[http://cvs.moodle.org/moodle/lib/simpletestcoveragelib.php?view=markup simpletestcoveragelib.php]&#039;&#039;&#039; instead of simpletestlib.php in your caller scripts.&lt;br /&gt;
# Use the &#039;&#039;&#039;autogroup_test_coverage&#039;&#039;&#039; class instead of the AutoGroupTest one (see below for details) in your caller scripts.&lt;br /&gt;
&lt;br /&gt;
(note that only the 1st point above is needed for new unit tests being created because both 2 and 3 (changes in caller scripts) are already implemented in Moodle and awaiting your cool unit tests.&lt;br /&gt;
&lt;br /&gt;
That&#039;s all! With those 3 basic changes, you will end with a complete code coverage report available for further analysis.&lt;br /&gt;
&lt;br /&gt;
=== API ===&lt;br /&gt;
&lt;br /&gt;
When using code coverage within Moodle there are two alternative APIs available, both providing the same code coverage reports at the end, but doing that in a different way. Here they are:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Internal (hidden) coverage API&#039;&#039;&#039;: This API is completely hidden beyond the Unit testing API and you won&#039;t need to know the details about it. Just perform the 1-2-3 changes described above and, after running the tests you&#039;ll get the final report available for being used immediately, without needing to perform anything in your code. His major drawback: it only can perform &#039;&#039;&#039;one&#039;&#039;&#039; &amp;quot;code coverage session&amp;quot; (a.k.a. instrumentation), so it&#039;s only suitable for testing scripts using only one unit test execution. One example of this type of unit testing is  [http://cvs.moodle.org/moodle/admin/report/unittest/index.php?view=markup admin/report/unittest/index.php] where only one (big) test-group is executed.&lt;br /&gt;
* &#039;&#039;&#039;External (explicit) coverage API&#039;&#039;&#039;: This API needs extra coding as long as coverage instantiating, configuration and report generation happens in the main script. It&#039;s a bit more complex but, in the other hand, it support &#039;&#039;&#039;multiple&#039;&#039;&#039; instrumentations to be performed, and gives you more control about the code coverage process.  One example of this type of unit testing is  [http://cvs.moodle.org/moodle/admin/report/unittest/dbtest.php?view=markup admin/report/unittest/dbtest.php] where multiple (one for each DB being tested) test-group are executed.&lt;br /&gt;
&lt;br /&gt;
So, first of all (point 1 in prev section - usage), we need to define, for each unit test, which files / directories (relative to dirroot) we want to analyse with the tool. Here it&#039;s one example, for the &#039;&#039;&#039;dml_test&#039;&#039;&#039; unit test ([http://cvs.moodle.org/moodle/lib/dml/simpletest/testdml.php?view=markup /lib/dml/simpletest/testdml.php]), all we need to add to these lines to the class declaration :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public  static $includecoverage = array(&#039;lib/dml&#039;);&lt;br /&gt;
public  static $excludecoverage = array(&#039;lib/dml/somedir&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By doing so, the code coverage tool will know which are the target files to perform coverage analysis/reporting and will do that for all the files (recursively) in the &#039;&#039;lib/dml&#039;&#039;&#039; dir but excluding the &#039;&#039;lib/dml/somedir&#039;&#039; directory (recursively too). Note that both attributes are arrays so multiple paths can be specified in any of them. Also note that the dir where the UnitTest is stored is automatically excluded (usually &#039;&#039;simpletest&#039;&#039; dirs).&lt;br /&gt;
&lt;br /&gt;
And, as said, that&#039;s all you need to fulfil in order to get current/new unit tests being analysed by the code coverage tool by current Moodle scripts. The documentation below is only interesting for developers wanting to create new scripts able to perform unit testing with code coverage (points 2 and 3 in prev section - usage).&lt;br /&gt;
&lt;br /&gt;
==== Internal coverage API ====&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$test = new autogroup_test_coverage($showsearch, $test_name, $performcoverage, $coveragename, $coveragedir);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Create one new autogroup test object with code coverage support, there you can specify if you want to perform coverage (true/false), the name of the report (title) and the directory where the final report will be created (under moodledata/codecoverage). &lt;br /&gt;
Optionally you can add more files and directories (relative to dirroot) to the list of files to be covered / ignored by using these functions (in case the defined in point 1 aren&#039;t enough).&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$test-&amp;gt;add_coverage_include_path($path);&lt;br /&gt;
$test-&amp;gt;add_coverage_exclude_path($path);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
And then, affter adding a bunch of unit tests to the group, you simply invoke the test execution with code coverage support to end with a nice code coverage report under &#039;&#039;dataroot/codecoverage/$coveragedir&#039;&#039;:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$test-&amp;gt;run($unit_test_reporter);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(don&#039;t forget that this API supports only &#039;&#039;&#039;one&#039;&#039;&#039; instrumentation to be performed)&lt;br /&gt;
&lt;br /&gt;
And that&#039;s all!&lt;br /&gt;
&lt;br /&gt;
==== External coverage API ====&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$covreporter = new moodle_coverage_reporter($coveragename, $coveragedir);&lt;br /&gt;
$covrecorder = new moodle_coverage_recorder($covreporter);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Create one coverage reporter, by passing its title and output directory as parameters.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$test = new autogroup_test_coverage($showsearch, $test_name, $performcoverage);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Create one new autogroup test object with code coverage support, you don&#039;t need to specify the title and dir here (as already have been defined by the moodle_coverage_reporter object).&lt;br /&gt;
Optionally you can add more files and directories (relative to dirroot) to the list of files to be covered / ignored by using these functions (in case the defined in point 1 aren&#039;t enough).&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$test-&amp;gt;add_coverage_include_path($path);&lt;br /&gt;
$test-&amp;gt;add_coverage_exclude_path($path);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Then, after adding a bunch of unit tests to the group, you simply invoke the test execution with code coverage support with:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$test-&amp;gt;run_with_external_coverage($unit_test_reporter, $covrecorder);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(don&#039;t forget that this API supports &#039;&#039;&#039;multiple&#039;&#039;&#039; instrumentations to be performed)&lt;br /&gt;
&lt;br /&gt;
And finally, you generate the code coverage report (under &#039;&#039;dataroot/codecoverage/$coveragedir&#039;&#039;) using:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$covrecorder-&amp;gt;generate_report();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Once more, that&#039;s all!&lt;br /&gt;
&lt;br /&gt;
==== Final notes ====&lt;br /&gt;
* Note that there are some more methods available in the moodle_coverage_recorder class. They will allow to control starting/stopping instrumentations by hand and other minor things but they shouldn&#039;t really be used. The run() and run_with_external_coverage() methods should be enough in 99% of cases.&lt;br /&gt;
* Not being part of the API, but used by it, there is one &#039;&#039;&#039;[http://cvs.moodle.org/moodle/admin/report/unittest/coveragefile.php?view=markup overagefile.php]&#039;&#039;&#039; script under &#039;&#039;admin/report/unittest&#039;&#039; responsible for serving the coverage report files from within Moodle. See current scripts in that dir to see how can be used.&lt;br /&gt;
* All the test execution / reporting / coverage utilities must be protected with the &#039;moodle/site:config&#039; permission.&lt;br /&gt;
&lt;br /&gt;
== A warning ==&lt;br /&gt;
&lt;br /&gt;
In &#039;xUnit Test Patterns&#039; there is a [http://xunitpatterns.com/TestAutomationRoadmap.html scale of testing difficulty] that goes from 1. to 6. Moodle is definitely at number 6. on that scale &#039;Non-object-oriented legacy software&#039;. It then goes recommend that you don&#039;t start to learn about unit testing with that sort of software :-(&lt;br /&gt;
&lt;br /&gt;
== Further reading about unit testing ==&lt;br /&gt;
&lt;br /&gt;
[http://manning.com/reiersol/ PHP in Action] has an excellent chapter explaining unit testing in PHP with &#039;&#039;simpletest&#039;&#039;. (Although the rest of that book advocates a style of programming that is very different from the style used in Moodle.)&lt;br /&gt;
&lt;br /&gt;
[http://www.pragprog.com/titles/utj/pragmatic-unit-testing-in-java-with-junit Pragmatic Unit Testing in Java with JUnit] is also a very good introduction, despite being in the wrong programming language. JUnit and Simpletest are very similar.&lt;br /&gt;
&lt;br /&gt;
[http://xunitpatterns.com/ xUnit Test Patterns] is the ultimate unit test book. I think it teaches you everything you could learn about unit testing by reading a book. The only way to learn more would be years of experience. It has really great advice for dealing with the kind of messy problems you get in a big, real project like Moodle. &lt;br /&gt;
&lt;br /&gt;
[[Category:Coding guidelines|Unit tests]]&lt;br /&gt;
[[Category:Quality Assurance]]&lt;/div&gt;</summary>
		<author><name>Azoltay</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User_talk:Helen_Foster&amp;diff=23167</id>
		<title>User talk:Helen Foster</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User_talk:Helen_Foster&amp;diff=23167"/>
		<updated>2009-11-19T23:16:21Z</updated>

		<summary type="html">&lt;p&gt;Azoltay: /* PHP Settings by Moodle version */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Creating new FAQ pages ==&lt;br /&gt;
&lt;br /&gt;
Hi Helen,&lt;br /&gt;
&lt;br /&gt;
I have successfully created a stub for a XML FAQ page (https://docs.moodle.org/en/XML_FAQ) but how do I get it promoted on https://docs.moodle.org/en/Category:FAQ ?&lt;br /&gt;
&lt;br /&gt;
I also would like to create an Import/Export FAQ for collecting all the information regarding Moodle import and export which is scattered in different forums.&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
[[User:Frank Ralf|Frank Ralf]]&lt;br /&gt;
&lt;br /&gt;
:Hi Helen will have to answer the Import/Export question.  I jumped in and added &amp;lt;nowiki&amp;gt;[[Category:FAQ]]&amp;lt;/nowiki&amp;gt; to the bottom of the page, which anyone can do. And took your hint and added a &amp;lt;nowiki&amp;gt;{{stub}}&amp;lt;/nowiki&amp;gt; template at the top.  Thanks for the XML work. Best --[[User:chris collman|chris collman]] 14:16, 3 December 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
::Hi Frank, thanks for your offer - an [[Import and export FAQ]] page would be great, thanks! --[[User:Helen Foster|Helen Foster]] 04:12, 4 December 2008 (CST)&lt;br /&gt;
:::Thanks to both of you! Helen, how did you get that nice Contents menu on your Import and export FAQ page? I couldn&#039;t figure that out from the source. --[[User:Frank Ralf|Frank Ralf]] 05:30, 4 December 2008 (CST) Problem solved, just found the documentation ;-) --[[User:Frank Ralf|Frank Ralf]] 05:43, 4 December 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
== Suggestion that is probably total overkill ==&lt;br /&gt;
&amp;lt;onlyinclude&amp;gt;&lt;br /&gt;
# Create a new FAQ namespace.&lt;br /&gt;
# In this namespace, create one page for each frequent question, where the contents of the page is the answer.&lt;br /&gt;
# Use our new knowledge of transclusions to build the FAQ lists by just pulling in pages from the FAQ namespace.&lt;br /&gt;
&lt;br /&gt;
The benefits of doing this are&lt;br /&gt;
* The same FAQ can appear in more than one list without copying-and-pasting.&lt;br /&gt;
* Each question gets a unique URL that so in the forums, we can point people to a page that just answers their specific question.&lt;br /&gt;
&lt;br /&gt;
Disadvantages&lt;br /&gt;
* Editing FAQ lists becomes incomprehensible to anyone who is not a MediaWiki geek.&lt;br /&gt;
&lt;br /&gt;
If we went this way, I would like to use B to build a new FAQ page: &amp;quot;Troubleshooting FAQ&amp;quot;. Might be a good idea anyway.&lt;br /&gt;
&amp;lt;/onlyinclude&amp;gt;&lt;br /&gt;
I hasten to say that I am not recommending this approach. The disadvantages could easily outweigh the advantages. I am simply pointing out a technical possibility that may be worth considering either now, or in the future.&amp;lt;onlyinclude&amp;gt;--[[User:Tim Hunt|Tim Hunt]] 07:11, 4 December 2008 (CST)&amp;lt;/onlyinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Just added [[MoodleDocs:Transclusion]].  Good thing I had my first cup of coffee, Tim&#039;s thoughtful post got me rubbing the sleep out of my eyes.  I wonder if I can get the partial transclusion of this section to work in Sandbox then in [[MoodleDocs_talk:Transclusion]]. Definitely a tool to be used with care. But Wowie Zowie ! --[[User:chris collman|chris collman]] 06:49, 5 December 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
:: Hello Tim, I think your suggested solution would indeed be overkill and would make maintaining FAQ too difficult. I see FAQ as an intermediary step between the unorganised kind of &amp;quot;documentation&amp;quot; which is provided in the forums towards &amp;quot;real&amp;quot; documentation. Therefore the ease of editing is crucial in my opinion. What about using Moodle&#039;s &#039;&#039;&#039;autolinking mechanism&#039;&#039;&#039; to automatically link to FAQ pages, e.g. if there is a mention of grades in the forums that would create an automatic link to Grades FAQ. I am quite new to Moodle, but couldn&#039;t that be done with setting up a kind of FAQ Glossary? --[[User:Frank Ralf|Frank Ralf]] 02:44, 16 December 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
::: Hi Tim, thanks for your suggestion, though I think it&#039;s overkill too!  The current FAQ pages have nice short titles which are easy to find and to include in forum posts. Having a page for each FAQ would result in really long URLs. Also, I think that when we point people to an FAQ page, and they have to look through it to find the answer to their question, they may well find answers to other questions they have. As other people have suggested, I think FAQ pages work well as start pages with links to lots of other pages i.e. they&#039;re kept fairly short, for example [[Contributed code FAQ]]. --[[User:Helen Foster|Helen Foster]] 04:49, 18 December 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
::: Frank, regarding autolinking to FAQ pages, have you come across the Moodle Docs filter on moodle.org? Please see the [[Moodle.org FAQ]] for more details. --[[User:Helen Foster|Helen Foster]] 04:49, 18 December 2008 (CST)&lt;br /&gt;
::::Helen, thanks for the hint. But isn&#039;t that the usual &#039;&#039;manual&#039;&#039; way of wiki linking? But on second thought that might really be the best way of linking to FAQ pages as it keeps getting the forums cluttered with too many (automatic) links. In fact, it just might be a matter of good practice to put advice of lasting value from the forums into a more structured form of documentation and nothing which could or should be done in an automatic and technical way... --[[User:Frank Ralf|Frank Ralf]] 05:11, 19 December 2008 (CST)&lt;br /&gt;
&lt;br /&gt;
== Security Notification registration ==&lt;br /&gt;
&lt;br /&gt;
Hi Helen,&lt;br /&gt;
&lt;br /&gt;
It was suggested to me through the #moodle channel on freenode that I raise this concern with you.&lt;br /&gt;
&lt;br /&gt;
I&#039;m developing a moodle installation behind a firewall on a non-public URL and am interested in subscribing to security updates (prompted to check this after seeing a moodle vulnerability mentioned on Bugtraq). I had previously attempted to subscribe by registering our installation through the admin pages, however that registration was rejected as the site was located behind a firewall and not accessible.&lt;br /&gt;
&lt;br /&gt;
Due to that rejection, I wasn&#039;t subscribed to security updates.&lt;br /&gt;
&lt;br /&gt;
I now find myself in the unfortunate position where I cannot subscribe to security updates without having a public facing site (which I can&#039;t reasonably know is secure as I&#039;m not receiving security updates through your mailing list).&lt;br /&gt;
&lt;br /&gt;
The burden for those of us who have an internal site they&#039;re developing (or perhaps is in production) is that we must now create a public facing site to register for the sole purpose of receiving security updates. If the thought is that only parties interested in maintaining a moodle site should have access to those messages, perhaps a different measure could be put into place (a code that appears once moodle is installed, for example).&lt;br /&gt;
&lt;br /&gt;
I&#039;ve tried subscribing through sympa@lists.moodle.org, however that method does not work either.&lt;br /&gt;
&lt;br /&gt;
Could you please provide a process for folks like me to get on the security updates list without having to install moodle on a public web server first?&lt;br /&gt;
&lt;br /&gt;
Thanks!&lt;br /&gt;
&lt;br /&gt;
- P.&lt;br /&gt;
&lt;br /&gt;
:Hi Paul, how about subscribing to the [http://moodle.org/mod/forum/view.php?f=996 security announcements forum], where all important security issues are published. --[[User:Helen Foster|Helen Foster]] 04:34, 18 December 2008 (CST)&lt;br /&gt;
== Unseen (not hidden) activities==&lt;br /&gt;
Hi Helen (This is partly my attempt at practising here by the way!) I&#039;ve posted several times recently about the concept of &#039;unseen&#039; topics with resources that can be linked to on the course page where hidden ones wouldn&#039;t work. is there documentation about that somewhere here ? If so, where? Then I can point Moodlers to it next time.If not, shall I write it? Thanks - [[User: Mary Cooch|Mary Cooch]]&lt;br /&gt;
&lt;br /&gt;
:Hi Mary, I&#039;ve just had a quick look and can&#039;t find any documentation about unseen topics, so it would be helpful if you could write some, perhaps here: [[Course homepage]]. Thanks in advance :-) --[[User:Helen Foster|Helen Foster]] 17:20, 19 December 2008 (CST)&lt;br /&gt;
:Helen - please can you check what I have done as you know I&#039;m still a novice and don&#039;t want to put the wrong thing in the wrong place! Also, if you look on my usertalk Chris Colman said it might be useful on the html linking page? [[User: Mary Cooch|Mary Cooch]]&lt;br /&gt;
&lt;br /&gt;
== Downloading Moodle Core ==&lt;br /&gt;
&lt;br /&gt;
Hi Helen,&lt;br /&gt;
I came across Moodle just this morning, and read a little about its design, and loved it, it is perfect for the project Im starting.&lt;br /&gt;
&lt;br /&gt;
Ive gone to the download page, to download the Moodle core zip package, but when I click on the link to download I get the following message;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;A server error that affects your login session was detected. Please login again or restart your browser.&#039;&lt;br /&gt;
&lt;br /&gt;
( Continue )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I had a look around the FAQ pages, to see if there was anything on there, but it only mentions about people who already have moodle and are having this difficulty,&lt;br /&gt;
&lt;br /&gt;
Please could you send me an alternative link, &lt;br /&gt;
&lt;br /&gt;
Kind Regards&lt;br /&gt;
Andrew&lt;br /&gt;
:Hi Andrew, I left a comment on your [[User_talk:Andrew_Abel|user comment page]], just in case you were in a hurry to play with Moodle. --[[User:chris collman|chris collman]] 07:40, 1 January 2009 (CST)&lt;br /&gt;
&lt;br /&gt;
::Hi Andrew, I hope you&#039;ve been successful in downloading Moodle by now. Chris, thanks for your helpful comments :-) --[[User:Helen Foster|Helen Foster]] 01:21, 2 January 2009 (CST)&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;experimental:&amp;quot; prefix ==&lt;br /&gt;
&lt;br /&gt;
[[User:Marc Grober|Marc Grober]] 12:00, 12 January 2009 (CST)&lt;br /&gt;
&lt;br /&gt;
We started using experimental: as a prefix because there was some confusion about the use of Development: as a prefix.....&lt;br /&gt;
&lt;br /&gt;
In the Moodle docs, Development: appears to cover Moodle developer documentation, not docs under development,  so we wanted to use a prefix that connote that the docs were, as we suggest, &amp;quot;experimental&amp;quot; (i.e. not ready for prime time).   I had not come across [[Experimental|Experimental]] as the search is a bit temperamental and searching for the root, experiment, produced no result.....&lt;br /&gt;
&lt;br /&gt;
Perhaps we need a different topic name?&lt;br /&gt;
&lt;br /&gt;
I have encouraged AT to ask you to move these pages out of the experimental: topic but I think she feels they are not quite ready and I want to respect hre wishes on this.&lt;br /&gt;
&lt;br /&gt;
We also have some experimental pages under development with respect to gradebook &amp;quot;cases&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
I would encourage you to discuss the progress on all these pages with AT.&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
:Marc, thanks for your comments. The use of experimental: as a prefix is fine by me. Alternatively you could use a [[MoodleDocs:Templates|Moodle Docs template]] to add a message saying that the page is experimental. --[[User:Helen Foster|Helen Foster]] 02:41, 13 January 2009 (CST)&lt;br /&gt;
::Marc and Helen, something new to me.  I found 7 pages when I searched on &amp;quot;experimental:&amp;quot; and found 7 Article title matches.  6 started with &amp;quot;experimental:&amp;quot; and of course &amp;quot;Experimental&amp;quot;. Wondering if an alternative draft to Main Page should be done that way with the Experimental template.  :)--[[User:chris collman|chris collman]] 06:00, 13 January 2009 (CST)&lt;br /&gt;
:::Helen, thanks for moving some of the experimental: pages.  The page here, however, has yet to be moved: [https://docs.moodle.org/en/experimental:Getting_Help_Installing_and_Managing_Moodle]. Vis-a-vis topics/categories, I think it makes sense to have a category that is not searched by default so that users do not find materials that is not ready for prime time.  By the same token,  I think, as I mentioned above,  that Development: is problematic because it confuses as far as whether it is a topic for Developers or addresses material under development, which are really two different areas.  Likewise, as long as there is an Experimental page the use of experimental: could cause confusion.    I would argue for three distinct categories.... [[User:Marc Grober|Marc Grober]] 12:16, 24 January 2009 (CST)&lt;br /&gt;
&lt;br /&gt;
::As I understood your (Helen&#039;s) comment (posted I don&#039;t recall where) you (Helen) were I think suggesting that what I was really suggesting was a new name space such that folks could develop documents that were not included in a default search.....  which I think is exactly what I was looking for....  So the question becomes can and should we do such a thing..... --[[User:Marc Grober|Marc Grober]] 23:44, 9 March 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::Marc, I guess you&#039;re referring to my forum post [http://moodle.org/mod/forum/discuss.php?d=115736#p509590 Re: Not including pages in the Moodle Docs search]. How about using a Moodle Docs template for now to indicate docs under development and add them to an appropriate category, then when there are sufficient pages to warrant it, we can create a new namespace and move all the pages into it. --[[User:Helen Foster|Helen Foster]] 11:46, 10 March 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
==Talk:Helen&#039;s page is over 32k==&lt;br /&gt;
FYI: I got that warning.  Maybe a subpage for the older stuff and a link, so we don&#039;t loose some stuff. Of course alternatively, if I deleted all my comments/questions, that would shorted it a lot :)  --[[User:chris collman|chris collman]] 06:04, 13 January 2009 (CST)&lt;br /&gt;
::Seriously, I would be happy to edit my posts here down to a nub or nothingness.  I think some of the language requests for help could be put in one heading and shortened, without losing anything.    --[[User:chris collman|chris collman]] 06:13, 13 January 2009 (CST)&lt;br /&gt;
&lt;br /&gt;
:Chris, thanks for creating [[User talk:Helen Foster/1]]. I think it&#039;s a good solution :-) --[[User:Helen Foster|Helen Foster]] 02:51, 14 January 2009 (CST)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[User talk:Helen Foster/1]] for older comments&lt;br /&gt;
&lt;br /&gt;
== Registered Users Bug with Mediawiki ==&lt;br /&gt;
&lt;br /&gt;
Hi, [[User_talk:David_Scotson#Moodle_Docs_stats|Way back in 2006 you mentioned]] a work-around for a bug resulting in registered users stats on [[Special:Statistics]] not updating properly. I think I am encountering this same bug on my internal wiki now. I know that was a long time ago, but do you remember what you did to fix it/what the work-around mentioned was?&lt;br /&gt;
Thanks,&lt;br /&gt;
--[[User:Adrian Archer|Adrian Archer]] 11:02, 4 March 2009 (CST)&lt;br /&gt;
&lt;br /&gt;
:Hi Adrian, here are Eloy&#039;s workarounds (easy to do with phpMyAdmin):&lt;br /&gt;
&lt;br /&gt;
:# To refresh the count of pages, if it&#039;s not working: table: site_stats, field: ss_total_pages, setting it to -1 should force recalculation of pages&lt;br /&gt;
:# To refresh the count of registered users, delete the contents of the &amp;quot;cached statistics&amp;quot; table&lt;br /&gt;
&lt;br /&gt;
:Thanks to Eloy for recalling them :-) I hope you are able to upgrade to a newer MediaWiki version soon. --[[User:Helen Foster|Helen Foster]] 09:01, 5 March 2009 (CST)&lt;br /&gt;
&lt;br /&gt;
::Thanks so much for the quick response, that sounds like it should work. I&#039;m actually using Version 1.13.3, so I guess the bug still exists. --[[User:Adrian Archer|Adrian Archer]] 09:17, 5 March 2009 (CST)&lt;br /&gt;
&lt;br /&gt;
:::Hmm, Moodle Docs is actually using version 1.11.2, though we&#039;re hoping to upgrade very soon (MDLSITE-657). --[[User:Helen Foster|Helen Foster]] 09:35, 5 March 2009 (CST)&lt;br /&gt;
&lt;br /&gt;
== Function if in grade calculations? ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hi Helen&lt;br /&gt;
&lt;br /&gt;
Thanks for your jobs.&lt;br /&gt;
&lt;br /&gt;
Sorry for my lousy english.&lt;br /&gt;
&lt;br /&gt;
I am trying to use the &amp;quot;if&amp;quot; function in &amp;quot;Grade calculations&amp;quot; in a similar way as is done in &amp;quot;opencalc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
do you know if this is possible?&lt;br /&gt;
&lt;br /&gt;
How to introduce a note of recovery, only for a few students, without changing the original calification?&lt;br /&gt;
&lt;br /&gt;
My email is trujillo@unex.es&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;br /&gt;
== Using Moodle for Teachers ==&lt;br /&gt;
&lt;br /&gt;
Hi Helen,&lt;br /&gt;
&lt;br /&gt;
I teach math at Woodland Middle School  in Woodland, WA. I&#039;m also just beginning work with the Ubuntu Learning Project (name?). Is your book (Using Moodle - Teaching with the Popular Open Source Course Management System) available for download on Moodle Docs free to teachers? If so, is there some type of creative commons license? Or should we just link to Moodle Docs? I found your book extremely useful when I taught a 3-day Moodle Bootcamp to teachers this summer.&lt;br /&gt;
&lt;br /&gt;
Thanks, Mark Knudson&lt;br /&gt;
&lt;br /&gt;
:Hi Mark, glad to hear you found my book useful :-) It&#039;s available for download under the Creative Commons Attribution-Noncommercial-Share Alike licence here: [[Using Moodle book]]. --[[User:Helen Foster|Helen Foster]] 19:11, 21 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
== PHP Settings by Moodle version ==&lt;br /&gt;
&lt;br /&gt;
Hi Helen,&lt;br /&gt;
&lt;br /&gt;
I&#039;m new to this community (and to Moodle) and am not sure how I should request an update to the documentation relating to a Moodle PHP extension requirement - specifically zlib.&lt;br /&gt;
I noticed that this page:&lt;br /&gt;
https://docs.moodle.org/no/Installering_av_Moodle has a section stating that &amp;quot;The zlib extension is required for zip/unzip functionality.&amp;quot; under the PHP Extensions and Libraries, but it doesn&#039;t exist here:&lt;br /&gt;
https://docs.moodle.org/en/PHP_settings_by_Moodle_version&lt;br /&gt;
&lt;br /&gt;
The PHP_settings_by_Moodle_version is a Stub and is waiting for review - I was thinking about updating it with the text from the https://docs.moodle.org/no/Installering_av_Moodle page.&lt;br /&gt;
&lt;br /&gt;
Looking for a little direction.&lt;br /&gt;
&lt;br /&gt;
Thanks!&lt;br /&gt;
Andy&lt;/div&gt;</summary>
		<author><name>Azoltay</name></author>
	</entry>
</feed>