summaryrefslogtreecommitdiffstats
path: root/app/helpers.php
diff options
context:
space:
mode:
authorrdalverny <rdalverny@gmail.com>2022-01-22 18:54:11 +0100
committerrdalverny <rdalverny@gmail.com>2022-01-22 18:54:11 +0100
commitc27c9d1d359828a071159995689c9c3b28d99891 (patch)
tree8aa8e0e2ea11935c34cee67f2a8f44201329b7e8 /app/helpers.php
parent58ce95a255c04e1b6ecac0d794bc4dbeb23871de (diff)
downloadplanet-c27c9d1d359828a071159995689c9c3b28d99891.tar
planet-c27c9d1d359828a071159995689c9c3b28d99891.tar.gz
planet-c27c9d1d359828a071159995689c9c3b28d99891.tar.bz2
planet-c27c9d1d359828a071159995689c9c3b28d99891.tar.xz
planet-c27c9d1d359828a071159995689c9c3b28d99891.zip
Move public resources under public/ directory
Existing setups need to update their server config to point (or link to) public/ directory instead of the root of the code repo. Configuration (and password) location also changes from custom/ and admin/inc to custom/config/. That way, config and code library move out of the publicly served file tree. Apart from the change of the web root, config should be migrated seamlessly.
Diffstat (limited to 'app/helpers.php')
-rw-r--r--app/helpers.php41
1 files changed, 37 insertions, 4 deletions
diff --git a/app/helpers.php b/app/helpers.php
index a7e68ae..24f9d38 100644
--- a/app/helpers.php
+++ b/app/helpers.php
@@ -18,8 +18,9 @@ register_polyfills();
*
* @param string $file Append this filename to the returned path.
* @return string
+ * @deprecated
*/
-function custom_path($file = '')
+function custom_path($file = '') : string
{
return __DIR__.'/../custom' . (!empty($file) ? '/'.$file : '');
}
@@ -29,8 +30,9 @@ function custom_path($file = '')
*
* @param string $file Append this filename to the returned path.
* @return string
+ * @deprecated
*/
-function views_path($file = '')
+function views_path($file = '') : string
{
return custom_path('views/' . $file);
}
@@ -40,13 +42,38 @@ function views_path($file = '')
*
* @param string $file Append this filename to the returned path.
* @return string
+ * @deprecated
*/
-function admin_path($file = '')
+function admin_path($file = '') : string
{
return __DIR__.'/../admin' . (!empty($file) ? '/'.$file : '');
}
/**
+ * Path to the _config_ directory.
+ *
+ * @param string $file Append this filename to the returned path
+ * @param string $site Append this site as a sub-directory before the file
+ * @return string
+ */
+function config_path($file = '', $site = '') : string
+{
+ $path = __DIR__ . '/../custom/config';
+ if (!empty($site)) {
+ $path .= '/' . $site;
+ }
+ if (!empty($file)) {
+ $path .= '/' . $file;
+ }
+ return $path;
+}
+
+function cache_path($site = '') : string
+{
+ return __DIR__ . '/../cache';
+}
+
+/**
* Shortcut to Simplel10n::getString().
*
* @param string $str
@@ -64,10 +91,16 @@ function _g($str, $comment = '')
function removeCustomFiles()
{
$toRemove = [
+ config_path('config.yml'),
+ config_path('people.opml'),
+ config_path('people.opml.bak'),
+ cache_path('cache'),
+
+ // legacy location
custom_path('config.yml'),
+ custom_path('config.yml.bak'),
custom_path('people.opml'),
custom_path('people.opml.bak'),
- custom_path('cache')
];
foreach ($toRemove as $path) {