Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
31e282d2
"...git@git.uibk.ac.at:c102348/olat-ci-cd-testing-project.git" did not exist on "a0be186dd4b36550e8534a1e8e300db432a49193"
Commit
31e282d2
authored
5 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
no-jira: fix 12.0 upgrader after organization changes
parent
5330232c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/upgrade/OLATUpgrade_12_0_0.java
+20
-23
20 additions, 23 deletions
src/main/java/org/olat/upgrade/OLATUpgrade_12_0_0.java
with
20 additions
and
23 deletions
src/main/java/org/olat/upgrade/OLATUpgrade_12_0_0.java
+
20
−
23
View file @
31e282d2
...
...
@@ -27,7 +27,6 @@ import java.io.OutputStream;
import
java.nio.file.Paths
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Properties
;
...
...
@@ -37,7 +36,6 @@ import org.apache.logging.log4j.Logger;
import
org.olat.core.commons.modules.bc.FolderConfig
;
import
org.olat.core.commons.persistence.DB
;
import
org.olat.core.id.Identity
;
import
org.olat.core.id.Roles
;
import
org.olat.core.logging.Tracing
;
import
org.olat.core.util.WebappHelper
;
import
org.olat.course.CorruptedCourseException
;
...
...
@@ -64,8 +62,7 @@ import org.olat.modules.iq.IQManager;
import
org.olat.modules.webFeed.manager.FeedManager
;
import
org.olat.repository.RepositoryEntry
;
import
org.olat.repository.RepositoryEntryRef
;
import
org.olat.repository.RepositoryManager
;
import
org.olat.repository.model.SearchRepositoryEntryParameters
;
import
org.olat.repository.RepositoryService
;
import
org.olat.resource.OLATResource
;
import
org.olat.resource.OLATResourceManager
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -79,8 +76,6 @@ import org.springframework.beans.factory.annotation.Autowired;
public
class
OLATUpgrade_12_0_0
extends
OLATUpgrade
{
private
static
final
Logger
log
=
Tracing
.
createLoggerFor
(
OLATUpgrade_12_0_0
.
class
);
private
static
final
int
BATCH_SIZE
=
50
;
private
static
final
String
VERSION
=
"OLAT_12.0.0"
;
private
static
final
String
FEED_XML_TO_DB
=
"FEED XML TO DB"
;
...
...
@@ -96,7 +91,7 @@ public class OLATUpgrade_12_0_0 extends OLATUpgrade {
@Autowired
private
IQManager
iqManager
;
@Autowired
private
Repository
Manager
repository
Manager
;
private
Repository
Service
repository
Service
;
@Autowired
private
EfficiencyStatementManager
efficiencyStatementManager
;
...
...
@@ -226,35 +221,37 @@ public class OLATUpgrade_12_0_0 extends OLATUpgrade {
private
boolean
upgradeLastModified
(
UpgradeManager
upgradeManager
,
UpgradeHistoryData
uhd
)
{
boolean
allOk
=
true
;
if
(!
uhd
.
getBooleanDataValue
(
LAST_USER_MODIFICATION
))
{
int
counter
=
0
;
final
Roles
roles
=
Roles
.
administratorAndManagersRoles
();
final
SearchRepositoryEntryParameters
params
=
new
SearchRepositoryEntryParameters
();
params
.
setRoles
(
roles
);
params
.
setResourceTypes
(
Collections
.
singletonList
(
"CourseModule"
));
List
<
RepositoryEntry
>
courses
;
do
{
courses
=
repositoryManager
.
genericANDQueryWithRolesRestriction
(
params
,
counter
,
50
,
true
);
for
(
RepositoryEntry
course:
courses
)
{
List
<
Long
>
entryKeys
=
getRepositoryEntryKeys
();
for
(
Long
entryKey:
entryKeys
)
{
RepositoryEntry
course
=
repositoryService
.
loadByKey
(
entryKey
);
if
(
course
.
getOlatResource
().
getResourceableTypeName
().
equals
(
"CourseModule"
))
{
try
{
allOk
&=
processCourseAssessmentLastModified
(
course
);
}
catch
(
CorruptedCourseException
e
)
{
log
.
error
(
"Corrupted course: "
+
course
.
getKey
(),
e
);
}
}
counter
+=
courses
.
size
();
log
.
info
(
Tracing
.
M_AUDIT
,
"Last modifications migration processed: "
+
courses
.
size
()
+
", total courses processed ("
+
counter
+
")"
);
dbInstance
.
commitAndCloseSession
();
}
while
(
courses
.
size
()
==
BATCH_SIZE
);
if
(
counter
++
%
25
==
0
)
{
log
.
info
(
Tracing
.
M_AUDIT
,
"Last modifications migration processed: "
+
counter
+
", total courses processed ("
+
counter
+
")"
);
dbInstance
.
commitAndCloseSession
();
}
}
uhd
.
setBooleanDataValue
(
LAST_USER_MODIFICATION
,
allOk
);
upgradeManager
.
setUpgradesHistory
(
uhd
,
VERSION
);
}
return
allOk
;
}
private
List
<
Long
>
getRepositoryEntryKeys
()
{
String
q
=
"select v.key from repositoryentry as v"
;
return
dbInstance
.
getCurrentEntityManager
()
.
createQuery
(
q
,
Long
.
class
)
.
getResultList
();
}
private
boolean
processCourseAssessmentLastModified
(
RepositoryEntry
entry
)
{
try
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment