-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathclass.sphinxsearchadmin.php
123 lines (95 loc) · 3.32 KB
/
class.sphinxsearchadmin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
/**
* Create a Facade
*/
class SphinxSearchAdmin {
public $Setup;
public $Install;
public $Service;
public $Wizard;
protected $Settings;
public $Observable;
public function __construct($Sender, $View) {
$this->Setup = SphinxFactory::BuildSettings();
$this->Settings = $this->Setup->GetAllSettings();
$this->Install = SphinxFactory::BuildInstall($this->Settings);
$this->Install->Attach(new SphinxStatusLogger($Sender, $View));
$this->Service = SphinxFactory::BuildService($this->Settings);
$this->Service->Attach(new SphinxStatusLogger($Sender, $View));
$this->Service = SphinxFactory::BuildService($this->Settings);
$this->Service->Attach(new SphinxStatusLogger($Sender, $View));
$this->Wizard = SphinxFactory::BuildWizard($this->Settings);
$this->Wizard->Attach(new SphinxStatusLogger($Sender, $View));
}
public function ToggleWizard() {
$this->Wizard->ToggleWizard();
}
/**
*Checks if the pid/error/output.txt files are both read/writeable for any tasks to be run in the background require
* that their status can be written to
*/
public function CheckDebugFiles(){
$this->Install->CheckDebugFiles();
}
public function Detect() {
$this->Wizard->DetectionAction(); //attempt to find prescense of sphinx
}
public function GetSettings() {
//return $this->Settings;
$Setup = SphinxFactory::BuildSettings();
return $Setup->GetAllSettings();
}
public function ValidateInstall() {
$this->Service->ValidateInstall();
}
public function SetupCron(){
$this->Install->SetupCron();
}
public function WriteConfigFile(){
$this->Install->InstallWriteConfig();
}
public function InstallConfig(){
//Get here when indexer and searchd have been installed...don't check if sphinx.conf exists just yet!
$this->Install->InstallWriteConfig();
// $this->Service->ValidateInstall(); //now check if sphinx is installed
// $this->SetupCron();
}
public function InstallCron(){
$this->SetupCron();
}
public function InstallAction($InstallAction, $Background ){
// NO checks are made to see if already running
return $this->Wizard->InstallAction($InstallAction, $Background , $this->Service, $this->Install);
}
public function CheckSphinxRunning() {
return $this->Service->CheckSphinxRunning();
}
public function Status() {
$this->Service->Status();
}
public function Start() {
$this->Service->Start();
}
public function Stop() {
$this->Service->Stop();
}
public function ReIndexMain($Background) {
$this->Service->ReIndexMain($Background);
}
public function ReIndexDelta($Background) {
$this->Service->ReIndexDelta($Background);
}
public function ReIndexStats($Background) {
$this->Service->ReIndexStats($Background);
}
public function CheckPort() {
$this->Service->CheckPort();
}
/**
* Searches for all instances of searchd and kills them
* This is useful is you get the "Unknown PID error" (multiple instances running)
*/
public function KillSearchd(){
$this->Service->KillSearchd();
}
}