Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
39ec4d1c
Commit
39ec4d1c
authored
Jun 11, 2019
by
Mario de la Ossa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport of 12014-incremental-es-wiki-updates
Bringing in the DB migration and some light changes for CE classes
parent
ba952d53
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
8 deletions
+38
-8
app/services/git/wiki_push_service.rb
app/services/git/wiki_push_service.rb
+9
-0
app/workers/post_receive.rb
app/workers/post_receive.rb
+15
-8
db/migrate/20190607205656_add_wiki_columns_to_index_status.rb
...igrate/20190607205656_add_wiki_columns_to_index_status.rb
+12
-0
db/schema.rb
db/schema.rb
+2
-0
No files found.
app/services/git/wiki_push_service.rb
0 → 100644
View file @
39ec4d1c
# frozen_string_literal: true
module
Git
class
WikiPushService
<
::
BaseService
def
execute
# This is used in EE
end
end
end
app/workers/post_receive.rb
View file @
39ec4d1c
...
@@ -30,15 +30,17 @@ class PostReceive
...
@@ -30,15 +30,17 @@ class PostReceive
private
private
def
identify_user
(
post_received
)
post_received
.
identify
.
tap
do
|
user
|
log
(
"Triggered hook for non-existing user
\"
#{
post_received
.
identifier
}
\"
"
)
unless
user
end
end
def
process_project_changes
(
post_received
)
def
process_project_changes
(
post_received
)
changes
=
[]
changes
=
[]
refs
=
Set
.
new
refs
=
Set
.
new
@user
=
post_received
.
identify
user
=
identify_user
(
post_received
)
return
false
unless
user
unless
@user
log
(
"Triggered hook for non-existing user
\"
#{
post_received
.
identifier
}
\"
"
)
return
false
end
post_received
.
enum_for
(
:changes_refs
).
with_index
do
|
(
oldrev
,
newrev
,
ref
),
index
|
post_received
.
enum_for
(
:changes_refs
).
with_index
do
|
(
oldrev
,
newrev
,
ref
),
index
|
service_klass
=
service_klass
=
...
@@ -51,7 +53,7 @@ class PostReceive
...
@@ -51,7 +53,7 @@ class PostReceive
if
service_klass
if
service_klass
service_klass
.
new
(
service_klass
.
new
(
post_received
.
project
,
post_received
.
project
,
@
user
,
user
,
oldrev:
oldrev
,
oldrev:
oldrev
,
newrev:
newrev
,
newrev:
newrev
,
ref:
ref
,
ref:
ref
,
...
@@ -64,7 +66,7 @@ class PostReceive
...
@@ -64,7 +66,7 @@ class PostReceive
refs
<<
ref
refs
<<
ref
end
end
after_project_changes_hooks
(
post_received
,
@
user
,
refs
.
to_a
,
changes
)
after_project_changes_hooks
(
post_received
,
user
,
refs
.
to_a
,
changes
)
end
end
def
after_project_changes_hooks
(
post_received
,
user
,
refs
,
changes
)
def
after_project_changes_hooks
(
post_received
,
user
,
refs
,
changes
)
...
@@ -76,6 +78,11 @@ class PostReceive
...
@@ -76,6 +78,11 @@ class PostReceive
post_received
.
project
.
touch
(
:last_activity_at
,
:last_repository_updated_at
)
post_received
.
project
.
touch
(
:last_activity_at
,
:last_repository_updated_at
)
post_received
.
project
.
wiki
.
repository
.
expire_statistics_caches
post_received
.
project
.
wiki
.
repository
.
expire_statistics_caches
ProjectCacheWorker
.
perform_async
(
post_received
.
project
.
id
,
[],
[
:wiki_size
])
ProjectCacheWorker
.
perform_async
(
post_received
.
project
.
id
,
[],
[
:wiki_size
])
user
=
identify_user
(
post_received
)
return
false
unless
user
::
Git
::
WikiPushService
.
new
(
post_received
.
project
,
user
,
changes:
post_received
.
enum_for
(
:changes_refs
)).
execute
end
end
def
log
(
message
)
def
log
(
message
)
...
...
db/migrate/20190607205656_add_wiki_columns_to_index_status.rb
0 → 100644
View file @
39ec4d1c
# frozen_string_literal: true
class
AddWikiColumnsToIndexStatus
<
ActiveRecord
::
Migration
[
5.1
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
add_column
:index_statuses
,
:last_wiki_commit
,
:binary
add_column
:index_statuses
,
:wiki_indexed_at
,
:datetime_with_timezone
end
end
db/schema.rb
View file @
39ec4d1c
...
@@ -1572,6 +1572,8 @@ ActiveRecord::Schema.define(version: 20190613030606) do
...
@@ -1572,6 +1572,8 @@ ActiveRecord::Schema.define(version: 20190613030606) do
t
.
string
"last_commit"
t
.
string
"last_commit"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
binary
"last_wiki_commit"
t
.
datetime_with_timezone
"wiki_indexed_at"
t
.
index
[
"project_id"
],
name:
"index_index_statuses_on_project_id"
,
unique:
true
,
using: :btree
t
.
index
[
"project_id"
],
name:
"index_index_statuses_on_project_id"
,
unique:
true
,
using: :btree
end
end
...
...
Write
Preview
Markdown
is supported
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