Show Menu
Cheatography

Moodle Server management Cheat Sheet (DRAFT) by

cheat sheet for Moodle Management on ubuntu

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Moodle

location of moodle
/data/­www­/cu­sto­mer­/pu­bli­c_html
location of moodledata
/data/­nfs­/cu­sto­mer­/mo­odl­edata

Context Levels

system
CONTEX­T_S­YSTEM
10
user
CONTEX­T_USER
30
course category
CONTEX­T_C­OUR­SECAT
40
course
CONTEX­T_C­OURSE
50
module
CONTEX­T_M­ODULE
70
block
CONTEX­T_BLOCK
80

Force debug mode in config.php

// Force a debugging mode regardless the settings in the site administration
@error_reporting(E_ALL | E_STRICT);
@ini_set('display_errors', '1');
$CFG->debug = (E_ALL | E_STRICT);
$CFG->debugdisplay = 1;
$CFG->debugusers = '2';
$CFG->cachejs = false;
NOT FOR PRODUCTION SITES

easy get error

    echo '<pre>';
print_r($lti);
echo "</pre>\n\n";
die(__FILE__.' ' . 'on line' . ' '.__LINE__);
put in PHP file to see contents of variable
 

MySQL queries

SELECT COUNT(column_name) FROM table_name WHERE column_name = value;
count the number of occurr­ences of a specific value in a column

update row with value same row

UPDATE table_name SET column1 = column2 WHERE some_column = some_value;
You can use the UPDATE statement in MySQL to update a cell in a table with a value from another cell on the same row. Here's an example:

compare a row from a table with another table

SELECT u.username 
FROM user u
JOIN other_table o ON u.username LIKE CONCAT(o.username, '%')

show all occure­ncies of a value more than 2x

SELECT column_name, COUNT(column_name) AS count
FROM table_name
GROUP BY column_name
HAVING COUNT(column_name) > 2;
i want to show all occure­ncies of a value in a colum that occur more than 2 times
 

Ubuntu

rsync folder without subfolder
rsync -av --excl­ude­='<­sub­fol­der­_na­me>' <so­urc­e_f­old­er> <de­sti­nat­ion>
show files made/m­odified last 2 hours
find /path/­to/­folder -type f -mmin -120
write php output to file
php script.php >> output.txt 2>&1

Navigation

j
cursor up
k
cursor down
h
cursor left
l
cursor right
e
end of word
w
start of next word
b
previous word
d
Delete
dd
Delete entire line
gg
top of file
G
bottom of File