summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2026-02-01 15:42:04 +0000
committerlsces <lester@lsces.co.uk>2026-02-01 15:42:04 +0000
commit365bfac8fbcee3a37fb816a1a15c536d51915424 (patch)
treeea390d73d0978e79a46495883088cb31acfdd9cb
parent6a685b570b48b6c37da54e34338900e7b2b9b90d (diff)
downloadsearch-365bfac8fbcee3a37fb816a1a15c536d51915424.tar.gz
search-365bfac8fbcee3a37fb816a1a15c536d51915424.tar.bz2
search-365bfac8fbcee3a37fb816a1a15c536d51915424.zip
Move functions used by liberty to Liberty namespace. This fixes search not running on save.
-rwxr-xr-x[-rw-r--r--]cmd_line_reindex.php4
-rwxr-xr-xincludes/bit_setup_inc.php2
-rwxr-xr-xincludes/refresh.php3
-rwxr-xr-xincludes/refresh_functions.php5
4 files changed, 8 insertions, 6 deletions
diff --git a/cmd_line_reindex.php b/cmd_line_reindex.php
index 648879c..887abd8 100644..100755
--- a/cmd_line_reindex.php
+++ b/cmd_line_reindex.php
@@ -46,7 +46,7 @@ $_SERVER['HTTP_USER_AGENT'] = 'batch';
require_once '../kernel/includes/setup_inc.php';
use Bitweaver\Liberty\LibertyBase;
-require_once SEARCH_PKG_INCLUDES_PATH.'refresh_functions.php';
+require_once 'includes/refresh_functions.php';
$whatToIndex = "pages";
$unindexedOnly = false;
@@ -70,7 +70,7 @@ if (isset($argc)) { // we are running from the command line.
$time_start = microtime_float();
if (!$silent) echo "\nBeginning Reindex of $whatToIndex ...\n";
if (!$silent && $unindexedOnly) echo "Warning: unindexed only flag set. Will break MySQL 3.x because of sub-selects\n";
- $count = rebuild_index($whatToIndex, $unindexedOnly);
+ $count = \Bitweaver\Liberty\rebuild_index($whatToIndex, $unindexedOnly);
$time_end = microtime_float();
$time = number_format($time_end - $time_start, 4);
if (!$silent) echo "Index rebuild complete.\n";
diff --git a/includes/bit_setup_inc.php b/includes/bit_setup_inc.php
index 554f3ae..ae4cfed 100755
--- a/includes/bit_setup_inc.php
+++ b/includes/bit_setup_inc.php
@@ -31,7 +31,7 @@ if( $gBitSystem->isPackageActive( 'search' ) ) {
// But only if the Index On Submit isn't set
if( ! $gBitSystem->isFeatureActive("search_index_on_submit") ) {
include_once SEARCH_PKG_INCLUDE_PATH . 'refresh.php';
- register_shutdown_function("refresh_search_index");
+ register_shutdown_function("\\Bitweaver\\Liberty\\refresh_search_index");
}
include_once SEARCH_PKG_INCLUDE_PATH . 'refresh_functions.php';
$gLibertySystem->registerService( LIBERTY_SERVICE_SEARCH, SEARCH_PKG_NAME,
diff --git a/includes/refresh.php b/includes/refresh.php
index 7b6796d..1d55429 100755
--- a/includes/refresh.php
+++ b/includes/refresh.php
@@ -13,6 +13,7 @@
* @package search
* @subpackage functions
*/
+namespace Bitweaver\Liberty;
/**
* refresh_search_index
@@ -58,6 +59,6 @@ function refresh_search_index() {
$gBitSystem->mDb->mDb->SelectDB( $gBitDbName );
if ( !empty ($key) )
- call_user_func( $key, $locs[$key] );
+ \call_user_func( "\\Bitweaver\\Liberty\\$key", $locs[$key] );
}
}
diff --git a/includes/refresh_functions.php b/includes/refresh_functions.php
index 50dfec7..488dad2 100755
--- a/includes/refresh_functions.php
+++ b/includes/refresh_functions.php
@@ -21,6 +21,7 @@
* With the exception of blogs (blog headers not blog posts) they pick the content_id
* and pass it to refresh_index() to do the work.
*/
+namespace Bitweaver\Liberty;
function random_refresh_index($pContentType = "") {
global $gBitSystem;
@@ -177,8 +178,8 @@ function rebuild_index($pContentType, $pUnindexedOnly = false) {
while ($res = $result->fetchRow()) {
if( isset( $gLibertySystem->mContentTypes[$res["content_type_guid"]] ) ) {
$type = $gLibertySystem->mContentTypes[$res["content_type_guid"]];
- require_once constant( strtoupper( $type['handler_package'] ) . '_PKG_PATH' ) . $type['handler_file'];
- $obj = new $type['handler_class']( null, $res["content_id"] );
+ $full_class = '\Bitweaver\\'.ucfirst($type['handler_package']).'\\'.$type['handler_class'];
+ $obj = new $full_class( null, $res["content_id"] );
refresh_index($obj);
unset($obj);
}