Dear Takashi,

yes, this could be a solution.

We investigated the code and found that the templates_c directory is 
hardcoded in smarty in just two places:

components/renderers/template_renderer.php
and
components/utils/check_utils.php

We could correct both these places and add the files above to the list of 
excluded files to prevent them from being overwritten when updating the 
code.

In template_renderer.php:

###########
<?php

include_once dirname(__FILE__) . '/' . 
'../../libs/smartylibs/Smarty.class.php';

interface ITemplateRenderer
{
public function render($templateName, $params);
}

class SmartyTemplateRenderer implements ITemplateRenderer
{
/** @var Smarty */
private $smarty;

/**
* @param string $templateDirectory
* @param string $compileDirectory
*/
* public function __construct($templateDirectory = 'components/templates', 
$compileDirectory = 'templates_c') {*
$this->smarty = new Smarty();
$this->smarty->template_dir = $templateDirectory;
$this->smarty->compile_dir = $compileDirectory;
}

/**
* @param string $templateName
* @param array $params
* @return string
*/
public function render($templateName, $params) {
foreach($params as $key => &$value) {
if (is_object($value)) {
$this->smarty->assign_by_ref($key, $value);
} else {
$this->smarty->assign($key, $value);
}
}

return $this->smarty->fetch($templateName);
}

}

function GetTemplateRenderer() {
return new SmartyTemplateRenderer();
}


###########

In check_utils.php there is only a test if the templates_c directory is 
writeable:

###########
function CheckTemplatesCacheFolderIsExistsAndWritable() {
$templatesCacheFolder = 'templates_c';
if (!file_exists($templatesCacheFolder) || 
!is_writable($templatesCacheFolder)) {

header('Content-Type: text/html; charset=UTF-8');

$result = file_get_contents(
'components/templates/templates_c_folder_warning.html');
$result = str_replace('{MESSAGE}', 'Error: the templates_c directory does 
not exist or is not writable', $result);
$result = str_replace('{DETAILS}', 'Please make sure that the templates_c 
directory does exist in the root directory of the generated application and 
it is writable by the web server user.', $result);
echo $result;
exit;
}
}

How can we proceed?

Cheers
Jorg




Am Donnerstag, 16. November 2017 20:23:34 UTC+1 schrieb Takashi Matsuo 
(Google):
>
> Hi Jörg,
>
> The Flex build pipeline set a stcict permission on everything under 
> document_root.
> Is it possible to configure smarty to use a directory outside of the 
> document_root (e.g. /tmp, or /app/smarty_cache)?
>
> Technically it's possible to introduce a flag for not setting the strict 
> permission at all, so let us know if you want this option.
>
> On Thu, Nov 2, 2017 at 1:42 PM 'George (Cloud Platform Support)' via 
> Google App Engine <google-a...@googlegroups.com <javascript:>> wrote:
>
>> There is a PHP example 
>> <https://cloud.google.com/appengine/docs/flexible/php/using-cloud-storage> 
>> for the flexible environment in the "Using Cloud Storage" document for PHP 
>> and flex. You may consider checking it for applicable sample code, to adapt 
>> to your particular requirements. 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Google App Engine" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to google-appengi...@googlegroups.com <javascript:>.
>> To post to this group, send email to google-a...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/google-appengine.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-appengine/e8db7b1d-54c1-422f-8772-0ac0728a3776%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/google-appengine/e8db7b1d-54c1-422f-8772-0ac0728a3776%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> -- Takashi
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/3f59a530-cf38-4e18-a9f9-2a20096b322a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine]... 'Jörg Hartgen' via Google App Engine
    • [google-appen... 'George (Cloud Platform Support)' via Google App Engine
      • [google-a... 'Jörg Hartgen' via Google App Engine
        • [goog... 'George (Cloud Platform Support)' via Google App Engine
          • [... 'Jörg Hartgen' via Google App Engine
            • ... 'Jörg Hartgen' via Google App Engine
              • ... 'George (Cloud Platform Support)' via Google App Engine
                • ... 'Jörg Hartgen' via Google App Engine
                • ... 'George (Cloud Platform Support)' via Google App Engine
                • ... 'Takashi Matsuo' via Google App Engine
                • ... 'Jörg Hartgen' via Google App Engine
                • ... 'Takashi Matsuo' via Google App Engine

Reply via email to