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
8f551215
Commit
8f551215
authored
Aug 04, 2015
by
Son Nguyen
Committed by
Gerrit Code Review
Aug 04, 2015
Browse files
Merge "Bug 1479543: Allowing updating artefact table to run smoother"
parents
21762bff
c614cf4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/db/upgrade.php
View file @
8f551215
...
@@ -3326,7 +3326,23 @@ function xmldb_core_upgrade($oldversion=0) {
...
@@ -3326,7 +3326,23 @@ function xmldb_core_upgrade($oldversion=0) {
// Fill the new field with path data.
// Fill the new field with path data.
// Set all artefacts to the path they'd have if they have no parent.
// Set all artefacts to the path they'd have if they have no parent.
log_debug
(
'Filling in parent artefact paths'
);
log_debug
(
'Filling in parent artefact paths'
);
execute_sql
(
"UPDATE
{
artefact
}
SET path = '/' || id WHERE parent IS NULL"
);
if
(
get_config
(
'searchplugin'
)
==
'elasticsearch'
)
{
log_debug
(
'Dropping elasticsearch artefact triggers'
);
require_once
(
get_config
(
'docroot'
)
.
'search/elasticsearch/lib.php'
);
ElasticsearchIndexing
::
drop_triggers
(
'artefact'
);
}
$count
=
0
;
$limit
=
1000
;
$limitsmall
=
200
;
$total
=
count_records_select
(
'artefact'
,
'path IS NULL AND parent IS NULL'
);
for
(
$i
=
0
;
$i
<=
$total
;
$i
+=
$limitsmall
)
{
execute_sql
(
"UPDATE
{
artefact
}
SET path = CONCAT('/', id) WHERE path IS NULL AND parent IS NULL LIMIT "
.
$limitsmall
);
$count
+=
$limitsmall
;
if
((
$count
%
$limit
)
==
0
||
$count
==
$total
)
{
log_debug
(
"
$count
/
$total
"
);
set_time_limit
(
30
);
}
}
$newcount
=
count_records_select
(
'artefact'
,
'path IS NULL'
);
$newcount
=
count_records_select
(
'artefact'
,
'path IS NULL'
);
if
(
$newcount
)
{
if
(
$newcount
)
{
$childlevel
=
0
;
$childlevel
=
0
;
...
@@ -3363,6 +3379,10 @@ function xmldb_core_upgrade($oldversion=0) {
...
@@ -3363,6 +3379,10 @@ function xmldb_core_upgrade($oldversion=0) {
}
while
(
$newcount
>
0
&&
$newcount
<
$lastcount
);
}
while
(
$newcount
>
0
&&
$newcount
<
$lastcount
);
log_debug
(
"Done filling in child artefact paths"
);
log_debug
(
"Done filling in child artefact paths"
);
}
}
if
(
get_config
(
'searchplugin'
)
==
'elasticsearch'
)
{
log_debug
(
"Add triggers back in"
);
ElasticsearchIndexing
::
create_triggers
(
'artefact'
);
}
}
}
// Make objectionable independent of view_access page.
// Make objectionable independent of view_access page.
...
...
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