Skip to content
GitLab
Menu
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
038d4fee
Commit
038d4fee
authored
Apr 07, 2009
by
Elliot Pahl
Committed by
Elliot Pahl
Apr 07, 2009
Browse files
Whitespace fixes.
parent
712596eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/upgrade.php
View file @
038d4fee
...
...
@@ -56,7 +56,7 @@ function check_upgrades($name=null) {
if
(
empty
(
$name
)
||
$name
==
'core'
)
{
try
{
$coreversion
=
get_config
(
'version'
);
}
}
catch
(
Exception
$e
)
{
$coreversion
=
0
;
}
...
...
@@ -74,10 +74,10 @@ function check_upgrades($name=null) {
$core
->
torelease
=
$config
->
release
;
$toupgrade
[
'core'
]
=
$core
;
$installing
=
true
;
}
}
else
if
(
$config
->
version
>
$coreversion
)
{
$corerelease
=
get_config
(
'release'
);
if
(
isset
(
$config
->
minupgradefrom
)
&&
isset
(
$config
->
minupgraderelease
)
if
(
isset
(
$config
->
minupgradefrom
)
&&
isset
(
$config
->
minupgraderelease
)
&&
$coreversion
<
$config
->
minupgradefrom
)
{
throw
new
ConfigSanityException
(
"Must upgrade to
$config->minupgradefrom
"
.
"(
$config->minupgraderelease
) first "
...
...
@@ -139,7 +139,7 @@ function check_upgrades($name=null) {
$btlocation
=
get_config
(
'docroot'
)
.
$plugin
.
'/'
.
$dir
.
'/blocktype'
;
if
(
!
is_dir
(
$btlocation
))
{
continue
;
}
}
$btdirhandle
=
opendir
(
$btlocation
);
while
(
false
!==
(
$btdir
=
readdir
(
$btdirhandle
)))
{
if
(
strpos
(
$btdir
,
'.'
)
===
0
)
{
...
...
@@ -273,7 +273,7 @@ function upgrade_core($upgrade) {
set_config
(
'version'
,
$upgrade
->
to
);
set_config
(
'release'
,
$upgrade
->
torelease
);
if
(
!
empty
(
$upgrade
->
install
))
{
core_postinst
();
}
...
...
@@ -299,7 +299,7 @@ function upgrade_plugin($upgrade) {
if
(
$plugintype
==
'blocktype'
&&
strpos
(
$pluginname
,
'/'
)
!==
false
)
{
list
(
$artefactplugin
,
$blocktypename
)
=
explode
(
'/'
,
$pluginname
);
}
}
$location
=
get_config
(
'docroot'
)
.
$plugintype
.
'/'
.
$pluginname
.
'/db/'
;
$db
->
StartTrans
();
...
...
@@ -349,7 +349,7 @@ function upgrade_plugin($upgrade) {
if
(
!
empty
(
$upgrade
->
install
))
{
insert_record
(
$installtable
,
$installed
);
}
}
else
{
update_record
(
$installtable
,
$installed
,
'name'
);
}
...
...
@@ -386,7 +386,7 @@ function upgrade_plugin($upgrade) {
}
}
}
if
(
$events
=
call_static_method
(
$pcname
,
'get_event_subscriptions'
))
{
foreach
(
$events
as
$event
)
{
$event
=
(
object
)
$event
;
...
...
@@ -461,7 +461,7 @@ function upgrade_plugin($upgrade) {
array_merge
(
array
(
$pluginname
),
$types
));
}
}
// install blocktype categories.
if
(
$plugintype
==
'blocktype'
&&
get_config
(
'installed'
))
{
install_blocktype_categories_for_plugin
(
$pluginname
);
...
...
@@ -470,7 +470,7 @@ function upgrade_plugin($upgrade) {
$prevversion
=
(
empty
(
$upgrade
->
install
))
?
$upgrade
->
from
:
0
;
call_static_method
(
$pcname
,
'postinst'
,
$prevversion
);
if
(
$db
->
HasFailedTrans
())
{
$status
=
false
;
}
...
...
@@ -479,17 +479,17 @@ function upgrade_plugin($upgrade) {
/* they do themselves already
// we have to do this after committing the current transaction because we call ourselves recursively...
if ($plugintype == 'artefact' && get_config('installed')) {
// only install associated blocktype plugins if we're not in the process of installing
// only install associated blocktype plugins if we're not in the process of installing
if ($blocktypes = call_static_method($pcname, 'get_block_types')) {
foreach ($blocktypes as $bt) {
if ($upgrade = check_upgrades('blocktype.' . $pluginname . '/' . $bt)) {
upgrade_plugin($upgrade);
upgrade_plugin($upgrade);
}
}
}
}
*/
return
$status
;
}
...
...
@@ -547,8 +547,8 @@ function core_postinst() {
set_config
(
'lang'
,
'en.utf8'
);
set_config
(
'installation_key'
,
get_random_key
());
// PostgreSQL supports indexes over functions of columns, MySQL does not.
// So we can improve the index on the username field of the usr table for
// PostgreSQL supports indexes over functions of columns, MySQL does not.
// So we can improve the index on the username field of the usr table for
// Postgres
if
(
is_postgres
())
{
execute_sql
(
'DROP INDEX {usr_use_uix}'
);
...
...
@@ -631,7 +631,7 @@ function core_install_lastcoredata_defaults() {
db_commit
();
// if we're installing, set up the block categories here and then poll the plugins.
// if we're upgrading this happens somewhere else. This is because of dependency issues around
// if we're upgrading this happens somewhere else. This is because of dependency issues around
// the order of installation stuff.
install_blocktype_extras
();
...
...
@@ -640,7 +640,7 @@ function core_install_lastcoredata_defaults() {
function
core_install_firstcoredata_defaults
()
{
// Install the default institution
db_begin
();
set_config
(
'session_timeout'
,
86400
);
set_config
(
'sitename'
,
'Mahara'
);
set_config
(
'defaultaccountinactivewarn'
,
604800
);
...
...
@@ -703,7 +703,7 @@ function core_install_firstcoredata_defaults() {
foreach
(
$subs
as
$sub
)
{
insert_record
(
'event_subscription'
,
(
object
)
$sub
);
}
// install the activity types
$activitytypes
=
array
(
array
(
'maharamessage'
,
0
,
0
),
...
...
@@ -749,7 +749,7 @@ function core_install_firstcoredata_defaults() {
$cron
->
dayofweek
=
$times
[
4
];
insert_record
(
'cron'
,
$cron
);
}
// install the view column widths
install_view_column_widths
();
...
...
@@ -763,9 +763,9 @@ function core_install_firstcoredata_defaults() {
}
/**
* xmldb will pass us the xml file and we can perform any substitution as necessary
*/
/**
* xmldb will pass us the xml file and we can perform any substitution as necessary
*/
function
local_xmldb_contents_sub
(
&
$contents
)
{
// the main install.xml file needs to sub in plugintype tables.
$searchstring
=
'<!-- PLUGIN_TYPE_SUBSTITUTION -->'
;
...
...
@@ -777,12 +777,12 @@ function local_xmldb_contents_sub(&$contents) {
$plugintables
=
file_get_contents
(
get_config
(
'docroot'
)
.
'lib/db/plugintables.xml'
);
$tosub
=
''
;
foreach
(
plugin_types
()
as
$plugin
)
{
// any that want their own stuff can put it in docroot/plugintype/lib/db/plugintables.xml
// any that want their own stuff can put it in docroot/plugintype/lib/db/plugintables.xml
//- like auth is a bit special
$specialcase
=
get_config
(
'docroot'
)
.
$plugin
.
'/plugintables.xml'
;
if
(
is_readable
(
$specialcase
))
{
$tosub
.
=
file_get_contents
(
$specialcase
)
.
"
\n
"
;
}
}
else
{
$replaced
=
''
;
// look for tables to put at the start...
...
...
@@ -927,7 +927,7 @@ function install_blocktype_extras() {
}
/**
* Installs all the allowed column widths for views. Used when installing core
* Installs all the allowed column widths for views. Used when installing core
* defaults, and also when upgrading from 0.8 to 0.9
*/
function
install_view_column_widths
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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