Commit f83d7185 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files
parents a5e6d178 1a4b4ab6
......@@ -89,16 +89,16 @@ function auth_get_auth_instances() {
$sql ='
SELECT DISTINCT
i.id,
institution.name,
institution.displayname,
inst.name,
inst.displayname,
i.instancename
FROM
'.$dbprefix.'institution,
'.$dbprefix.'institution inst,
'.$dbprefix.'auth_instance i
WHERE
i.institution = institution.name
i.institution = inst.name
ORDER BY
institution.displayname,
inst.displayname,
i.instancename';
$cache = get_records_sql_array($sql, array());
......@@ -305,6 +305,7 @@ function uploadcsv_submit(Pieform $form, $values) {
}
$user->passwordchange = 1;
$id = insert_record('usr', $user, 'id', true);
$user->id = $id;
foreach ($FORMAT as $field) {
if ($field == 'username' || $field == 'password') {
......
......@@ -78,6 +78,12 @@ function activity_occurred($activitytype, $data) {
*/
function handle_activity($activitytype, $data, $cron=false) {
// mysql compatibility (sigh...)
$casturl = 'CAST(? AS TEXT)';
if (get_config('dbtype') == 'mysql') {
$casturl = 'CAST(? AS CHAR)'; // note, NOT varchar
}
$data = (object)$data;
if (is_string($activitytype)) {
$activitytype = get_record('activity_type', 'name', $activitytype);
......@@ -232,7 +238,7 @@ function handle_activity($activitytype, $data, $cron=false) {
}
$data->message = $oldsubject . ' ' . get_string('onview', 'activity')
. ' ' . $viewinfo->title . ' ' . get_string('ownedby', 'activity');
$sql = 'SELECT u.*, p.method, CAST(? AS TEXT) AS url
$sql = 'SELECT u.*, p.method, ' . $casturl . ' AS url
FROM ' . $prefix . 'usr_watchlist_view wv
JOIN ' . $prefix . 'usr u
ON wv.usr = u.id
......@@ -320,7 +326,7 @@ SELECT DISTINCT u.*, p.method, ?||wa.view AS url
$oldsubject = $data->subject;
$data->subject = get_string('watchlistmessagecommunity', 'activity');
$data->message = $oldsubject . ' ' . get_string('oncommunity', 'activity') . ' ' . $communityname;
$sql = 'SELECT DISTINCT u.*, p.method, CAST(? AS TEXT) AS url
$sql = 'SELECT DISTINCT u.*, p.method, ' . $casturl . ' AS url
FROM ' . $prefix . 'usr_watchlist_community c
JOIN ' . $prefix . 'usr u
ON c.usr = u.id
......
......@@ -475,7 +475,11 @@ function core_install_defaults() {
$user->lastname = 'User';
$user->email = 'root@example.org';
$user->quota = get_config_plugin('artefact', 'file', 'defaultquota');
insert_record('usr', $user);
$newid = insert_record('usr', $user);
if ($newid > 0 && get_config('dbtype') == 'mysql') { // gratuitous mysql workaround
set_field('usr', 'id', 0, 'id', $newid);
}
// Insert the admin user
$user = new StdClass;
......
......@@ -227,6 +227,10 @@ class XMLDBgenerator {
$table = trim($table,',');
$table .= "\n)";
if ($this->table_extra_code) {
$table .= $this->getTableExtraSQL($xmldb_table);
}
/// Add the CREATE TABLE to results
$results[] = $table;
......
......@@ -55,6 +55,8 @@ class XMLDBmysql extends XMLDBGenerator {
var $enum_extra_code = false; //Does the generator need to add extra code to generate code for the enums in the table
var $table_extra_code = true;
var $add_after_clause = true; // Does the generator need to add the after clause for fields
var $concat_character = null; //Characters to be used as concatenation operator. If not defined
......@@ -71,6 +73,7 @@ class XMLDBmysql extends XMLDBGenerator {
var $rename_key_sql = null; //SQL sentence to rename one key (MySQL doesn't support this!)
//TABLENAME, OLDKEYNAME, NEWKEYNAME are dinamically replaced
var $foreign_keys = true; // Does the generator build foreign keys
/**
* Creates one new XMLDBmysql
*/
......@@ -229,6 +232,11 @@ class XMLDBmysql extends XMLDBGenerator {
return 'enum(' . implode(', ', $xmldb_field->getEnumValues()) . ')';
}
function getTableExtraSQL($xmldb_table) {
return 'TYPE=innodb'; // mahara only ever wants innodb because we want foreign keys!
}
/**
* Returns the code (in array) needed to add one comment to the table
*/
......
......@@ -275,7 +275,7 @@ EOF;
}
$messagepref = get_account_preference($userid, 'messages');
if (($is_friend && $messagepref == 'friends') || $messagepref == 'allow') {
if (($is_friend && $messagepref == 'friends') || $messagepref == 'allow' || $USER->get('admin')) {
$messageform = array(
'name' => 'messageform',
'jsform' => true,
......
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