Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
421fe313
Commit
421fe313
authored
Mar 24, 2008
by
Penny Leach
Committed by
Penny Leach
Sep 15, 2008
Browse files
xmldb upgrade for profile views and fixed bug in install.xml
parent
8465aa3f
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/db/install.xml
View file @
421fe313
...
...
@@ -538,6 +538,7 @@
<FIELD
NAME=
"viewtype"
TYPE=
"char"
LENGTH=
"50"
NOTNULL=
"true"
/>
</FIELDS>
<KEYS>
<KEY
NAME=
"primary"
TYPE=
"primary"
FIELDS=
"blocktype,viewtype"
/>
<KEY
NAME=
"blocktypefk"
TYPE=
"foreign"
FIELDS=
"blocktype"
REFTABLE=
"blocktype_installed"
REFFIELDS=
"name"
/>
<KEY
NAME=
"viewtypefk"
TYPE=
"foreign"
FIELDS=
"viewtype"
REFTABLE=
"view_type"
REFFIELDS=
"type"
/>
</KEYS>
...
...
htdocs/lib/db/upgrade.php
View file @
421fe313
...
...
@@ -1317,6 +1317,54 @@ function xmldb_core_upgrade($oldversion=0) {
insert_record
(
'event_subscription'
,
(
object
)
array
(
'event'
=>
'createuser'
,
'callfunction'
=>
'activity_set_defaults'
));
}
if
(
$oldversion
<
2008032400
)
{
$table
=
new
XMLDBTable
(
'view_type'
);
$table
->
addFieldInfo
(
'type'
,
XMLDB_TYPE_CHAR
,
50
,
XMLDB_UNSIGNED
,
XMLDB_NOTNULL
);
$table
->
addKeyInfo
(
'primary'
,
XMLDB_KEY_PRIMARY
,
array
(
'type'
));
create_table
(
$table
);
$table
=
new
XMLDBTable
(
'blocktype_installed_viewtype'
);
$table
->
addFieldInfo
(
'blocktype'
,
XMLDB_TYPE_CHAR
,
50
,
XMLDB_UNSIGNED
,
XMLDB_NOTNULL
);
$table
->
addFieldInfo
(
'viewtype'
,
XMLDB_TYPE_CHAR
,
50
,
XMLDB_UNSIGNED
,
XMLDB_NOTNULL
);
$table
->
addKeyInfo
(
'primary'
,
XMLDB_KEY_PRIMARY
,
array
(
'blocktype'
,
'viewtype'
));
$table
->
addKeyInfo
(
'blocktypefk'
,
XMLDB_KEY_FOREIGN
,
array
(
'blocktype'
),
'blocktype_installed'
,
array
(
'name'
));
$table
->
addKeyInfo
(
'viewtypefk'
,
XMLDB_KEY_FOREIGN
,
array
(
'viewtype'
),
'view_type'
,
array
(
'type'
));
create_table
(
$table
);
$table
=
new
XMLDBTable
(
'view'
);
$field
=
new
XMLDBField
(
'type'
);
$field
->
setAttributes
(
XMLDB_TYPE_CHAR
,
50
,
XMLDB_UNSIGNED
,
null
);
add_field
(
$table
,
$field
);
$key
=
new
XMLDBKey
(
'typefk'
);
$key
->
setAttributes
(
XMLDB_KEY_FOREIGN
,
array
(
'type'
),
'view_type'
,
array
(
'type'
));
add_key
(
$table
,
$key
);
set_field
(
'view'
,
'type'
,
'portfolio'
);
$field
->
setAttributes
(
XMLDB_TYPE_CHAR
,
50
,
XMLDB_UNSIGNED
,
XMLDB_NOTNULL
);
change_field_notnull
(
$table
,
$field
);
$viewtypes
=
array
(
'portfolio'
,
'profile'
);
foreach
(
$viewtypes
as
$vt
)
{
insert_record
(
'view_type'
,
(
object
)
array
(
'type'
=>
$vt
,
));
}
if
(
$blocktypes
=
plugins_installed
(
'blocktype'
))
{
foreach
(
$blocktypes
as
$bt
)
{
install_blocktype_viewtypes_for_plugin
(
blocktype_single_to_namespaced
(
$bt
->
name
,
$bt
->
artefactplugin
));
}
}
// migrate all users to their default profile view
if
(
$userids
=
get_column
(
'usr'
,
'id'
))
{
foreach
(
$userids
as
$user
)
{
install_default_profile_view
(
array
(
'id'
=>
$user
));
}
}
}
return
$status
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment