xref: /dokuwiki/inc/deprecated.php (revision 6e39b4e379a661a3abd765df49fa679d2119741c)
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/**
163c8dd1b9dSAndreas Gohr * returns all available parser syntax modes in correct order
164c8dd1b9dSAndreas Gohr *
165c8dd1b9dSAndreas Gohr * @return array[] with for each plugin the array('sort' => sortnumber, 'mode' => mode string, 'obj'  => plugin object)
166c8dd1b9dSAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org>
167c8dd1b9dSAndreas Gohr * @deprecated 2026-04-16 use \dokuwiki\Parsing\ModeRegistry::getModes() instead
168c8dd1b9dSAndreas Gohr */
169c8dd1b9dSAndreas Gohrfunction p_get_parsermodes()
170c8dd1b9dSAndreas Gohr{
171c8dd1b9dSAndreas Gohr    DebugHelper::dbgDeprecatedFunction(\dokuwiki\Parsing\ModeRegistry::class . '::getModes()');
172c8dd1b9dSAndreas Gohr    return \dokuwiki\Parsing\ModeRegistry::getInstance()->getModes();
173c8dd1b9dSAndreas Gohr}
174c8dd1b9dSAndreas Gohr
175c8dd1b9dSAndreas Gohr/**
176c8dd1b9dSAndreas Gohr * Callback function for usort
177c8dd1b9dSAndreas Gohr *
178c8dd1b9dSAndreas Gohr * @param array $a
179c8dd1b9dSAndreas Gohr * @param array $b
180c8dd1b9dSAndreas Gohr * @return int $a is lower/equal/higher than $b
181c8dd1b9dSAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org>
182c8dd1b9dSAndreas Gohr * @deprecated 2026-04-16 use \dokuwiki\Parsing\ModeRegistry::sortModes() instead
183c8dd1b9dSAndreas Gohr */
184c8dd1b9dSAndreas Gohrfunction p_sort_modes($a, $b)
185c8dd1b9dSAndreas Gohr{
186c8dd1b9dSAndreas Gohr    DebugHelper::dbgDeprecatedFunction(\dokuwiki\Parsing\ModeRegistry::class . '::sortModes()');
187c8dd1b9dSAndreas Gohr    return \dokuwiki\Parsing\ModeRegistry::sortModes($a, $b);
188c8dd1b9dSAndreas Gohr}
189c8dd1b9dSAndreas Gohr
190c8dd1b9dSAndreas Gohr/**
191f9a94e78SAndreas Gohr * print a newline terminated string
192cbb44eabSAndreas Gohr *
193f9a94e78SAndreas Gohr * You can give an indention as optional parameter
194451969abSMichael Große *
195451969abSMichael Große * @author Andreas Gohr <andi@splitbrain.org>
196451969abSMichael Große *
197f9a94e78SAndreas Gohr * @param string $string  line of text
198f9a94e78SAndreas Gohr * @param int    $indent  number of spaces indention
199f9a94e78SAndreas Gohr * @deprecated 2023-08-31 use echo instead
200451969abSMichael Große */
201f9a94e78SAndreas Gohrfunction ptln($string, $indent = 0)
202f9a94e78SAndreas Gohr{
203f9a94e78SAndreas Gohr    DebugHelper::dbgDeprecatedFunction('echo');
204f9a94e78SAndreas Gohr    echo str_repeat(' ', $indent) . "$string\n";
205451969abSMichael Große}
2066225b270SMichael Große
2076225b270SMichael Große/**
2089df9f0c8SAndreas Gohr * Adds/updates the search index for the given page
2096f58ff65SSatoshi Sahara *
2109df9f0c8SAndreas Gohr * Locking is handled internally.
211b4c31a26SSatoshi Sahara *
2129df9f0c8SAndreas Gohr * @param string        $page   name of the page to index
2139df9f0c8SAndreas Gohr * @param boolean       $verbose    print status messages
2149df9f0c8SAndreas Gohr * @param boolean       $force  force reindexing even when the index is up to date
2159df9f0c8SAndreas Gohr * @return string|boolean  the function completed successfully
2166f58ff65SSatoshi Sahara *
217e1272c08SAndreas Gohr * @deprecated 2026-04-07 use Indexer class instead
2186f58ff65SSatoshi Sahara */
2199df9f0c8SAndreas Gohrfunction idx_addPage($page, $verbose = false, $force = false)
2209df9f0c8SAndreas Gohr{
22183b3acccSAndreas Gohr    DebugHelper::dbgDeprecatedFunction('dokuwiki\Search\Indexer::addPage()');
2229df9f0c8SAndreas Gohr    try {
22383b3acccSAndreas Gohr        (new dokuwiki\Search\Indexer())->addPage($page, $force);
2249df9f0c8SAndreas Gohr        return true;
2259df9f0c8SAndreas Gohr    } catch (\dokuwiki\Search\Exception\SearchException $e) {
2269df9f0c8SAndreas Gohr        return false;
2276f58ff65SSatoshi Sahara    }
2286f58ff65SSatoshi Sahara}
229e1272c08SAndreas Gohr
230e1272c08SAndreas Gohr/**
231e1272c08SAndreas Gohr * Create an instance of the indexer.
232e1272c08SAndreas Gohr *
233*6e39b4e3SAndreas Gohr * Returns a {@see dokuwiki\Search\LegacyIndexer} that preserves the legacy
234*6e39b4e3SAndreas Gohr * Doku_Indexer return contract (true|string on success/failure for the four
235*6e39b4e3SAndreas Gohr * mutating methods) so existing plugins keep working without try/catch.
236*6e39b4e3SAndreas Gohr *
237*6e39b4e3SAndreas Gohr * @return dokuwiki\Search\LegacyIndexer
238e1272c08SAndreas Gohr *
239e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\Indexer directly
240e1272c08SAndreas Gohr */
241e1272c08SAndreas Gohrfunction idx_get_indexer()
242e1272c08SAndreas Gohr{
243e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\Indexer::class);
244*6e39b4e3SAndreas Gohr    return new dokuwiki\Search\LegacyIndexer();
245e1272c08SAndreas Gohr}
246e1272c08SAndreas Gohr
247e1272c08SAndreas Gohr/**
248e1272c08SAndreas Gohr * Read the list of words in an index (if it exists).
249e1272c08SAndreas Gohr *
250e1272c08SAndreas Gohr * @param string $idx
251e1272c08SAndreas Gohr * @param string $suffix
252e1272c08SAndreas Gohr * @return array
253e1272c08SAndreas Gohr *
254e1272c08SAndreas Gohr * @deprecated 2026-04-07 use Index classes directly
255e1272c08SAndreas Gohr */
256e1272c08SAndreas Gohrfunction idx_getIndex($idx, $suffix)
257e1272c08SAndreas Gohr{
258e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction('Index classes');
259e1272c08SAndreas Gohr    global $conf;
260e1272c08SAndreas Gohr    $fn = $conf['indexdir'] . '/' . $idx . $suffix . '.idx';
261e1272c08SAndreas Gohr    if (!file_exists($fn)) return [];
262e1272c08SAndreas Gohr    return file($fn);
263e1272c08SAndreas Gohr}
264e1272c08SAndreas Gohr
265e1272c08SAndreas Gohr/**
266e1272c08SAndreas Gohr * Find tokens in the fulltext index
267e1272c08SAndreas Gohr *
268e1272c08SAndreas Gohr * @param array $words list of words to search for
269e1272c08SAndreas Gohr * @return array list of pages found
270e1272c08SAndreas Gohr *
271e1272c08SAndreas Gohr * @deprecated 2026-04-07 use CollectionSearch on PageFulltextCollection instead
272e1272c08SAndreas Gohr */
273e1272c08SAndreas Gohrfunction idx_lookup(&$words)
274e1272c08SAndreas Gohr{
275e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\Collection\CollectionSearch::class);
276*6e39b4e3SAndreas Gohr    return (new dokuwiki\Search\LegacyIndexer())->lookup($words);
277e1272c08SAndreas Gohr}
278e1272c08SAndreas Gohr
279e1272c08SAndreas Gohr/**
280e1272c08SAndreas Gohr * Get the list of lengths indexed in the wiki.
281e1272c08SAndreas Gohr *
282e1272c08SAndreas Gohr * @return array
283e1272c08SAndreas Gohr *
284e1272c08SAndreas Gohr * @deprecated 2026-04-07 use PageFulltextCollection::getTokenIndexMaximum() instead
285e1272c08SAndreas Gohr */
286e1272c08SAndreas Gohrfunction idx_listIndexLengths()
287e1272c08SAndreas Gohr{
288e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction('PageFulltextCollection::getTokenIndexMaximum()');
289e1272c08SAndreas Gohr    global $conf;
290e1272c08SAndreas Gohr    $idx = [];
291e1272c08SAndreas Gohr    $files = glob($conf['indexdir'] . '/i*.idx');
292e1272c08SAndreas Gohr    if ($files) {
293e1272c08SAndreas Gohr        foreach ($files as $file) {
294e1272c08SAndreas Gohr            if (preg_match('/i(\d+)\.idx$/', $file, $match)) {
295e1272c08SAndreas Gohr                $idx[] = (int)$match[1];
296e1272c08SAndreas Gohr            }
297e1272c08SAndreas Gohr        }
298e1272c08SAndreas Gohr        sort($idx);
299e1272c08SAndreas Gohr    }
300e1272c08SAndreas Gohr    return $idx;
301e1272c08SAndreas Gohr}
302e1272c08SAndreas Gohr
303e1272c08SAndreas Gohr/**
304e1272c08SAndreas Gohr * Get the word lengths that have been indexed.
305e1272c08SAndreas Gohr *
306e1272c08SAndreas Gohr * @param array|int $filter
307e1272c08SAndreas Gohr * @return array
308e1272c08SAndreas Gohr *
309e1272c08SAndreas Gohr * @deprecated 2026-04-07 use PageFulltextCollection::getTokenIndexMaximum() instead
310e1272c08SAndreas Gohr */
311e1272c08SAndreas Gohrfunction idx_indexLengths($filter)
312e1272c08SAndreas Gohr{
313e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction('PageFulltextCollection::getTokenIndexMaximum()');
314e1272c08SAndreas Gohr    global $conf;
315e1272c08SAndreas Gohr    $idx = [];
316e1272c08SAndreas Gohr    if (is_array($filter)) {
317e1272c08SAndreas Gohr        $path = $conf['indexdir'] . "/i";
318e1272c08SAndreas Gohr        foreach (array_keys($filter) as $key) {
319e1272c08SAndreas Gohr            if (file_exists($path . $key . '.idx'))
320e1272c08SAndreas Gohr                $idx[] = $key;
321e1272c08SAndreas Gohr        }
322e1272c08SAndreas Gohr    } else {
323e1272c08SAndreas Gohr        $lengths = idx_listIndexLengths();
324e1272c08SAndreas Gohr        foreach ($lengths as $length) {
325e1272c08SAndreas Gohr            if ((int)$length >= (int)$filter)
326e1272c08SAndreas Gohr                $idx[] = $length;
327e1272c08SAndreas Gohr        }
328e1272c08SAndreas Gohr    }
329e1272c08SAndreas Gohr    return $idx;
330e1272c08SAndreas Gohr}
331e1272c08SAndreas Gohr
332e1272c08SAndreas Gohr/**
333e1272c08SAndreas Gohr * Execute a fulltext search
334e1272c08SAndreas Gohr *
335e1272c08SAndreas Gohr * @param string $query search query
336e1272c08SAndreas Gohr * @param array $highlight words to highlight
337e1272c08SAndreas Gohr * @param string|null $sort sorting order
338e1272c08SAndreas Gohr * @param int|string|null $after only show results after this date
339e1272c08SAndreas Gohr * @param int|string|null $before only show results before this date
340e1272c08SAndreas Gohr * @return array
341e1272c08SAndreas Gohr *
342e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\FulltextSearch::pageSearch() instead
343e1272c08SAndreas Gohr */
344e1272c08SAndreas Gohrfunction ft_pageSearch($query, &$highlight, $sort = null, $after = null, $before = null)
345e1272c08SAndreas Gohr{
346e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\FulltextSearch::class . '::pageSearch()');
3479313ce6dSAndreas Gohr    if (!is_array($highlight)) $highlight = [];
348e1272c08SAndreas Gohr    return (new dokuwiki\Search\FulltextSearch())->pageSearch($query, $highlight, $sort, $after, $before);
349e1272c08SAndreas Gohr}
350e1272c08SAndreas Gohr
351e1272c08SAndreas Gohr/**
352e1272c08SAndreas Gohr * Returns the backlinks for a given page
353e1272c08SAndreas Gohr *
354e1272c08SAndreas Gohr * @param string $id page id
355e1272c08SAndreas Gohr * @param bool $ignore_perms
356e1272c08SAndreas Gohr * @return string[]
357e1272c08SAndreas Gohr *
358e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\MetadataSearch::backlinks() instead
359e1272c08SAndreas Gohr */
360e1272c08SAndreas Gohrfunction ft_backlinks($id, $ignore_perms = false)
361e1272c08SAndreas Gohr{
362e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\MetadataSearch::class . '::backlinks()');
363e1272c08SAndreas Gohr    return (new dokuwiki\Search\MetadataSearch())->backlinks($id, $ignore_perms);
364e1272c08SAndreas Gohr}
365e1272c08SAndreas Gohr
366e1272c08SAndreas Gohr/**
367e1272c08SAndreas Gohr * Returns the pages that use a given media file
368e1272c08SAndreas Gohr *
369e1272c08SAndreas Gohr * @param string $id media id
370e1272c08SAndreas Gohr * @param bool $ignore_perms
371e1272c08SAndreas Gohr * @return string[]
372e1272c08SAndreas Gohr *
373e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\MetadataSearch::mediause() instead
374e1272c08SAndreas Gohr */
375e1272c08SAndreas Gohrfunction ft_mediause($id, $ignore_perms = false)
376e1272c08SAndreas Gohr{
377e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\MetadataSearch::class . '::mediause()');
378e1272c08SAndreas Gohr    return (new dokuwiki\Search\MetadataSearch())->mediause($id, $ignore_perms);
379e1272c08SAndreas Gohr}
380e1272c08SAndreas Gohr
381e1272c08SAndreas Gohr/**
382e1272c08SAndreas Gohr * Quicksearch for pagenames
383e1272c08SAndreas Gohr *
384e1272c08SAndreas Gohr * @param string $id page id
385e1272c08SAndreas Gohr * @param bool $in_ns match namespace
386e1272c08SAndreas Gohr * @param bool $in_title search in title
387e1272c08SAndreas Gohr * @param int|string|null $after
388e1272c08SAndreas Gohr * @param int|string|null $before
389e1272c08SAndreas Gohr * @return string[]
390e1272c08SAndreas Gohr *
391e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\MetadataSearch::pageLookup() instead
392e1272c08SAndreas Gohr */
393e1272c08SAndreas Gohrfunction ft_pageLookup($id, $in_ns = false, $in_title = false, $after = null, $before = null)
394e1272c08SAndreas Gohr{
395e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\MetadataSearch::class . '::pageLookup()');
396e1272c08SAndreas Gohr    return (new dokuwiki\Search\MetadataSearch())->pageLookup($id, $in_ns, $in_title, $after, $before);
397e1272c08SAndreas Gohr}
398e1272c08SAndreas Gohr
399e1272c08SAndreas Gohr/**
400e1272c08SAndreas Gohr * Creates a snippet extract
401e1272c08SAndreas Gohr *
402e1272c08SAndreas Gohr * @param string $id page id
403e1272c08SAndreas Gohr * @param array $highlight words to highlight
404e1272c08SAndreas Gohr * @return string
405e1272c08SAndreas Gohr *
406e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\FulltextSearch::snippet() instead
407e1272c08SAndreas Gohr */
408e1272c08SAndreas Gohrfunction ft_snippet($id, $highlight)
409e1272c08SAndreas Gohr{
410e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\FulltextSearch::class . '::snippet()');
411e1272c08SAndreas Gohr    return (new dokuwiki\Search\FulltextSearch())->snippet($id, $highlight);
412e1272c08SAndreas Gohr}
413e1272c08SAndreas Gohr
414e1272c08SAndreas Gohr/**
415e1272c08SAndreas Gohr * Sort pages based on their namespace level first, then alphabetically
416e1272c08SAndreas Gohr *
417e1272c08SAndreas Gohr * @param string $a
418e1272c08SAndreas Gohr * @param string $b
419e1272c08SAndreas Gohr * @return int
420e1272c08SAndreas Gohr *
421e1272c08SAndreas Gohr * @deprecated 2026-04-07 use Utf8\Sort functions directly
422e1272c08SAndreas Gohr */
423e1272c08SAndreas Gohrfunction ft_pagesorter($a, $b)
424e1272c08SAndreas Gohr{
425e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction('Utf8\\Sort');
426e1272c08SAndreas Gohr    $diff = substr_count($a, ':') - substr_count($b, ':');
427e1272c08SAndreas Gohr    return $diff ?: dokuwiki\Utf8\Sort::strcmp($a, $b);
428e1272c08SAndreas Gohr}
429e1272c08SAndreas Gohr
430e1272c08SAndreas Gohr/**
431e1272c08SAndreas Gohr * Wrap a search term in regex boundary checks
432e1272c08SAndreas Gohr *
433e1272c08SAndreas Gohr * @param string $term
434e1272c08SAndreas Gohr * @return string
435e1272c08SAndreas Gohr *
436e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\FulltextSearch::snippetRePreprocess() instead
437e1272c08SAndreas Gohr */
438e1272c08SAndreas Gohrfunction ft_snippet_re_preprocess($term)
439e1272c08SAndreas Gohr{
440e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\FulltextSearch::class . '::snippetRePreprocess()');
441e1272c08SAndreas Gohr    return (new dokuwiki\Search\FulltextSearch())->snippetRePreprocess($term);
442e1272c08SAndreas Gohr}
443e1272c08SAndreas Gohr
444e1272c08SAndreas Gohr/**
445e1272c08SAndreas Gohr * Parse a search query into its components
446e1272c08SAndreas Gohr *
447e1272c08SAndreas Gohr * @param mixed $Indexer ignored (legacy parameter)
448e1272c08SAndreas Gohr * @param string $query search query
449e1272c08SAndreas Gohr * @return array parsed query structure
450e1272c08SAndreas Gohr *
451e1272c08SAndreas Gohr * @deprecated 2026-04-07 use dokuwiki\Search\Query\QueryParser::convert() instead
452e1272c08SAndreas Gohr */
453e1272c08SAndreas Gohrfunction ft_queryParser($Indexer, $query)
454e1272c08SAndreas Gohr{
455e1272c08SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(dokuwiki\Search\Query\QueryParser::class . '::convert()');
456e1272c08SAndreas Gohr    return (new dokuwiki\Search\Query\QueryParser())->convert($query);
457e1272c08SAndreas Gohr}
4589db5ea06SAndreas Gohr
4599db5ea06SAndreas Gohr/**
46071096e46SAndreas Gohr * @deprecated 2026-04-16 use \dokuwiki\Parsing\ParserMode\Media::parseMedia() instead
46171096e46SAndreas Gohr */
46271096e46SAndreas Gohrfunction Doku_Handler_Parse_Media($match)
46371096e46SAndreas Gohr{
46471096e46SAndreas Gohr    DebugHelper::dbgDeprecatedFunction(\dokuwiki\Parsing\ParserMode\Media::class . '::parseMedia()');
46571096e46SAndreas Gohr    return \dokuwiki\Parsing\ParserMode\Media::parseMedia($match);
46671096e46SAndreas Gohr}
467