diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-05-07 19:17:33 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-05-07 19:17:33 +0200 |
commit | 01e942d44c7194607649817216aeb5d65c6acad6 (patch) | |
tree | 15777aa1005251f119e6dd680291147117766b5b /application/ApplicationUtils.php | |
parent | bc22c9a0acb095970e9494cbe8954f0612e05dc0 (diff) | |
parent | 8868f3ca461011a8fb6dd9f90b60ed697ab52fc5 (diff) | |
download | Shaarli-01e942d44c7194607649817216aeb5d65c6acad6.tar.gz Shaarli-01e942d44c7194607649817216aeb5d65c6acad6.tar.zst Shaarli-01e942d44c7194607649817216aeb5d65c6acad6.zip |
Merge tag 'v0.8.4' into stable
Release v0.8.4
Diffstat (limited to 'application/ApplicationUtils.php')
-rw-r--r-- | application/ApplicationUtils.php | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php index 978fc9da..7f963e97 100644 --- a/application/ApplicationUtils.php +++ b/application/ApplicationUtils.php | |||
@@ -15,6 +15,9 @@ class ApplicationUtils | |||
15 | * | 15 | * |
16 | * The code is read from the raw content of the version file on the Git server. | 16 | * The code is read from the raw content of the version file on the Git server. |
17 | * | 17 | * |
18 | * @param string $url URL to reach to get the latest version. | ||
19 | * @param int $timeout Timeout to check the URL (in seconds). | ||
20 | * | ||
18 | * @return mixed the version code from the repository if available, else 'false' | 21 | * @return mixed the version code from the repository if available, else 'false' |
19 | */ | 22 | */ |
20 | public static function getLatestGitVersionCode($url, $timeout=2) | 23 | public static function getLatestGitVersionCode($url, $timeout=2) |
@@ -49,6 +52,7 @@ class ApplicationUtils | |||
49 | * @param int $checkInterval the minimum interval between update checks (in seconds | 52 | * @param int $checkInterval the minimum interval between update checks (in seconds |
50 | * @param bool $enableCheck whether to check for new versions | 53 | * @param bool $enableCheck whether to check for new versions |
51 | * @param bool $isLoggedIn whether the user is logged in | 54 | * @param bool $isLoggedIn whether the user is logged in |
55 | * @param string $branch check update for the given branch | ||
52 | * | 56 | * |
53 | * @throws Exception an invalid branch has been set for update checks | 57 | * @throws Exception an invalid branch has been set for update checks |
54 | * | 58 | * |
@@ -132,11 +136,11 @@ class ApplicationUtils | |||
132 | /** | 136 | /** |
133 | * Checks Shaarli has the proper access permissions to its resources | 137 | * Checks Shaarli has the proper access permissions to its resources |
134 | * | 138 | * |
135 | * @param array $globalConfig The $GLOBALS['config'] array | 139 | * @param ConfigManager $conf Configuration Manager instance. |
136 | * | 140 | * |
137 | * @return array A list of the detected configuration issues | 141 | * @return array A list of the detected configuration issues |
138 | */ | 142 | */ |
139 | public static function checkResourcePermissions($globalConfig) | 143 | public static function checkResourcePermissions($conf) |
140 | { | 144 | { |
141 | $errors = array(); | 145 | $errors = array(); |
142 | 146 | ||
@@ -145,19 +149,19 @@ class ApplicationUtils | |||
145 | 'application', | 149 | 'application', |
146 | 'inc', | 150 | 'inc', |
147 | 'plugins', | 151 | 'plugins', |
148 | $globalConfig['RAINTPL_TPL'] | 152 | $conf->get('resource.raintpl_tpl'), |
149 | ) as $path) { | 153 | ) as $path) { |
150 | if (! is_readable(realpath($path))) { | 154 | if (! is_readable(realpath($path))) { |
151 | $errors[] = '"'.$path.'" directory is not readable'; | 155 | $errors[] = '"'.$path.'" directory is not readable'; |
152 | } | 156 | } |
153 | } | 157 | } |
154 | 158 | ||
155 | // Check cache and data directories are readable and writeable | 159 | // Check cache and data directories are readable and writable |
156 | foreach (array( | 160 | foreach (array( |
157 | $globalConfig['CACHEDIR'], | 161 | $conf->get('resource.thumbnails_cache'), |
158 | $globalConfig['DATADIR'], | 162 | $conf->get('resource.data_dir'), |
159 | $globalConfig['PAGECACHE'], | 163 | $conf->get('resource.page_cache'), |
160 | $globalConfig['RAINTPL_TMP'] | 164 | $conf->get('resource.raintpl_tmp'), |
161 | ) as $path) { | 165 | ) as $path) { |
162 | if (! is_readable(realpath($path))) { | 166 | if (! is_readable(realpath($path))) { |
163 | $errors[] = '"'.$path.'" directory is not readable'; | 167 | $errors[] = '"'.$path.'" directory is not readable'; |
@@ -167,13 +171,13 @@ class ApplicationUtils | |||
167 | } | 171 | } |
168 | } | 172 | } |
169 | 173 | ||
170 | // Check configuration files are readable and writeable | 174 | // Check configuration files are readable and writable |
171 | foreach (array( | 175 | foreach (array( |
172 | $globalConfig['CONFIG_FILE'], | 176 | $conf->getConfigFileExt(), |
173 | $globalConfig['DATASTORE'], | 177 | $conf->get('resource.datastore'), |
174 | $globalConfig['IPBANS_FILENAME'], | 178 | $conf->get('resource.ban_file'), |
175 | $globalConfig['LOG_FILE'], | 179 | $conf->get('resource.log'), |
176 | $globalConfig['UPDATECHECK_FILENAME'] | 180 | $conf->get('resource.update_check'), |
177 | ) as $path) { | 181 | ) as $path) { |
178 | if (! is_file(realpath($path))) { | 182 | if (! is_file(realpath($path))) { |
179 | # the file may not exist yet | 183 | # the file may not exist yet |