Commit 46e42f4c authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Start of quota support, adds fields to the usr table, and file plugin to manage default quota

parent e8512c55
......@@ -50,7 +50,6 @@ function xmldb_artefact_file_upgrade($oldversion=0) {
insert_record('artefact_file_files', $data);
}
}
}
return $status;
......
......@@ -48,6 +48,22 @@ class PluginArtefactFile extends PluginArtefact {
)
);
}
public static function get_event_subscriptions() {
$subscriptions = array(
(object)array(
'plugin' => 'file',
'event' => 'createuser',
'callfunction' => 'newuser',
),
);
return $subscriptions;
}
public static function newuser($event, $user) {
update_record('usr', array('quotaused' => 0, 'quota' => get_config_plugin('defaultquota')), array('id' => $user->id));
}
public static function get_toplevel_artefact_types() {
return array('file');
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2007010900;
$config->version = 2007011603;
$config->release = '0.1';
?>
......@@ -79,6 +79,8 @@
<FIELD NAME="suspendedctime" TYPE="datetime" NOTNULL="false"/>
<FIELD NAME="suspendedreason" TYPE="text" NOTNULL="false"/>
<FIELD NAME="suspendedcusr" TYPE="int" LENGTH="10" NOTNULL="false"/>
<FIELD NAME="quota" TYPE="int" LENGTH="10" NOTNULL="false"/>
<FIELD NAME="quotaused" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
......
......@@ -159,6 +159,19 @@ function xmldb_core_upgrade($oldversion=0) {
add_field($table, $field);
}
if ($oldversion < 2007011600) {
// Add the 'quota' and 'quotaused' fields to the usr table
$table = new XMLDBTable('usr');
$field = new XMLDBField('quota');
$field->setAttributes(XMLDB_TYPE_INTEGER, 10, false, false, false);
add_field($table, $field);
$field = new XMLDBField('quotaused');
$field->setAttributes(XMLDB_TYPE_INTEGER, 10, false, true, null, null, null, 0);
add_field($table, $field);
execute_sql('UPDATE ' . get_config('dbprefix') . 'usr SET quota=10485760');
}
return $status;
}
......
......@@ -27,8 +27,8 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2007011500;
$config->release = '0.3.1';
$config->version = 2007011600;
$config->release = '0.3.2';
$config->minupgradefrom = 2006121501;
$config->minupgraderelease = '0.1 (build tag BUILD_20061215)';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment