aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-07-10 21:34:52 -0700
committerfriendica <info@friendica.com>2014-07-10 21:34:52 -0700
commitc74fd789935e19074e2799b5201654ffe3bfce5c (patch)
tree4778b979ba14b16b2b994c1ee8279ee133ecf060
parentf2c54cfcaf9d154970a4a4c99384e267f8699022 (diff)
downloadvolse-hubzilla-c74fd789935e19074e2799b5201654ffe3bfce5c.tar.gz
volse-hubzilla-c74fd789935e19074e2799b5201654ffe3bfce5c.tar.bz2
volse-hubzilla-c74fd789935e19074e2799b5201654ffe3bfce5c.zip
move smarty compiled files to store/[data]/smarty3 - which puts all writeable areas of the server except the config file and logs under the "store" directory. We'll do logs at a future time.
-rwxr-xr-xboot.php14
-rw-r--r--doc/Install.md6
-rw-r--r--doc/faq_admins.bb2
-rw-r--r--doc/install.bb6
-rw-r--r--doc/problems-following-an-update.bb2
-rw-r--r--doc/red2pi.bb4
-rwxr-xr-xinclude/friendica_smarty.php2
-rw-r--r--install/INSTALL.txt8
-rw-r--r--install/update.php11
-rwxr-xr-xmod/setup.php8
-rwxr-xr-xutil/precompile_smarty3.php6
11 files changed, 37 insertions, 32 deletions
diff --git a/boot.php b/boot.php
index c3ea2a854..e6bbbee2f 100755
--- a/boot.php
+++ b/boot.php
@@ -47,11 +47,12 @@ define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1116 );
+define ( 'DB_UPDATE_VERSION', 1117 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
+define ( 'TEMPLATE_BUILD_PATH', 'store/[data]/smarty3' );
define ( 'DIRECTORY_MODE_NORMAL', 0x0000); // This is technically DIRECTORY_MODE_TERTIARY, but it's the default, hence 0x0000
define ( 'DIRECTORY_MODE_PRIMARY', 0x0001);
@@ -1062,8 +1063,8 @@ class App {
/*if ($engine) {
case 'smarty3':
- if(!is_writable('view/tpl/smarty3/'))
- echo "<b>ERROR</b> folder <tt>view/tpl/smarty3/</tt> must be writable by webserver."; killme();
+ if(!is_writable(TEMPLATE_BUILD_PATH))
+ echo "<b>ERROR</b> folder <tt>" . TEMPLATE_BUILD_PATH . "</tt> must be writable by webserver."; killme();
break;
default:
@@ -1256,10 +1257,11 @@ function check_config(&$a) {
$func = 'update_r' . $x;
$retval = $func();
if($retval) {
+
// Prevent sending hundreds of thousands of emails by creating
- // a lockfile. view/tpl/smarty3 is the only place we can
- // guarantee the server can write to.
- $lockfile = 'view/tpl/smarty3/mailsent';
+ // a lockfile.
+
+ $lockfile = 'store/[data]/mailsent';
if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 86400)))
return;
diff --git a/doc/Install.md b/doc/Install.md
index 8adfe3ccd..1ff6e69e7 100644
--- a/doc/Install.md
+++ b/doc/Install.md
@@ -49,11 +49,11 @@ you might have trouble getting everything to work.]
`git pull`
- - make sure folder *view/tpl/smarty3* exists and is writable by webserver
+ - make sure folder *store/[data]/smarty3* exists and is writable by webserver
- `mkdir view/tpl/smarty3`
+ `mkdir -p "store/\[data\]/smarty3"`
- `chmod 777 view/smarty3`
+ `chmod 777 "store/\[data\]/smarty3"`
- For installing addons
diff --git a/doc/faq_admins.bb b/doc/faq_admins.bb
index bf3364f98..1679ec246 100644
--- a/doc/faq_admins.bb
+++ b/doc/faq_admins.bb
@@ -17,7 +17,7 @@ Most likely, your session table has crashed. Run the MySQL command [code]repair
[*][b]When I switch theme, I sometimes get elements of one theme superimposed on top of the other[/b]
-a) view/tpl/smarty3 isn't writeable by the webserver. Make it so.
+a) store/[data]/smarty3 isn't writeable by the webserver. Make it so.
b) You're using Midori, or with certain themes, Konqueror in KHTML mode.
diff --git a/doc/install.bb b/doc/install.bb
index 81fc7f844..bf6578e59 100644
--- a/doc/install.bb
+++ b/doc/install.bb
@@ -41,11 +41,11 @@ you might have trouble getting everything to work.]
`git pull`
- - make sure folder *view/tpl/smarty3* exists and is writable by webserver
+ - make sure folder *store/[data]/smarty3* exists and is writable by webserver
- `mkdir view/tpl/smarty3`
+ `mkdir -p "store/\[data\]/smarty3"`
- `chmod 777 view/smarty3`
+ `chmod 777 "store/\[data\]/smarty3"`
- For installing addons
diff --git a/doc/problems-following-an-update.bb b/doc/problems-following-an-update.bb
index bb2e07a07..0b2c2e11a 100644
--- a/doc/problems-following-an-update.bb
+++ b/doc/problems-following-an-update.bb
@@ -24,7 +24,7 @@ Symptoms:
2) Missing icons, tabs, menus or features.
-We use the Smarty3 template engine to generate pages. These templates are compiled before they are displayed. Occasionally, a new or modified template will fail to overwrite the old compiled version. To clear the Smarty cache, delete all the files in view/tpl/smarty3/compiled [b]but do not delete the directory itself[/b]. Templates will then be recompiled on their next access.
+We use the Smarty3 template engine to generate pages. These templates are compiled before they are displayed. Occasionally, a new or modified template will fail to overwrite the old compiled version. To clear the Smarty cache, delete all the files in store/[data]/smarty3/compiled [b]but do not delete the directory itself[/b]. Templates will then be recompiled on their next access.
[b]Theme Issues[/b]
diff --git a/doc/red2pi.bb b/doc/red2pi.bb
index c29de91e9..4ca58a382 100644
--- a/doc/red2pi.bb
+++ b/doc/red2pi.bb
@@ -260,8 +260,8 @@ Check if you can update the addons
[code]pi@pi /var/www $ cd addon/
pi@pi /var/www/addon $ sudo git pull[/code]
-Make sure folder view/tpl/smarty3 exists and is writable by the webserver
-[code]pi@pi /var/www $ sudo chmod ou+w view/tpl/smarty3/[/code]
+Make sure folder store/[data]/smarty3 exists and is writable by the webserver
+[code]pi@pi /var/www $ sudo chmod ou+w "store/\[data\]/smarty3"[/code]
Create .htconfig.php and is writable by the webserver
[code]pi@pi /var/www $ sudo touch .htconfig.php
diff --git a/include/friendica_smarty.php b/include/friendica_smarty.php
index 12a789c9a..c2fcc4097 100755
--- a/include/friendica_smarty.php
+++ b/include/friendica_smarty.php
@@ -50,7 +50,7 @@ class FriendicaSmartyEngine implements ITemplateEngine {
public function __construct(){
$a = get_app();
$basecompiledir = ((array_key_exists('smarty3_folder',$a->config['system'])) ? $a->config['system']['smarty3_folder'] : '');
- if (!$basecompiledir) $basecompiledir = dirname(__dir__)."/view/tpl/smarty3";
+ if (!$basecompiledir) $basecompiledir = dirname(__dir__)."/store/[data]/smarty3";
if (!is_dir($basecompiledir)) {
echo "<b>ERROR:</b> folder <tt>$basecompiledir</tt> does not exist."; killme();
}
diff --git a/install/INSTALL.txt b/install/INSTALL.txt
index 6080ff6c7..946e83ca3 100644
--- a/install/INSTALL.txt
+++ b/install/INSTALL.txt
@@ -94,13 +94,11 @@ directory/path component in the URL) is REQUIRED.
git pull
- - make sure folders *view/tpl/smarty3* and *store* exist and are writable by webserver
+ - make sure folders *store/[data]/smarty3* and *store* exist and are writable by webserver
- mkdir view/tpl/smarty3
- mkdir store
+ mkdir -p "store/\[data\]/smarty3"
- chmod 777 view/tpl/smarty3
- chmod 777 store
+ chmod -R 777 store
[This permission (777) is very dangerous and if you have sufficient
privilege and knowledge you should make this directory writeable only
diff --git a/install/update.php b/install/update.php
index 60e8497dc..3d4ed2cf9 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1116 );
+define( 'UPDATE_VERSION' , 1117 );
/**
*
@@ -995,7 +995,7 @@ ADD INDEX ( `menu_flags` )");
}
function update_r1091() {
- @mkdir('store/[data]/smarty',STORAGE_DEFAULT_PERMISSIONS,true);
+ @mkdir('store/[data]/smarty3',STORAGE_DEFAULT_PERMISSIONS,true);
@file_put_contents('store/[data]/locks','');
return UPDATE_SUCCESS;
}
@@ -1298,4 +1298,9 @@ function update_r1115() {
$r = q("update account set account_flags = (account_flags ^ 1) where (account_flags & 1) ");
return UPDATE_SUCCESS;
-} \ No newline at end of file
+}
+
+function update_r1116() {
+ @mkdir('store/[data]/smarty3',STORAGE_DEFAULT_PERMISSIONS,true);
+ return UPDATE_SUCCESS;
+} \ No newline at end of file
diff --git a/mod/setup.php b/mod/setup.php
index 69e026056..7932d67af 100755
--- a/mod/setup.php
+++ b/mod/setup.php
@@ -510,16 +510,16 @@ function check_htconfig(&$checks) {
function check_smarty3(&$checks) {
$status = true;
$help = "";
- if( !is_writable('view/tpl/smarty3') ) {
+ if( !is_writable(TEMPLATE_BUILD_PATH) ) {
$status=false;
$help = t('Red uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL;
- $help .= t('In order to store these compiled templates, the web server needs to have write access to the directory view/tpl/smarty3/ under the Red top level folder.').EOL;
+ $help .= sprintf( t('In order to store these compiled templates, the web server needs to have write access to the directory %s under the Red top level folder.'), TEMPLATE_BUILD_PATH) . EOL;
$help .= t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL;
- $help .= t('Note: as a security measure, you should give the web server write access to view/tpl/smarty3/ only--not the template files (.tpl) that it contains.').EOL;
+ $help .= sprintf( t('Note: as a security measure, you should give the web server write access to %s only--not the template files (.tpl) that it contains.'), TEMPLATE_BUILD_PATH) . EOL;
}
- check_add($checks, t('view/tpl/smarty3 is writable'), $status, true, $help);
+ check_add($checks, sprintf( t('%s is writable'), TEMPLATE_BUILD_PATH), $status, true, $help);
}
diff --git a/util/precompile_smarty3.php b/util/precompile_smarty3.php
index 65cb760ef..c977a9680 100755
--- a/util/precompile_smarty3.php
+++ b/util/precompile_smarty3.php
@@ -17,9 +17,9 @@ $s = new Smarty();
$s->setTemplateDir($folders);
-$s->setCompileDir('view/tpl/smarty3/compiled/');
-$s->setConfigDir('view/tpl/smarty3/config/');
-$s->setCacheDir('view/tpl/smarty3/cache/');
+$s->setCompileDir(TEMPLATE_BUILD_PATH . '/compiled/');
+$s->setConfigDir(TEMPLATE_BUILD_PATH . '/config/');
+$s->setCacheDir(TEMPLATE_BUILD_PATH . '/cache/');
$s->left_delimiter = "{{";
$s->right_delimiter = "}}";