xref: /dokuwiki/inc/deprecated.php (revision e1272c0811878577a2d543205c32808742d4a5da)
14cdb6842SAndreas Gohr<?php
2b4c31a26SSatoshi Sahara// phpcs:ignoreFile -- this file violates PSR-12 by definition
34cdb6842SAndreas Gohr/**
44cdb6842SAndreas Gohr * These classes and functions are deprecated and will be removed in future releases
5a0aeafaaSAndreas Gohr *
6a0aeafaaSAndreas Gohr * Note: when adding to this file, please also add appropriate actions to _test/rector.php
74cdb6842SAndreas Gohr */
84cdb6842SAndreas Gohr
9451969abSMichael Großeuse dokuwiki\Debug\DebugHelper;
10451969abSMichael Große
114cdb6842SAndreas Gohr/**
12723f2b49SGerrit Uitslag * @deprecated since 2021-11-11 use \dokuwiki\Remote\IXR\Client instead!
13723f2b49SGerrit Uitslag */
14723f2b49SGerrit Uitslagclass IXR_Client extends \dokuwiki\Remote\IXR\Client
15723f2b49SGerrit Uitslag{
16723f2b49SGerrit Uitslag    /**
174cdb6842SAndreas Gohr     * @inheritdoc
18723f2b49SGerrit Uitslag     * @deprecated 2021-11-11
194cdb6842SAndreas Gohr     */
20723f2b49SGerrit Uitslag    public function __construct($server, $path = false, $port = 80, $timeout = 15, $timeout_io = null)
21d443762bSAndreas Gohr    {
22723f2b49SGerrit Uitslag        DebugHelper::dbgDeprecatedFunction(dokuwiki\Remote\IXR\Client::class);
23723f2b49SGerrit Uitslag        parent::__construct($server, $path, $port, $timeout, $timeout_io);
24723f2b49SGerrit Uitslag    }
25723f2b49SGerrit Uitslag}
26723f2b49SGerrit Uitslag/**
27723f2b49SGerrit Uitslag * @deprecated since 2021-11-11 use \IXR\Client\ClientMulticall instead!
28723f2b49SGerrit Uitslag */
29723f2b49SGerrit Uitslagclass IXR_ClientMulticall extends \IXR\Client\ClientMulticall
30d443762bSAndreas Gohr{
314cdb6842SAndreas Gohr    /**
324cdb6842SAndreas Gohr     * @inheritdoc
33723f2b49SGerrit Uitslag     * @deprecated 2021-11-11
344cdb6842SAndreas Gohr     */
35723f2b49SGerrit Uitslag    public function __construct($server, $path = false, $port = 80)
36d443762bSAndreas Gohr    {
37723f2b49SGerrit Uitslag        DebugHelper::dbgDeprecatedFunction(IXR\Client\ClientMulticall::class);
38723f2b49SGerrit Uitslag        parent::__construct($server, $path, $port);
394cdb6842SAndreas Gohr    }
404cdb6842SAndreas Gohr}
414cdb6842SAndreas Gohr/**
42723f2b49SGerrit Uitslag * @deprecated since 2021-11-11 use \IXR\Server\Server instead!
434cdb6842SAndreas Gohr */
44723f2b49SGerrit Uitslagclass IXR_Server extends \IXR\Server\Server
45d443762bSAndreas Gohr{
46a6e1db4aSAndreas Gohr    /**
47a6e1db4aSAndreas Gohr     * @inheritdoc
48723f2b49SGerrit Uitslag     * @deprecated 2021-11-11
49a6e1db4aSAndreas Gohr     */
50723f2b49SGerrit Uitslag    public function __construct($callbacks = false, $data = false, $wait = false)
51d443762bSAndreas Gohr    {
52723f2b49SGerrit Uitslag        DebugHelper::dbgDeprecatedFunction(IXR\Server\Server::class);
53723f2b49SGerrit Uitslag        parent::__construct($callbacks, $data, $wait);
54a6e1db4aSAndreas Gohr    }
55a6e1db4aSAndreas Gohr}
56723f2b49SGerrit Uitslag/**
57723f2b49SGerrit Uitslag * @deprecated since 2021-11-11 use \IXR\Server\IntrospectionServer instead!
58723f2b49SGerrit Uitslag */
59723f2b49SGerrit Uitslagclass IXR_IntrospectionServer extends \IXR\Server\IntrospectionServer
60723f2b49SGerrit Uitslag{
61a6e1db4aSAndreas Gohr    /**
62a6e1db4aSAndreas Gohr     * @inheritdoc
63723f2b49SGerrit Uitslag     * @deprecated 2021-11-11
64ccc4c71cSAndreas Gohr     */
65ccc4c71cSAndreas Gohr    public function __construct()
66ccc4c71cSAndreas Gohr    {
67723f2b49SGerrit Uitslag        DebugHelper::dbgDeprecatedFunction(IXR\Server\IntrospectionServer::class);
68ccc4c71cSAndreas Gohr        parent::__construct();
69ccc4c71cSAndreas Gohr    }
70ccc4c71cSAndreas Gohr}
71ccc4c71cSAndreas Gohr/**
72723f2b49SGerrit Uitslag * @deprecated since 2021-11-11 use \IXR\Request\Request instead!
73ccc4c71cSAndreas Gohr */
74723f2b49SGerrit Uitslagclass IXR_Request extends \IXR\Request\Request
75ccc4c71cSAndreas Gohr{
76ccc4c71cSAndreas Gohr    /**
77ccc4c71cSAndreas Gohr     * @inheritdoc
78723f2b49SGerrit Uitslag     * @deprecated 2021-11-11
79ccc4c71cSAndreas Gohr     */
80723f2b49SGerrit Uitslag    public function __construct($method, $args)
81ccc4c71cSAndreas Gohr    {
82723f2b49SGerrit Uitslag        DebugHelper::dbgDeprecatedFunction(IXR\Request\Request::class);
83723f2b49SGerrit Uitslag        parent::__construct($method, $args);
84ccc4c71cSAndreas Gohr    }
85ccc4c71cSAndreas Gohr}
86ccc4c71cSAndreas Gohr/**
87723f2b49SGerrit Uitslag * @deprecated since 2021-11-11 use \IXR\Message\Message instead!
88ccc4c71cSAndreas Gohr */
89723f2b49SGerrit Uitslagclass IXR_Message extends IXR\Message\Message
90ccc4c71cSAndreas Gohr{
91c3cc6e05SAndreas Gohr    /**
92c3cc6e05SAndreas Gohr     * @inheritdoc
93723f2b49SGerrit Uitslag     * @deprecated 2021-11-11
94c3cc6e05SAndreas Gohr     */
95723f2b49SGerrit Uitslag    public function __construct($message)
96723f2b49SGerrit Uitslag    {
97723f2b49SGerrit Uitslag        DebugHelper::dbgDeprecatedFunction(IXR\Message\Message::class);
98723f2b49SGerrit Uitslag        parent::__construct($message);
99723f2b49SGerrit Uitslag    }
100723f2b49SGerrit Uitslag}
101723f2b49SGerrit Uitslag/**
102723f2b49SGerrit Uitslag * @deprecated since 2021-11-11 use \IXR\Message\Error instead!
103723f2b49SGerrit Uitslag */
104723f2b49SGerrit Uitslagclass IXR_Error extends \IXR\Message\Error
105723f2b49SGerrit Uitslag{
106c3cc6e05SAndreas Gohr    /**
107c3cc6e05SAndreas Gohr     * @inheritdoc
108723f2b49SGerrit Uitslag     * @deprecated 2021-11-11
109c3cc6e05SAndreas Gohr     */
110723f2b49SGerrit Uitslag    public function __construct($code, $message)
111c3cc6e05SAndreas Gohr    {
112723f2b49SGerrit Uitslag        DebugHelper::dbgDeprecatedFunction(IXR\Message\Error::class);
113723f2b49SGerrit Uitslag        parent::__construct($code, $message);
114c3cc6e05SAndreas Gohr    }
115c3cc6e05SAndreas Gohr}
11660b9af73SMichael Große/**
117723f2b49SGerrit Uitslag * @deprecated since 2021-11-11 use \IXR\DataType\Date instead!
11860b9af73SMichael Große */
119723f2b49SGerrit Uitslagclass IXR_Date extends \IXR\DataType\Date
120723f2b49SGerrit Uitslag{
12160b9af73SMichael Große    /**
12260b9af73SMichael Große     * @inheritdoc
123723f2b49SGerrit Uitslag     * @deprecated 2021-11-11
12460b9af73SMichael Große     */
125723f2b49SGerrit Uitslag    public function __construct($time)
12660b9af73SMichael Große    {
127723f2b49SGerrit Uitslag        DebugHelper::dbgDeprecatedFunction(IXR\DataType\Date::class);
128723f2b49SGerrit Uitslag        parent::__construct($time);
12960b9af73SMichael Große    }
13060b9af73SMichael Große}
13160b9af73SMichael Große/**
132723f2b49SGerrit Uitslag * @deprecated since 2021-11-11 use \IXR\DataType\Base64 instead!
13360b9af73SMichael Große */
134723f2b49SGerrit Uitslagclass IXR_Base64 extends \IXR\DataType\Base64
135723f2b49SGerrit Uitslag{
13660b9af73SMichael Große    /**
13760b9af73SMichael Große     * @inheritdoc
138723f2b49SGerrit Uitslag     * @deprecated 2021-11-11
13960b9af73SMichael Große     */
140723f2b49SGerrit Uitslag    public function __construct($data)
14160b9af73SMichael Große    {
142723f2b49SGerrit Uitslag        DebugHelper::dbgDeprecatedFunction(IXR\DataType\Base64::class);
143723f2b49SGerrit Uitslag        parent::__construct($data);
14460b9af73SMichael Große    }
14560b9af73SMichael Große}
14660b9af73SMichael Große/**
147723f2b49SGerrit Uitslag * @deprecated since 2021-11-11 use \IXR\DataType\Value instead!
14860b9af73SMichael Große */
149723f2b49SGerrit Uitslagclass IXR_Value extends \IXR\DataType\Value
150cbb44eabSAndreas Gohr{
15160b9af73SMichael Große    /**
15260b9af73SMichael Große     * @inheritdoc
153723f2b49SGerrit Uitslag     * @deprecated 2021-11-11
15460b9af73SMichael Große     */
155723f2b49SGerrit Uitslag    public function __construct($data, $type = null)
15660b9af73SMichael Große    {
157723f2b49SGerrit Uitslag        DebugHelper::dbgDeprecatedFunction(IXR\DataType\Value::class);
158723f2b49SGerrit Uitslag        parent::__construct($data, $type);
15960b9af73SMichael Große    }
160cbb44eabSAndreas Gohr}
16160b9af73SMichael Große
162cbb44eabSAndreas Gohr/**
163f9a94e78SAndreas Gohr * print a newline terminated string
164cbb44eabSAndreas Gohr *
165f9a94e78SAndreas Gohr * You can give an indention as optional parameter
166451969abSMichael Große *
167451969abSMichael Große * @author Andreas Gohr <andi@splitbrain.org>
168451969abSMichael Große *
169f9a94e78SAndreas Gohr * @param string $string  line of text
170f9a94e78SAndreas Gohr * @param int    $indent  number of spaces indention
171f9a94e78SAndreas Gohr * @deprecated 2023-08-31 use echo instead
172451969abSMichael Große */
173f9a94e78SAndreas Gohrfunction ptln($string, $indent = 0)
174f9a94e78SAndreas Gohr{
175f9a94e78SAndreas Gohr    DebugHelper::dbgDeprecatedFunction('echo');
176f9a94e78SAndreas Gohr    echo str_repeat(' ', $indent) . "$string\n";
177451969abSMichael Große}
1786225b270SMichael Große
1796225b270SMichael Große/**
1809df9f0c8SAndreas Gohr * Adds/updates the search index for the given page
1816f58ff65SSatoshi Sahara *
1829df9f0c8SAndreas Gohr * Locking is handled internally.
183b4c31a26SSatoshi Sahara *
1849df9f0c8SAndreas Gohr * @param string        $page   name of the page to index
1859df9f0c8SAndreas Gohr * @param boolean       $verbose    print status messages
1869df9f0c8SAndreas Gohr * @param boolean       $force  force reindexing even when the index is up to date
1879df9f0c8SAndreas Gohr * @return string|boolean  the function completed successfully
1886f58ff65SSatoshi Sahara *
189*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use Indexer class instead
1906f58ff65SSatoshi Sahara */
1919df9f0c8SAndreas Gohrfunction idx_addPage($page, $verbose = false, $force = false)
1929df9f0c8SAndreas Gohr{
19383b3acccSAndreas Gohr    DebugHelper::dbgDeprecatedFunction('dokuwiki\Search\Indexer::addPage()');
1949df9f0c8SAndreas Gohr    try {
19583b3acccSAndreas Gohr        (new dokuwiki\Search\Indexer())->addPage($page, $force);
1969df9f0c8SAndreas Gohr        return true;
1979df9f0c8SAndreas Gohr    } catch (\dokuwiki\Search\Exception\SearchException $e) {
1989df9f0c8SAndreas Gohr        return false;
1996f58ff65SSatoshi Sahara    }
2006f58ff65SSatoshi Sahara}
201*e1272c08SAndreas Gohr
202*e1272c08SAndreas Gohr/**
203*e1272c08SAndreas Gohr * Create an instance of the indexer.
204*e1272c08SAndreas Gohr *
205*e1272c08SAndreas Gohr * @return dokuwiki\Search\Indexer
206*e1272c08SAndreas Gohr *
207*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\Indexer directly
208*e1272c08SAndreas Gohr */
209*e1272c08SAndreas Gohrfunction idx_get_indexer()
210*e1272c08SAndreas Gohr{
211*e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\Indexer::class);
212*e1272c08SAndreas Gohr    return new dokuwiki\Search\Indexer();
213*e1272c08SAndreas Gohr}
214*e1272c08SAndreas Gohr
215*e1272c08SAndreas Gohr/**
216*e1272c08SAndreas Gohr * Read the list of words in an index (if it exists).
217*e1272c08SAndreas Gohr *
218*e1272c08SAndreas Gohr * @param string $idx
219*e1272c08SAndreas Gohr * @param string $suffix
220*e1272c08SAndreas Gohr * @return array
221*e1272c08SAndreas Gohr *
222*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use Index classes directly
223*e1272c08SAndreas Gohr */
224*e1272c08SAndreas Gohrfunction idx_getIndex($idx, $suffix)
225*e1272c08SAndreas Gohr{
226*e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction('Index classes');
227*e1272c08SAndreas Gohr    global $conf;
228*e1272c08SAndreas Gohr    $fn = $conf['indexdir'] . '/' . $idx . $suffix . '.idx';
229*e1272c08SAndreas Gohr    if (!file_exists($fn)) return [];
230*e1272c08SAndreas Gohr    return file($fn);
231*e1272c08SAndreas Gohr}
232*e1272c08SAndreas Gohr
233*e1272c08SAndreas Gohr/**
234*e1272c08SAndreas Gohr * Find tokens in the fulltext index
235*e1272c08SAndreas Gohr *
236*e1272c08SAndreas Gohr * @param array $words list of words to search for
237*e1272c08SAndreas Gohr * @return array list of pages found
238*e1272c08SAndreas Gohr *
239*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use CollectionSearch on PageFulltextCollection instead
240*e1272c08SAndreas Gohr */
241*e1272c08SAndreas Gohrfunction idx_lookup(&$words)
242*e1272c08SAndreas Gohr{
243*e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\Collection\CollectionSearch::class);
244*e1272c08SAndreas Gohr    return (new dokuwiki\Search\Indexer())->lookup($words);
245*e1272c08SAndreas Gohr}
246*e1272c08SAndreas Gohr
247*e1272c08SAndreas Gohr/**
248*e1272c08SAndreas Gohr * Get the list of lengths indexed in the wiki.
249*e1272c08SAndreas Gohr *
250*e1272c08SAndreas Gohr * @return array
251*e1272c08SAndreas Gohr *
252*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use PageFulltextCollection::getTokenIndexMaximum() instead
253*e1272c08SAndreas Gohr */
254*e1272c08SAndreas Gohrfunction idx_listIndexLengths()
255*e1272c08SAndreas Gohr{
256*e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction('PageFulltextCollection::getTokenIndexMaximum()');
257*e1272c08SAndreas Gohr    global $conf;
258*e1272c08SAndreas Gohr    $idx = [];
259*e1272c08SAndreas Gohr    $files = glob($conf['indexdir'] . '/i*.idx');
260*e1272c08SAndreas Gohr    if ($files) {
261*e1272c08SAndreas Gohr        foreach ($files as $file) {
262*e1272c08SAndreas Gohr            if (preg_match('/i(\d+)\.idx$/', $file, $match)) {
263*e1272c08SAndreas Gohr                $idx[] = (int)$match[1];
264*e1272c08SAndreas Gohr            }
265*e1272c08SAndreas Gohr        }
266*e1272c08SAndreas Gohr        sort($idx);
267*e1272c08SAndreas Gohr    }
268*e1272c08SAndreas Gohr    return $idx;
269*e1272c08SAndreas Gohr}
270*e1272c08SAndreas Gohr
271*e1272c08SAndreas Gohr/**
272*e1272c08SAndreas Gohr * Get the word lengths that have been indexed.
273*e1272c08SAndreas Gohr *
274*e1272c08SAndreas Gohr * @param array|int $filter
275*e1272c08SAndreas Gohr * @return array
276*e1272c08SAndreas Gohr *
277*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use PageFulltextCollection::getTokenIndexMaximum() instead
278*e1272c08SAndreas Gohr */
279*e1272c08SAndreas Gohrfunction idx_indexLengths($filter)
280*e1272c08SAndreas Gohr{
281*e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction('PageFulltextCollection::getTokenIndexMaximum()');
282*e1272c08SAndreas Gohr    global $conf;
283*e1272c08SAndreas Gohr    $idx = [];
284*e1272c08SAndreas Gohr    if (is_array($filter)) {
285*e1272c08SAndreas Gohr        $path = $conf['indexdir'] . "/i";
286*e1272c08SAndreas Gohr        foreach (array_keys($filter) as $key) {
287*e1272c08SAndreas Gohr            if (file_exists($path . $key . '.idx'))
288*e1272c08SAndreas Gohr                $idx[] = $key;
289*e1272c08SAndreas Gohr        }
290*e1272c08SAndreas Gohr    } else {
291*e1272c08SAndreas Gohr        $lengths = idx_listIndexLengths();
292*e1272c08SAndreas Gohr        foreach ($lengths as $length) {
293*e1272c08SAndreas Gohr            if ((int)$length >= (int)$filter)
294*e1272c08SAndreas Gohr                $idx[] = $length;
295*e1272c08SAndreas Gohr        }
296*e1272c08SAndreas Gohr    }
297*e1272c08SAndreas Gohr    return $idx;
298*e1272c08SAndreas Gohr}
299*e1272c08SAndreas Gohr
300*e1272c08SAndreas Gohr/**
301*e1272c08SAndreas Gohr * Execute a fulltext search
302*e1272c08SAndreas Gohr *
303*e1272c08SAndreas Gohr * @param string $query search query
304*e1272c08SAndreas Gohr * @param array $highlight words to highlight
305*e1272c08SAndreas Gohr * @param string|null $sort sorting order
306*e1272c08SAndreas Gohr * @param int|string|null $after only show results after this date
307*e1272c08SAndreas Gohr * @param int|string|null $before only show results before this date
308*e1272c08SAndreas Gohr * @return array
309*e1272c08SAndreas Gohr *
310*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\FulltextSearch::pageSearch() instead
311*e1272c08SAndreas Gohr */
312*e1272c08SAndreas Gohrfunction ft_pageSearch($query, &$highlight, $sort = null, $after = null, $before = null)
313*e1272c08SAndreas Gohr{
314*e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\FulltextSearch::class . '::pageSearch()');
315*e1272c08SAndreas Gohr    return (new dokuwiki\Search\FulltextSearch())->pageSearch($query, $highlight, $sort, $after, $before);
316*e1272c08SAndreas Gohr}
317*e1272c08SAndreas Gohr
318*e1272c08SAndreas Gohr/**
319*e1272c08SAndreas Gohr * Returns the backlinks for a given page
320*e1272c08SAndreas Gohr *
321*e1272c08SAndreas Gohr * @param string $id page id
322*e1272c08SAndreas Gohr * @param bool $ignore_perms
323*e1272c08SAndreas Gohr * @return string[]
324*e1272c08SAndreas Gohr *
325*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\MetadataSearch::backlinks() instead
326*e1272c08SAndreas Gohr */
327*e1272c08SAndreas Gohrfunction ft_backlinks($id, $ignore_perms = false)
328*e1272c08SAndreas Gohr{
329*e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\MetadataSearch::class . '::backlinks()');
330*e1272c08SAndreas Gohr    return (new dokuwiki\Search\MetadataSearch())->backlinks($id, $ignore_perms);
331*e1272c08SAndreas Gohr}
332*e1272c08SAndreas Gohr
333*e1272c08SAndreas Gohr/**
334*e1272c08SAndreas Gohr * Returns the pages that use a given media file
335*e1272c08SAndreas Gohr *
336*e1272c08SAndreas Gohr * @param string $id media id
337*e1272c08SAndreas Gohr * @param bool $ignore_perms
338*e1272c08SAndreas Gohr * @return string[]
339*e1272c08SAndreas Gohr *
340*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\MetadataSearch::mediause() instead
341*e1272c08SAndreas Gohr */
342*e1272c08SAndreas Gohrfunction ft_mediause($id, $ignore_perms = false)
343*e1272c08SAndreas Gohr{
344*e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\MetadataSearch::class . '::mediause()');
345*e1272c08SAndreas Gohr    return (new dokuwiki\Search\MetadataSearch())->mediause($id, $ignore_perms);
346*e1272c08SAndreas Gohr}
347*e1272c08SAndreas Gohr
348*e1272c08SAndreas Gohr/**
349*e1272c08SAndreas Gohr * Quicksearch for pagenames
350*e1272c08SAndreas Gohr *
351*e1272c08SAndreas Gohr * @param string $id page id
352*e1272c08SAndreas Gohr * @param bool $in_ns match namespace
353*e1272c08SAndreas Gohr * @param bool $in_title search in title
354*e1272c08SAndreas Gohr * @param int|string|null $after
355*e1272c08SAndreas Gohr * @param int|string|null $before
356*e1272c08SAndreas Gohr * @return string[]
357*e1272c08SAndreas Gohr *
358*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\MetadataSearch::pageLookup() instead
359*e1272c08SAndreas Gohr */
360*e1272c08SAndreas Gohrfunction ft_pageLookup($id, $in_ns = false, $in_title = false, $after = null, $before = null)
361*e1272c08SAndreas Gohr{
362*e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\MetadataSearch::class . '::pageLookup()');
363*e1272c08SAndreas Gohr    return (new dokuwiki\Search\MetadataSearch())->pageLookup($id, $in_ns, $in_title, $after, $before);
364*e1272c08SAndreas Gohr}
365*e1272c08SAndreas Gohr
366*e1272c08SAndreas Gohr/**
367*e1272c08SAndreas Gohr * Creates a snippet extract
368*e1272c08SAndreas Gohr *
369*e1272c08SAndreas Gohr * @param string $id page id
370*e1272c08SAndreas Gohr * @param array $highlight words to highlight
371*e1272c08SAndreas Gohr * @return string
372*e1272c08SAndreas Gohr *
373*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\FulltextSearch::snippet() instead
374*e1272c08SAndreas Gohr */
375*e1272c08SAndreas Gohrfunction ft_snippet($id, $highlight)
376*e1272c08SAndreas Gohr{
377*e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\FulltextSearch::class . '::snippet()');
378*e1272c08SAndreas Gohr    return (new dokuwiki\Search\FulltextSearch())->snippet($id, $highlight);
379*e1272c08SAndreas Gohr}
380*e1272c08SAndreas Gohr
381*e1272c08SAndreas Gohr/**
382*e1272c08SAndreas Gohr * Sort pages based on their namespace level first, then alphabetically
383*e1272c08SAndreas Gohr *
384*e1272c08SAndreas Gohr * @param string $a
385*e1272c08SAndreas Gohr * @param string $b
386*e1272c08SAndreas Gohr * @return int
387*e1272c08SAndreas Gohr *
388*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use Utf8\Sort functions directly
389*e1272c08SAndreas Gohr */
390*e1272c08SAndreas Gohrfunction ft_pagesorter($a, $b)
391*e1272c08SAndreas Gohr{
392*e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction('Utf8\\Sort');
393*e1272c08SAndreas Gohr    $diff = substr_count($a, ':') - substr_count($b, ':');
394*e1272c08SAndreas Gohr    return $diff ?: dokuwiki\Utf8\Sort::strcmp($a, $b);
395*e1272c08SAndreas Gohr}
396*e1272c08SAndreas Gohr
397*e1272c08SAndreas Gohr/**
398*e1272c08SAndreas Gohr * Wrap a search term in regex boundary checks
399*e1272c08SAndreas Gohr *
400*e1272c08SAndreas Gohr * @param string $term
401*e1272c08SAndreas Gohr * @return string
402*e1272c08SAndreas Gohr *
403*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\FulltextSearch::snippetRePreprocess() instead
404*e1272c08SAndreas Gohr */
405*e1272c08SAndreas Gohrfunction ft_snippet_re_preprocess($term)
406*e1272c08SAndreas Gohr{
407*e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\FulltextSearch::class . '::snippetRePreprocess()');
408*e1272c08SAndreas Gohr    return (new dokuwiki\Search\FulltextSearch())->snippetRePreprocess($term);
409*e1272c08SAndreas Gohr}
410*e1272c08SAndreas Gohr
411*e1272c08SAndreas Gohr/**
412*e1272c08SAndreas Gohr * Parse a search query into its components
413*e1272c08SAndreas Gohr *
414*e1272c08SAndreas Gohr * @param mixed $Indexer ignored (legacy parameter)
415*e1272c08SAndreas Gohr * @param string $query search query
416*e1272c08SAndreas Gohr * @return array parsed query structure
417*e1272c08SAndreas Gohr *
418*e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\Query\QueryParser::convert() instead
419*e1272c08SAndreas Gohr */
420*e1272c08SAndreas Gohrfunction ft_queryParser($Indexer, $query)
421*e1272c08SAndreas Gohr{
422*e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\Query\QueryParser::class . '::convert()');
423*e1272c08SAndreas Gohr    return (new dokuwiki\Search\Query\QueryParser())->convert($query);
424*e1272c08SAndreas Gohr}
425