Archive for the 'moodle' Category

Deleting incorrectly submitted assignments

Wednesday, January 27th, 2010

Open the submitted assignments grading page and hover over the file that has been submitted

At the bottom left hand corner of your browser it should give you the full url to that file including after the word assignment the assignment id (i.e. 201) and the student id (i.e. 56), e.g. /assignment/201/56/submittedfile.doc
Open the files directory in a new tab or window and navigate into moddata/assignment/201/56/

Right click on the submitted file and save to desktop (just incase something goes wrong)

Now delete the folder and the file in it (/56/)

There is still a row in the database that says the student has submitted a file so open the database and the assignment_submissions table, search for the assignment id (201) and userid (56)

Delete the row

Go back and log in as the student to check they can now upload a file.

Search moodle for crazy overrides!

Thursday, February 5th, 2009

SELECT *  FROM `role_capabilities` WHERE `roleid` = 7 and capability LIKE ‘%forum%’ ORDER BY `role_capabilities`.`capability` ASC

MySQL search and replace

Thursday, February 5th, 2009

UPDATE resource SET alltext = replace(alltext,””,”"), name=replace(name,””,”"), summary=replace(summary,””,”")

UPDATE assignment SET description = replace(description,””,”")

UPDATE block_search_documents SET title = replace(title,””,”")

UPDATE cache_text SET formattedtext = replace(formattedtext,””,”")

UPDATE course_sections SET summary = replace(summary,””,”")

UPDATE event SET description = replace(description,””,”")

UPDATE forum SET intro = replace(intro,””,”")

UPDATE forum_posts SET message = replace(message,””,”")

UPDATE glossary_comments SET entrycomment = replace(entrycomment,””,”")

UPDATE glossary_entries SET definition = replace(definition,””,”")

UPDATE label SET name = replace(name,””,”"), content = replace(content,””,”")

UPDATE lesson_pages SET contents = replace(contents,””,”")

UPDATE message SET message = replace(message,””,”")

UPDATE message_read SET message = replace(message,””,”")

UPDATE question SET questiontext = replace(questiontext,””,”"), generalfeedback = replace(generalfeedback,””,”")

UPDATE question_answers SET feedback = replace(feedback,””,”")

UPDATE quiz_feedback SET feedbacktext = replace(feedbacktext,””,”")

TAGS - moodle - strange characters - search and replace

Working with web files and permissions in Linux

Thursday, November 22nd, 2007

Change all files to 644: chmod 644 -R . (assuming you’re running from the web root)

Change all directories to 755: find . -type d -exec chmod 755 {} + (again assuming you’re running from the web root)

For older versions of linux/shells use: find . -type d -exec chmod 755 {} \;

Moodle :: Automatically purging data from DB after each semester

Thursday, November 8th, 2007

http://moodle.org/mod/forum/discuss.php?d=77241

http://moodle.org/mod/forum/discuss.php?d=53142#p349045 

Context Levels in Moodle

Thursday, November 8th, 2007

// context definitions
define(’CONTEXT_SYSTEM’, 10);
define(’CONTEXT_PERSONAL’, 20);
define(’CONTEXT_USER’, 30);
define(’CONTEXT_COURSECAT’, 40);
define(’CONTEXT_COURSE’, 50);
define(’CONTEXT_GROUP’, 60);
define(’CONTEXT_MODULE’, 70);
define(’CONTEXT_BLOCK’, 80);

Setting up a moodle box and Oracle database (for comms with external Oracle dbase) on Fedora Core 6 (x86)

Friday, December 8th, 2006

1. Install Fedora Core 6 with the following settings:

Desktop Environments: Gnome
Applications: Editors
Graphical Internet
Development: Development Libraries
Developer Tools
Legacy Software Development
Servers: MySql Database (Note! Check php-mysql-5.1.6-3.1.fc6)
Server Configuration Tools
Web Server
Base System: Admin Tools
Base
System Tools
Legacy Software Support
XWindow System

2. Disable SELinux from startup program.

3. Turn off non-essential services:

acpid netfs
apmd nfslock
autofs pcscd
avahi-daemon portmap
bluetooth readahead_early
cpuspeed readahead_later
cups restorecond
firstboot rpcgssd
gpm rpcidmapd
haldaemon sendmail
hidd smartd
irqbalance  
kudzu  
mcstrans  
mdmonitor  
messagebus  

4. Install a couple of plugins:

yum install gd-devel
yum -y install php-gd
yum provides php-gd

yum -y install php-mbstring
yum provides php-mbstring

5. Install PhpMyAdmin

Download the most recent package using wget and unpack it using tar xzvf downloadedfilename
Move unpacked folder contents to /var/www/phpmyadmin

6. Edit the /etc/httpd/conf/httpd.conf

Setup Virtual Servers:
Uncomment Name Based Server line and put the IP addess of the server in there.
Create a virtual directory simulating the example provided within the file.

7. Create the config.inc.php for phpmyadmin and remember to include a password

For ease of use set the phpmyadmin virtual directory to the ip address of your server through httpd.conf and login to it via a web browser. From here you will be able to configure a config.inc.php file for phpymyadmin. Note: you will have to create a writable config directory within the phpmyadmin root directory. Make sure the character set is set to UTF8.

8. Download moodle

http://download.moodle.org/stable17/moodle-latest-17.tgz
Install it using a web browser to administer it.

From this point on the notes have been adapted from Oracle help resource (click on this link to access)

9. Download the Oracle database and openmotif RPM from the following areas:

http://www.oracle.com/technology/software/products/database/oracle10g/index.html
ftp://fr.rpmfind.net/linux/fedora/core/4/i386/os/Fedora/RPMS/openmotif21-2.1.30-14.i386.rpm

Unpack the oracle database zip file.

10. Edit the hosts file to include a fully qualified name for the server

E.g. 131.231.84.12 gilo.lut.ac.uk gilo
i.e.

11. Set the Kernal Parameters

Add the following lines to the /etc/sysctl.conf file:

kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144

Run the following command to change the current Kernel parameters:

/sbin/sysctl -p

12. Add the following to the /etc/security/limits.conf file

* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536

13. Add the following to the /etc/pam.d/login file, if it doesn’t already exist

session required /lib/security/pam_limits.so

14. Ensure SELinux is disabled by editing the /etc/selinux/config file, making sure the SELINUX flag is set as follows:

SELINUX=disabled

15. Install the following packages from Fedora Core 5

I downloaded an iso from the lboro site here and mounted it using the following commands

mkdir /mnt/iso
mount -o loop -t iso9660 yourcd.iso /mnt/iso

# From Fedora Core 5 DVD
cd /media/dvd/Fedora/RPMS
rpm -Uvh setarch-*
rpm -Uvh –force tcl-*
rpm -Uvh –force libXau-devel-* libXp-*
rpm -Uvh compat-db-*
rpm -Uvh compat-libstdc++-33*
rpm -Uvh compat-libf2c-34-*
rpm -Uvh compat-gcc-34-*
rpm -Uvh libaio-*
rpm -Uvh compat-gcc-34-c++-*
rpm -Uvh compat-libstdc++-296*
rpm -Uvh compat-libgcc-296*

# From download
rpm -Uvh openmotif21-2.1.30-14.i386.rpm

16. Create the new groups and users:

groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba oracle
passwd oracle (choose your password here)

17. Create the directories in which the Oracle software will be installed:

mkdir -p /u01/app/oracle/product/10.2.0/db_1
chown -R oracle.oinstall /u01

Login as root (if not already in root) and issue the following:

xhost +

Edit the /etc/redhat-release file replacing the current information with:

redhat-4

18. Login as the oracle user and add the following lines to the end of the .bash_profile file:

# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=TSH1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

if [ $USER = “oracle” ]; then
if [ $SHELL = “/bin/ksh” ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

19 .Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory:

./runInstaller

Note: I had to change permissions on the folder (chmod 777 -R database) to run the Installer

2nd Note: I also had to issue yum install libXp as this package wasn’t installed

See the Installation section of this help resource to see screen shots of the installation screens

The three I found most useful are here:

Select Installation Method

Specify Inventory Directory and Credentials

Specify Home Details

20. Download and install the Oracle Client

http://download.oracle.com/otn/linux/oracle10g/10201/10201_client_linux32.zip

Same as before unpack it in the Oracle directory you unpacked the database too and run the installer same as before.

21. Post installation Commands

Edit the /etc/redhat-release file restoring the original release information:

Fedora Core release 6 (Zod)

Finally edit the /etc/oratab file setting the restart flag for each instance to ‘Y’:

:/u01/app/oracle/product/10.2.0/db_1:Y

22. Create links to a couple of libraries that are automatically missing

nano /etc/ld.so.conf.d/oracle.conf

At the top of the file type: /u01/app/oracle/product/10.2.0/db_1/lib

Save and close

 

That’s a lot of steps.

Installing GD on Linux

Thursday, December 7th, 2006

Taken courtesy of Moodle forums

http://moodle.org/mod/forum/discuss.php?d=58641

I have done quite a few Moodle 1.6.3 installs and found that while php.ini may say that GD (the graphics library) is enabled, when you fire up the Moodle setup page it says Caution: GD not enabled, or something similar. I am on Centos so I tend to use Yum to install these things, which is also available for Fedora Core, if it’s not installed then you should install it, it makes package and dependency installations so much easier. With yum the following will fix the GD caution (don’t forget to restart Apache afterwards):

yum install gd-devel
yum -y install php-gd
yum provides php-gd

Setting up a moodle box

Friday, December 1st, 2006

1.       Install Fedora with the following settings:

Desktop Environments: Gnome (optional)
Applications:  Editors
Development: None
Servers:  FTP Server
MySQL Database
Server Configuration Tools
Web Server
Base System: Admin tools
Base
Java
XWindow System

2.       Run updates with yum update

3.       Turn off non-essential services:

acpid
apmd
autofs
avahi-daemon
bluetooth
cpuspeed
cups
firstboot
gpm
haldaemon
hidd
kudzu
mcstrans
mdmonitor
messagebus
netfs
nfslock
pcscd
portmap
readahead_early
readahead_later
restorecond
rpcgssd
rpcidmapd
sendmail
smartd

4.       Install a couple of plugins:

yum install gd-devel
yum –y install php-gd
yum provides php-gd

yum –y install php-mbstring
yum provides php-mbstring

5.       Install phpmyadmin

Download recent package using wget (obtaining most recent stable version from http://www.phpmyadmin.net/)
Unpack it using tar xzvf
Move it to a /var/www/phpmyadmin folder

6.       Edit /etc/httpd/conf/httpd.conf

Setup Virtual Servers:
Uncomment Name Based Server line and put IP address of server in there
Create a Virtual Directory simulating the example provided within the file.

7.       Create the config.inc.php for phpmyadmin and remember to include a password

For ease of use set the phpmyadmin virtual directory through httpd.conf and login to it via a browser.  From here you’ll be able to configure a config.inc.php file for phpmyadmin.  Make sure the character set is UTF8!

8.       Download Moodle

http://download.moodle.org/stable17/moodle-latest-17.tgz
Install it using a web browser to administer it.