Verzeichnisstruktur phpBB-3.1.0
- Veröffentlicht
- 27.10.2014
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
tidy_search.php
01 <?php
02 /**
03 *
04 * This file is part of the phpBB Forum Software package.
05 *
06 * @copyright (c) phpBB Limited <https://www.phpbb.com>
07 * @license GNU General Public License, version 2 (GPL-2.0)
08 *
09 * For full copyright and license information, please see
10 * the docs/CREDITS.txt file.
11 *
12 */
13
14 namespace phpbb\cron\task\core;
15
16 /**
17 * Tidy search cron task.
18 *
19 * Will only run when the currently selected search backend supports tidying.
20 */
21 class tidy_search extends \phpbb\cron\task\base
22 {
23 protected $phpbb_root_path;
24 protected $php_ext;
25 protected $auth;
26 protected $config;
27 protected $db;
28 protected $user;
29
30 /**
31 * Constructor.
32 *
33 * @param string $phpbb_root_path The root path
34 * @param string $php_ext The PHP file extension
35 * @param \phpbb\auth\auth $auth The auth
36 * @param \phpbb\config\config $config The config
37 * @param \phpbb\db\driver\driver_interface $db The db connection
38 * @param \phpbb\user $user The user
39 */
40 public function __construct($phpbb_root_path, $php_ext, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user)
41 {
42 $this->phpbb_root_path = $phpbb_root_path;
43 $this->php_ext = $php_ext;
44 $this->auth = $auth;
45 $this->config = $config;
46 $this->db = $db;
47 $this->user = $user;
48 }
49
50 /**
51 * Runs this cron task.
52 *
53 * @return null
54 */
55 public function run()
56 {
57 $search_type = $this->config['search_type'];
58
59 // We do some additional checks in the module to ensure it can actually be utilised
60 $error = false;
61 $search = new $search_type($error, $this->phpbb_root_path, $this->php_ext, $this->auth, $this->config, $this->db, $this->user);
62
63 if (!$error)
64 {
65 $search->tidy();
66 }
67 }
68
69 /**
70 * Returns whether this cron task can run, given current board configuration.
71 *
72 * Search cron task is runnable in all normal use. It may not be
73 * runnable if the search backend implementation selected in board
74 * configuration does not exist.
75 *
76 * @return bool
77 */
78 public function is_runnable()
79 {
80 return class_exists($this->config['search_type']);
81 }
82
83 /**
84 * Returns whether this cron task should run now, because enough time
85 * has passed since it was last run.
86 *
87 * The interval between search tidying is specified in board
88 * configuration.
89 *
90 * @return bool
91 */
92 public function should_run()
93 {
94 return $this->config['search_last_gc'] < time() - $this->config['search_gc'];
95 }
96 }
97