Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
8b6a412d
Commit
8b6a412d
authored
12 years ago
by
Cyril Vazquez
Browse files
Options
Downloads
Patches
Plain Diff
Add RSS notifications
parent
2fbbff11
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
notifications/trunk/batch/process_event_stack.php
+44
-5
44 additions, 5 deletions
notifications/trunk/batch/process_event_stack.php
with
44 additions
and
5 deletions
notifications/trunk/batch/process_event_stack.php
+
44
−
5
View file @
8b6a412d
...
...
@@ -83,14 +83,22 @@ while ($state <> 'END') {
}
$totalNotificationsToProcess
=
count
(
$tmpNotifs
);
$logger
->
write
(
$totalNotificationsToProcess
.
' notifications to process'
,
'INFO'
);
$state
=
'MERGE_TEMPLATE'
;
switch
(
$notification
->
notification_mode
)
{
case
'EMAIL'
:
$state
=
'FILL_EMAIL_STACK'
;
break
;
case
'RSS'
:
$state
=
'FILL_RSS_STACK'
;
break
;
}
break
;
/**********************************************************************/
/*
MERGE_TEMPLATE
*/
/*
Load parameters
*/
/*
FILL_EMAIL_STACK
*/
/*
Merge template and fill notif_email_stack
*/
/**********************************************************************/
case
'
MERGE_TEMPLATE
'
:
case
'
FILL_EMAIL_STACK
'
:
foreach
(
$tmpNotifs
as
$user_id
=>
$tmpNotif
)
{
// Merge template with data and style
$logger
->
write
(
'Merging template #'
.
$notification
->
template_id
...
...
@@ -159,8 +167,39 @@ while ($state <> 'END') {
foreach
(
$tmpNotif
[
'events'
]
as
$event
)
{
$events_controler
->
commitEvent
(
$event
->
event_stack_sid
,
"SUCCESS"
);
}
}
$state
=
'END'
;
break
;
/**********************************************************************/
/* FILL_EMAIL_STACK */
/* Merge template and fill notif_email_stack */
/**********************************************************************/
case
'FILL_RSS_STACK'
:
foreach
(
$tmpNotifs
as
$user_id
=>
$tmpNotif
)
{
// Merge template with data and style
$logger
->
write
(
'Adding RSS item ('
.
count
(
$tmpNotif
[
'events'
])
.
' events) for user '
.
$user_id
,
'INFO'
);
foreach
(
$tmpNotif
[
'events'
]
as
$event
)
{
// Get dynamic url
// $url = $notifications_controler->parseRssUrl($event);
$url
=
str_replace
(
'$1'
,
$event
->
record_id
,
$notification
->
rss_url_template
);
// Inser into stack
$query
=
"INSERT INTO "
.
_NOTIF_RSS_STACK_TABLE_NAME
.
" (rss_user_id, rss_event_stack_sid, rss_event_url) "
.
"VALUES ('"
.
$user_id
.
"', "
.
""
.
$event
->
event_stack_sid
.
", "
.
"'"
.
$url
.
"')"
;
$logger
->
write
(
'SQL query:'
.
$query
,
'DEBUG'
);
$db2
=
new
dbquery
();
$db2
->
connect
();
$db2
->
query
(
$query
,
false
,
true
);
$events_controler
->
commitEvent
(
$event
->
event_stack_sid
,
"SUCCESS"
);
}
$currentNotification
++
;
}
$state
=
'END'
;
break
;
...
...
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