-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodule_install.php
More file actions
28 lines (24 loc) · 949 Bytes
/
module_install.php
File metadata and controls
28 lines (24 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
/*******
* the line below safe-guards this file from being accessed directly from
* a web browser. It will only execute if required from within an ATutor script,
* in our case the Module::install() method.
*/
if (!defined('AT_INCLUDE_PATH')) { exit; }
$_admin_privilege = TRUE; // possible values: FALSE | TRUE
/******
* the following code checks if there are any errors (generated previously)
* then uses the SqlUtility to run any database queries it needs, ie. to create
* its own tables.
*/
if (!$msg->containsErrors() && file_exists(dirname(__FILE__) . '/module.sql')) {
// deal with the SQL file:
require(AT_INCLUDE_PATH . 'classes/sqlutility.class.php');
$sqlUtility = new SqlUtility();
/*
* the SQL file could be stored anywhere, and named anything, "module.sql" is simply
* a convention we're using.
*/
$sqlUtility->queryFromFile(dirname(__FILE__) . '/module.sql', TABLE_PREFIX);
}
?>