Moodle Administration
上QQ阅读APP看书,第一时间看更新

Moodle Architecture

We will first look at the overall LAMP architecture on which Moodle is based, before we cover the internal components of the VLE layer.

The LAMP Architecture

Moodle is developed on the open-source LAMP framework consisting of Linux (operating system), Apache (web server), MySQL (database), and PHP (programming language). Due to the portability of these components and the modularity of Moodle itself (that's what the "M" stands for), it can support a wide range of operating systems, database systems, and web servers. A simple overview of the LAMP architecture can be shown as follows:

The LAMP Architecture

The lowest level is the Operating System. While Linux is the preferred platform, other UNIX derivatives such as Solaris and AIX are supported as well, along with Windows and Mac OS X. Certain libraries will have to be installed, a topic we covered in the previous chapter on installation.

PHP is the Programming Language in which Moodle is developed (accompanied by HTML and CSS files). It is the only component that cannot be replaced with any counterpart.

MySQL is the database of choice for most open-source applications, but other database systems such as PostgreSQL, Oracle, and Microsoft SQL Server too work without problems. Again, detailed information has been provided in the chapter on installation.

Apache has become the de-facto standard for the large-scale web applications, closely followed by Microsoft IIS. Both the web servers are supported like any others offering a PHP support.

The interaction of the elements in the Moodle architecture is shown in the following image:

The LAMP Architecture

The user makes Requests via the web browser interface (for example, display a learning resource). The web browser passes the request on to the Web Server, which calls the PHP module that is responsible for the call. The PHP module Calls the Database with an action (query, update, insert, or delete operation) that Returns the requested data. Based on this information, the PHP module returns data (usually in the form of HTML code) to the web server, which passes the information to be displayed back to the user's browser.

The Moodle Layer

Now, let's look at the Moodle layer in more detail. The main building blocks of Moodle are shown in the following image:

The Moodle Layer

Moodle distinguishes between Code (mostly written in PHP, HTML, and CSS) and Data (values added in the configuration files via the Moodle interface, or manually).

Moodle Libraries, Modules (such as resources and activities), Blocks, Plug-ins, and other units are represented in a code. The code is always stored in files within the Moodle directory structure. The code includes all the elements that deal with the back-end (server) and front-end (user interface) operations.

The data regarding Moodle courses, users, roles, groups, and so on (for example, grades) is mostly stored in the Moodle database. However, certain data, such as user pictures, is stored in specific files or directories.

Now let's have a look at how the Moodle files area, that is, the directory structure is organized.

Code and Data Locations

Though Moodle takes care of the organization of its code and data, it is good to know where a file is located in your learning system.

All the system files, that is, the files that are required to run Moodle, are located in a number of directories under $CFG->dirroot (the root directory of your Moodle installation). These files are potentially replaced when updating Moodle. The structure is as follows (All directories are located on the same level. However, some folders contain sub-directories.):

  • Admin-code to administrate the server
  • auth-plug-ins to authenticate the users
  • backup- code for backup and restore operations
  • blocks-plug-ins for Moodle blocks
  • blog-code -for Moodle blogging facility
  • calendar-code to manage and display calendars
  • course- code to display and manage courses
  • enroll-plug-ins to enroll the users
  • error-code for error-handling
  • files-code to display and manage the uploaded files
  • filter-plug-ins for Moodle filters
  • grade-code to manage the gradebook functionality and reports
  • group-code to handle groups and groupings
  • install-code to install Moodle
  • iplookup-code for looking up IP addresses
  • lang-localization strings; one directory per language
  • lib-libraries of the core Moodle code
  • login-code to handle login and account creation
  • message-code for the messaging tool
  • mnet-code to handle the Moodle networking
  • mod-code of the main Moodle course modules
  • my-code to handle myMoodle
  • notes-code to handle notes in the user profiles
  • pix-generic site graphics
  • question-code to deal with the question bank
  • rss-code to handle the RSS feeds
  • search-code to perform searches
  • sso-code for single sign-on operations
  • tag-code for tagging
  • theme-Moodle themes
  • user-code to display and manage the users
  • userpix-code to handle the user pictures (currently not used)

Moodle data that includes everything the users have added to the system such as learning resources by teachers, forum posts, or assignments by students, and system settings by the administrator, is stored in two locations:

  1. Data stored in the database
  2. Data stored in the $CFG->dataroot directory (called "moodledata" by default)

Moodle stores almost all data in the used database, except for the files. Only a link for the files is stored in the database, and the actual files are stored in a directory specified by the $CFG->dataroot variable in config.php. This is called as moodledata directory and is organized as follows:

1 Front page files Moodle architecturemoodledata directory, organizing2 Files for course number 2 3 Files for course number 3 cache Caching data sessions User session data temp Temporary file upgradelogs Log file for each Moodle upgrade that has been performed user User-related data

At creation, each course is allocated a unique number, which is also used as the name for the sub-directory. The exception is the front page, which is treated as a course but is always given the number "one".

Note

To detect what ID a course has been allocated, take the cursor over the course name and the link will look something like this: http://.../course/view.php?id=5. The number that follows the ID is the number of the course, which is five in this case.

When problems occur, or before carrying out a Moodle update, it is sometimes necessary to delete the caching data, user sessions, and any other temporary information Moodle has created. This data is located in the respective directories in the structure shown previously. This is important, since once everybody has logged out, you can safely delete any files in the directories' cache, sessions, and temp, respectively.