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.
This commit is contained in:
parent
f2c54cfcaf
commit
c74fd78993
14
boot.php
14
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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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]
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
function update_r1116() {
|
||||
@mkdir('store/[data]/smarty3',STORAGE_DEFAULT_PERMISSIONS,true);
|
||||
return UPDATE_SUCCESS;
|
||||
}
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
@ -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 = "}}";
|
||||
|
Reference in New Issue
Block a user