1 | <?php namespace Comodojo\Extender; |
||
29 | class Checks { |
||
30 | |||
31 | /** |
||
32 | * Check for required configuration constants |
||
33 | * |
||
34 | * @return mixed Boolean true in case of success, string with error message otherwise |
||
35 | */ |
||
36 | 12 | final public static function constants() { |
|
37 | |||
38 | 12 | if ( !defined("EXTENDER_IDLE_TIME") ) return "Idle time not configured correctly. \n\n Please check your extender configuration and define constant: EXTENDER_IDLE_TIME."; |
|
39 | 12 | if ( !defined("EXTENDER_DATABASE_MODEL") ) return "Invalid database model. \n\n Please check your extender configuration and define constant: EXTENDER_DATABASE_MODEL."; |
|
40 | 12 | if ( !defined("EXTENDER_DATABASE_HOST") ) return "Unknown database host. \n\n Please check your extender configuration and define constant: EXTENDER_DATABASE_HOST."; |
|
41 | 12 | if ( !defined("EXTENDER_DATABASE_PORT") ) return "Invalid database port. \n\n Please check your extender configuration and define constant: EXTENDER_DATABASE_PORT."; |
|
42 | 12 | if ( !defined("EXTENDER_DATABASE_NAME") ) return "Invalid database name. \n\n Please check your extender configuration and define constant: EXTENDER_DATABASE_NAME."; |
|
43 | 12 | if ( !defined("EXTENDER_DATABASE_USER") ) return "Invalid database user. \n\n Please check your extender configuration and define constant: EXTENDER_DATABASE_USER."; |
|
44 | 12 | if ( !defined("EXTENDER_DATABASE_PASS") ) return "Invalid database password. \n\n Please check your extender configuration and define constant: EXTENDER_DATABASE_PASS."; |
|
45 | 12 | if ( !defined("EXTENDER_DATABASE_PREFIX") ) return "Invalid database table prefix. \n\n Please check your extender configuration and define constant: EXTENDER_DATABASE_PREFIX."; |
|
46 | 12 | if ( !defined("EXTENDER_DATABASE_TABLE_JOBS") ) return "Invalid database jobs' table. \n\n Please check your extender configuration and define constant: EXTENDER_DATABASE_TABLE_JOBS."; |
|
47 | 12 | if ( !defined("EXTENDER_DATABASE_TABLE_WORKLOGS") ) return "Invalid database worklogs' table. \n\n Please check your extender configuration and define constant: EXTENDER_DATABASE_TABLE_WORKLOGS."; |
|
48 | 12 | if ( !defined("EXTENDER_CACHE_FOLDER") ) return "Invalid cache folder. \n\n Please check your extender configuration and define constant: EXTENDER_CACHE_FOLDER."; |
|
49 | |||
50 | 12 | return true; |
|
51 | |||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Check if script is running from command line |
||
56 | * |
||
57 | * @return bool |
||
58 | */ |
||
59 | 12 | final public static function cli() { |
|
64 | |||
65 | /** |
||
66 | * Check if php interpreter supports pcntl_fork (required in multithread mode) |
||
67 | * |
||
68 | * @return bool |
||
69 | */ |
||
70 | 12 | final public static function multithread() { |
|
75 | |||
76 | /** |
||
77 | * Check if php interpreter supports pcntl signal handlers |
||
78 | * |
||
79 | * @return bool |
||
80 | */ |
||
81 | 12 | final public static function signals() { |
|
86 | |||
87 | /** |
||
88 | * Check if database is available and initialized correctly |
||
89 | * |
||
90 | * @return bool |
||
91 | */ |
||
92 | 12 | final public static function database() { |
|
120 | |||
121 | } |
||
122 |