forked from matecat/MateCat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Status.php
66 lines (50 loc) · 1.35 KB
/
Status.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
<?php
/**
* Created by PhpStorm.
* @author domenico [email protected] / [email protected]
* Date: 16/05/14
* Time: 17.01
*
*/
namespace Analysis;
use \Analysis\Queue\RedisKeys,
\RedisHandler,
\Predis\Client,
\INIT,
\Log;
/**
* Class Analysis_Manager
*
* Should be the final class when daemons will refactored
*
*/
class Status {
public static function fastAnalysisIsRunning( $redisHandler ) {
/**
* @var $redisHandler Client
*/
$fastList = $redisHandler->lrange( RedisKeys::FAST_PID_SET, 0, -1 );
return !empty( $fastList );
}
public static function tmAnalysisIsRunning( $redisHandler ) {
/**
* @var $redisHandler Client
*/
return (bool)$redisHandler->get( RedisKeys::VOLUME_ANALYSIS_PID );
}
/**
*
* @return bool
*/
public static function thereIsAMisconfiguration() {
try {
$redisHandler = new RedisHandler();
$redisHandler = $redisHandler->getConnection();
return ( INIT::$VOLUME_ANALYSIS_ENABLED && !self::fastAnalysisIsRunning( $redisHandler ) && !self::tmAnalysisIsRunning( $redisHandler ) );
} catch ( \Exception $ex ) {
$msg = "****** No REDIS instances found. ******";
Log::doLog( $msg );
return false;
}
}
}