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
7c62826c
Commit
7c62826c
authored
Feb 19, 2007
by
Martyn Smith
Committed by
Martyn Smith
Feb 19, 2007
Browse files
Implement view delete hook, consolidate sanity checking
parent
aa5bc800
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/search/solr/lib.php
View file @
7c62826c
...
...
@@ -64,21 +64,21 @@ class PluginSearchSolr extends PluginSearchInternal {
}
public
static
function
event_reindex_user
(
$event
,
$user
)
{
if
(
get_config
(
'searchplugin'
)
!=
'solr'
)
{
if
(
!
self
::
config_is_sane
)
{
return
;
}
self
::
index_user
(
$user
);
self
::
commit
();
}
public
static
function
event_saveartefact
(
$event
,
$artefact
)
{
if
(
get_config
(
'searchplugin'
)
!=
'solr'
)
{
if
(
!
self
::
config_is_sane
)
{
return
;
}
self
::
index_artefact
(
$artefact
);
self
::
commit
();
}
public
static
function
event_deleteartefact
(
$event
,
$artefact
)
{
if
(
get_config
(
'searchplugin'
)
!=
'solr'
)
{
if
(
!
self
::
config_is_sane
)
{
return
;
}
self
::
delete_byidtype
(
$artefact
->
get
(
'id'
),
'artefact'
);
...
...
@@ -86,7 +86,7 @@ class PluginSearchSolr extends PluginSearchInternal {
}
public
static
function
event_saveview
(
$event
,
$view
)
{
if
(
get_config
(
'searchplugin'
)
!=
'solr'
)
{
if
(
!
self
::
config_is_sane
)
{
return
;
}
self
::
index_view
(
$view
);
...
...
@@ -94,7 +94,11 @@ class PluginSearchSolr extends PluginSearchInternal {
}
public
static
function
event_deleteview
(
$event
,
$view
)
{
log_debug
(
'event_deleteview()'
);
if
(
!
self
::
config_is_sane
)
{
return
;
}
self
::
delete_byidtype
(
$view
[
'id'
],
'view'
);
self
::
commit
();
}
public
static
function
has_config
()
{
...
...
@@ -232,7 +236,7 @@ END;
// This function will rebuild the solr indexes
public
static
function
rebuild_all
()
{
if
(
get_config
(
'searchplugin'
)
!=
'solr'
)
{
if
(
!
self
::
config_is_sane
)
{
return
;
}
self
::
rebuild_users
();
...
...
@@ -601,6 +605,14 @@ END;
self
::
send_update
(
$dom
->
saveXML
());
}
private
static
function
config_is_sane
()
{
if
(
get_config
(
'searchplugin'
)
!=
'solr'
)
{
return
false
;
}
return
true
;
}
}
?>
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