@@ -13,10 +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-
2018 private $ excludedFiles = array (
2119 'dl.php ' ,
2220 'index.php ' ,
@@ -277,20 +275,27 @@ function deleteFiles()
277275
278276 }
279277
278+ /**
279+ * Get config file path
280+ * @return string
281+ */
282+ function getConfigFilePath ()
283+ {
284+ return __DIR__ . '/../config/config.php ' ;
285+ }
286+
280287 /**
281288 * Get a PDO connection
282289 * @return PDO
283290 * @throws UpdateException
284291 */
285292 function getConnection ()
286293 {
287- $ standardConfig = __DIR__ . '/../config/config.php ' ;
288-
289294 if (isset ($ _SERVER ['ConfigFile ' ]) && is_file ($ _SERVER ['ConfigFile ' ])) {
290295 include $ _SERVER ['ConfigFile ' ];
291296
292- } elseif (file_exists ($ standardConfig )) {
293- include $ standardConfig ;
297+ } elseif (file_exists ($ this -> getConfigFilePath () )) {
298+ include $ this -> getConfigFilePath () ;
294299 } else {
295300 throw new \UpdateException ("Error: Cannot find config file " );
296301 }
@@ -324,11 +329,10 @@ function getConnection()
324329 */
325330 function addMaintenanceMode ()
326331 {
327- $ standardConfig = __DIR__ . '/../config/config.php ' ;
328332 if (isset ($ _SERVER ['ConfigFile ' ]) && is_file ($ _SERVER ['ConfigFile ' ])) {
329333 include $ _SERVER ['ConfigFile ' ];
330- } elseif (file_exists ($ standardConfig )) {
331- include $ standardConfig ;
334+ } elseif (file_exists ($ this -> getConfigFilePath () )) {
335+ include $ this -> getConfigFilePath () ;
332336 } else {
333337 throw new \UpdateException ("Error: Cannot find config file " );
334338 }
@@ -366,11 +370,10 @@ function addMaintenanceMode()
366370 */
367371 function removeMaintenanceMode ()
368372 {
369- $ standardConfig = __DIR__ . '/../config/config.php ' ;
370373 if (isset ($ _SERVER ['ConfigFile ' ]) && is_file ($ _SERVER ['ConfigFile ' ])) {
371374 include $ _SERVER ['ConfigFile ' ];
372- } elseif (file_exists ($ standardConfig )) {
373- include $ standardConfig ;
375+ } elseif (file_exists ($ this -> getConfigFilePath () )) {
376+ include $ this -> getConfigFilePath () ;
374377 } else {
375378 throw new \UpdateException ("Error: Cannot find config file " );
376379 }
0 commit comments