@@ -13,11 +13,8 @@ class updater
1313{
1414 /** @var bool */
1515 private $ availableUpdate = false ;
16-
1716 const DOWNLOAD_PATH = '../tmp_uploaded_update ' ;
1817 const ELIGIBLE_SESSION_KEY = 'phplist_updater_eligible ' ;
19- const CONFIG_FILE = __DIR__ . '/../config/config.php ' ;
20-
2118 private $ excludedFiles = array (
2219 'dl.php ' ,
2320 'index.php ' ,
@@ -278,20 +275,27 @@ function deleteFiles()
278275
279276 }
280277
278+ /**
279+ * Get config file path
280+ * @return string
281+ */
282+ function getConfigFilePath ()
283+ {
284+ return __DIR__ . '/../config/config.php ' ;
285+ }
286+
281287 /**
282288 * Get a PDO connection
283289 * @return PDO
284290 * @throws UpdateException
285291 */
286292 function getConnection ()
287293 {
288- $ standardConfig = self ::CONFIG_FILE ;
289-
290294 if (isset ($ _SERVER ['ConfigFile ' ]) && is_file ($ _SERVER ['ConfigFile ' ])) {
291295 include $ _SERVER ['ConfigFile ' ];
292296
293- } elseif (file_exists ($ standardConfig )) {
294- include $ standardConfig ;
297+ } elseif (file_exists ($ this -> getConfigFilePath () )) {
298+ include $ this -> getConfigFilePath () ;
295299 } else {
296300 throw new \UpdateException ("Error: Cannot find config file " );
297301 }
@@ -325,11 +329,10 @@ function getConnection()
325329 */
326330 function addMaintenanceMode ()
327331 {
328- $ standardConfig = self ::CONFIG_FILE ;
329332 if (isset ($ _SERVER ['ConfigFile ' ]) && is_file ($ _SERVER ['ConfigFile ' ])) {
330333 include $ _SERVER ['ConfigFile ' ];
331- } elseif (file_exists ($ standardConfig )) {
332- include $ standardConfig ;
334+ } elseif (file_exists ($ this -> getConfigFilePath () )) {
335+ include $ this -> getConfigFilePath () ;
333336 } else {
334337 throw new \UpdateException ("Error: Cannot find config file " );
335338 }
@@ -367,11 +370,10 @@ function addMaintenanceMode()
367370 */
368371 function removeMaintenanceMode ()
369372 {
370- $ standardConfig = self ::CONFIG_FILE ;
371373 if (isset ($ _SERVER ['ConfigFile ' ]) && is_file ($ _SERVER ['ConfigFile ' ])) {
372374 include $ _SERVER ['ConfigFile ' ];
373- } elseif (file_exists ($ standardConfig )) {
374- include $ standardConfig ;
375+ } elseif (file_exists ($ this -> getConfigFilePath () )) {
376+ include $ this -> getConfigFilePath () ;
375377 } else {
376378 throw new \UpdateException ("Error: Cannot find config file " );
377379 }
0 commit comments