From: VirtualTam Date: Mon, 3 Dec 2018 22:58:59 +0000 (+0100) Subject: namespacing: \Shaarli\ApplicationUtils X-Git-Tag: v0.11.0~43^2~7 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=9778a1551ce708b9f421a181806412a05410f1fb;p=github%2Fshaarli%2FShaarli.git namespacing: \Shaarli\ApplicationUtils Signed-off-by: VirtualTam --- diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php index a3b2dcb1..7fe3cb32 100644 --- a/application/ApplicationUtils.php +++ b/application/ApplicationUtils.php @@ -1,4 +1,9 @@ get('resource.theme'), - ) as $path) { - if (! is_readable(realpath($path))) { - $errors[] = '"'.$path.'" '. t('directory is not readable'); + 'application', + 'inc', + 'plugins', + $rainTplDir, + $rainTplDir . '/' . $conf->get('resource.theme'), + ) as $path) { + if (!is_readable(realpath($path))) { + $errors[] = '"' . $path . '" ' . t('directory is not readable'); } } // Check cache and data directories are readable and writable foreach (array( - $conf->get('resource.thumbnails_cache'), - $conf->get('resource.data_dir'), - $conf->get('resource.page_cache'), - $conf->get('resource.raintpl_tmp'), - ) as $path) { - if (! is_readable(realpath($path))) { - $errors[] = '"'.$path.'" '. t('directory is not readable'); + $conf->get('resource.thumbnails_cache'), + $conf->get('resource.data_dir'), + $conf->get('resource.page_cache'), + $conf->get('resource.raintpl_tmp'), + ) as $path) { + if (!is_readable(realpath($path))) { + $errors[] = '"' . $path . '" ' . t('directory is not readable'); } - if (! is_writable(realpath($path))) { - $errors[] = '"'.$path.'" '. t('directory is not writable'); + if (!is_writable(realpath($path))) { + $errors[] = '"' . $path . '" ' . t('directory is not writable'); } } // Check configuration files are readable and writable foreach (array( - $conf->getConfigFileExt(), - $conf->get('resource.datastore'), - $conf->get('resource.ban_file'), - $conf->get('resource.log'), - $conf->get('resource.update_check'), - ) as $path) { - if (! is_file(realpath($path))) { + $conf->getConfigFileExt(), + $conf->get('resource.datastore'), + $conf->get('resource.ban_file'), + $conf->get('resource.log'), + $conf->get('resource.update_check'), + ) as $path) { + if (!is_file(realpath($path))) { # the file may not exist yet continue; } - if (! is_readable(realpath($path))) { - $errors[] = '"'.$path.'" '. t('file is not readable'); + if (!is_readable(realpath($path))) { + $errors[] = '"' . $path . '" ' . t('file is not readable'); } - if (! is_writable(realpath($path))) { - $errors[] = '"'.$path.'" '. t('file is not writable'); + if (!is_writable(realpath($path))) { + $errors[] = '"' . $path . '" ' . t('file is not writable'); } } diff --git a/application/render/PageBuilder.php b/application/render/PageBuilder.php index 9a0fe61a..1c5b9251 100644 --- a/application/render/PageBuilder.php +++ b/application/render/PageBuilder.php @@ -2,7 +2,7 @@ namespace Shaarli\Render; -use ApplicationUtils; +use Shaarli\ApplicationUtils; use Exception; use Shaarli\Bookmark\LinkDB; use RainTPL; diff --git a/application/updater/Updater.php b/application/updater/Updater.php index 55251a30..89f0ff7f 100644 --- a/application/updater/Updater.php +++ b/application/updater/Updater.php @@ -2,7 +2,7 @@ namespace Shaarli\Updater; -use ApplicationUtils; +use Shaarli\ApplicationUtils; use Exception; use RainTPL; use ReflectionClass; diff --git a/index.php b/index.php index ce0373e1..3a7dab25 100644 --- a/index.php +++ b/index.php @@ -56,7 +56,6 @@ require_once 'inc/rain.tpl.class.php'; require_once __DIR__ . '/vendor/autoload.php'; // Shaarli library -require_once 'application/ApplicationUtils.php'; require_once 'application/bookmark/LinkUtils.php'; require_once 'application/config/ConfigPlugin.php'; require_once 'application/feed/Cache.php'; @@ -71,6 +70,7 @@ require_once 'application/Utils.php'; require_once 'application/PluginManager.php'; require_once 'application/Router.php'; +use \Shaarli\ApplicationUtils; use \Shaarli\Bookmark\Exception\LinkNotFoundException; use \Shaarli\Bookmark\LinkDB; use \Shaarli\Config\ConfigManager; @@ -83,7 +83,7 @@ use \Shaarli\Render\ThemeUtils; use \Shaarli\Security\LoginManager; use \Shaarli\Security\SessionManager; use \Shaarli\Thumbnailer; -use Shaarli\Updater\Updater; +use \Shaarli\Updater\Updater; // Ensure the PHP version is supported try { diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php index fe5f84ce..82f8804d 100644 --- a/tests/ApplicationUtilsTest.php +++ b/tests/ApplicationUtilsTest.php @@ -1,33 +1,14 @@