Skip to content

Commit

Permalink
[docs] Linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jul 10, 2023
1 parent 2bae615 commit 3f69582
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion general/development/abc/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Learn how to use Moodle's [backup](/docs/apis/subsystems/backup) and [restore](/

[Database schema introduction](/docs/apis/core/dml/database-schema) gives a high level overview of the database schema.

Because of Moodle's modular nature, there is no single, detailed representation of the full database schema. Instead, the tables for each part of Moodle are defined in a database-neutral XML format in each part of Moodle (see [XMLDB](/general/development/tools/xmldb)). Look for files called `install.xml` located in folders called `db` throughout your Moodle installation.
Because of Moodle's modular nature, there is no single, detailed representation of the full database schema. Instead, the tables for each part of Moodle are defined in a database-neutral XML format in each part of Moodle (see [XMLDB](../tools/xmldb.md)). Look for files called `install.xml` located in folders called `db` throughout your Moodle installation.

Alternatively, log in as an administrator on your Moodle site and go to _Site administration -> Development -> XMLDB editor_. Use the _Doc_ link to see automatically generated documentation built from `install.xml` files.

Expand Down
2 changes: 1 addition & 1 deletion general/development/policies/security/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ We recommend that you follow the [Output functions](/docs/apis/subsystems/output

### Escape data before storing it in the database

- Use the [XMLDB](/general/development/tools/xmldb) library. This takes care of most escaping issues for you.
- Use the [XMLDB](../../tools/xmldb.md) library. This takes care of most escaping issues for you.
- When you must use custom SQL code, **use place-holders** to insert values into the queries.
- Before Moodle 2.0, you had to build SQL by concatenating strings. Take particular care, especially with quoting values, to avoid SQL injection vulnerabilities.
- The `addslashes` method should no longer be use anywhere in Moodle 2.0 onwards.
Expand Down
14 changes: 7 additions & 7 deletions general/development/tools/xmldb.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Location: *Site administration > Development > XMLDB editor*

To use the XMLDB editor to create tables for a new plugin:

TIP for moodle ver 2.8: it would seem you need a "version.php" and a "settings.php" file within your mod/mymodule/ folder, along with a "db" folder that has "WRITE PERMISSION" inside your mod/mymodule/ folder. i assume the 2 files version.php and settings.php are for security, so XMLDB editor does not get abused some how. i would also assume settings.php and version.php need to be filled out to some extent. if you have above things, then you should be able to find your "mod/mymodule/" and be able to click the "create" link.
TIP for moodle ver 2.8: it would seem you need a "version.php" and a "settings.php" file within your `mod/mymodule/` folder, along with a "db" folder that has "WRITE PERMISSION" inside your `mod/mymodule/` folder. i assume the 2 files version.php and settings.php are for security, so XMLDB editor does not get abused some how. i would also assume settings.php and version.php need to be filled out to some extent. if you have above things, then you should be able to find your `mod/mymodule/` and be able to click the "create" link.

1. Under your plugin's directory, create a **`db`** directory, e.g. **`mod/mymodule/db`**. Make sure the web server has write access to this directory.
2. In Moodle, navigate to Site administration->Development->XMLDB editor
Expand Down Expand Up @@ -52,7 +52,7 @@ To get the code for the '// Insert PHP code here' bit, open the XMLDB Editor and

Choose the 'View PHP Code' option and then copy and paste the generated code.

![xmldbeditor-showphpcode.png](./_xmldb/xmldbeditor-showphpcode.png)
![An image showing the XMLDB Editor, highlighting the 'View PHP Code' link](./_xmldb/xmldbeditor-showphpcode.png)

## Use

Expand Down Expand Up @@ -84,11 +84,11 @@ Apart from the [Database Structures guidelines](https://docs.moodle.org/dev/Data
8. Avoid to create all the fields as NOT NULL with the *silly* default value `*` (empty string). The underlying code used to create tables will handle it properly but the XMLDB structure must be REAL. Read more in the [Problems Page](https://docs.moodle.org/dev/XMLDB_Problems#NOT_NULL_fields_using_a_DEFAULT_*_clause).
9. About FOREIGN KEYS
10. Under the tables of every XMLDB file, you must define the existing **Foreign Keys** (FK) properly. This will allow everybody to know a bit better the structure, allow to evolve to a better constrained system in the future and will provide the underlying code with the needed info to create the proper indexes.
12. Note that, if you define any field combination as FK you won't have to create any index on that fields, the code will do it automatically!
13. Respect Convention 1.3
14. About UNIQUE KEYS
15. Declare any fields as UNIQUE KEY (UK) only if they are going to be used as target for one FK. Create unique indexes instead.
16. Respect Convention 1.3
11. Note that, if you define any field combination as FK you won't have to create any index on that fields, the code will do it automatically!
12. Respect Convention 1.3
13. About UNIQUE KEYS
14. Declare any fields as UNIQUE KEY (UK) only if they are going to be used as target for one FK. Create unique indexes instead.
15. Respect Convention 1.3

## See also

Expand Down
2 changes: 1 addition & 1 deletion general/development/tracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ If you find that a bug is still affecting a stable version of Moodle, despite th

## Always add a comment

Remember that the Tracker is a low-bandwith communication medium based mostly on text (like old-fashioned email lists). I am sure you know what you are doing when you edit an issue, but other people cannot read your mind (probably!). It is strongly encouraged that you always add at least a short comment when changing an issue, so it is clear to all watchers what is happening.
Remember that the Tracker is a low-bandwidth communication medium based mostly on text (like old-fashioned email lists). I am sure you know what you are doing when you edit an issue, but other people cannot read your mind (probably!). It is strongly encouraged that you always add at least a short comment when changing an issue, so it is clear to all watchers what is happening.

## See also

Expand Down

0 comments on commit 3f69582

Please sign in to comment.