Page 6 of 12

Re: [2.0] Smartifying the backend

Posted: Mon Mar 26, 2012 3:43 pm
by garvinhicking
Hi!
Timbalu wrote:I'm starting to get light confused... :wink:
garvinhicking wrote:1. s9y does NOT fail on a non-writable templates_c directory in NORMAL operation, so Smarty must made to be loadable
That means "disable our trigger_error(DIRECTORY_WRITE_ERROR)" in our s9y_smarty class, to not fail in general, right?
Yes, at least when IS_installed !== true.
garvinhicking wrote:2. On installation, s9y utilizes Smarty (in the way above), but installation cannot continue unless templates_c is made writable.
That means "put the s9y_smarty class trigger_error(DIRECTORY_WRITE_ERROR) into the installer, to stop installing until solved, right?[/quote]

Yes, for anyone testing s9y 2.0 branch, that would be good, I think.

Regards,
Garvin

Re: [2.0] Smartifying the backend

Posted: Mon Mar 26, 2012 4:36 pm
by Timbalu

Code: Select all

        if (!is_dir($this->getCompileDir()) || !is_writable($this->getCompileDir())) {
            if(ini_get('display_errors') == 0 || ini_get('display_errors') == 'off') printf(DIRECTORY_WRITE_ERROR, $this->getCompileDir());
			// to avoid stopping by exception_error in general
			if( !defined(IS_installed) || IS_installed !== true) trigger_error(sprintf(DIRECTORY_WRITE_ERROR, $this->getCompileDir()), E_USER_ERROR);
        }
that one would fit both, right? (no need to double it into installer...)

Re: [2.0] Smartifying the backend

Posted: Mon Mar 26, 2012 7:02 pm
by garvinhicking
Hi!

I don't want to trigger an error or printf an error message. Smarty should work without a writable directory...that's what would be the most important thing in this. Only once that is done, the s9y INSTALLER can work without a writable directory to use our smarty templates to print the normal error output on installation...

Regards,
Garvin

Re: [2.0] Smartifying the backend

Posted: Mon Mar 26, 2012 7:34 pm
by Timbalu
... this answer is leaving me confused even more...

in S9y Smarty2 environment, we always had

Code: Select all

            if (!is_dir($serendipity['smarty']->compile_dir) || !is_writable($serendipity['smarty']->compile_dir)) {
                printf(DIRECTORY_WRITE_ERROR, $serendipity['smarty']->compile_dir);
                return false;
            }
which - in difference - had no occurance in the installer, as the last not smartified.
Maybe you or me are talking about different interactions?

Re: [2.0] Smartifying the backend

Posted: Mon Mar 26, 2012 7:46 pm
by onli

Code: Select all

 if (!is_dir($serendipity['smarty']->compile_dir) || !is_writable($serendipity['smarty']->compile_dir)) {
You say: This was checked on installation? I don't think so...

Re: [2.0] Smartifying the backend

Posted: Mon Mar 26, 2012 8:04 pm
by Timbalu
No! Never! I said ~was not appearing in installer, as that one not smartified.
Calm, Browny, calm! :wink:

Re: [2.0] Smartifying the backend

Posted: Mon Mar 26, 2012 8:10 pm
by onli
Then i don't udnerstand your confusion. Garvin said: No printf-error when templates_c is not writeable on install, only show the normal installer with it's messages regarding the rights at the bottom.

Re: [2.0] Smartifying the backend

Posted: Mon Mar 26, 2012 8:53 pm
by Timbalu
Yes, understanding Garvins last post in this single way...
but - turning in a circle - as I said already, Smarty3 is gonna fail, if the essential compile dir is not writable (even if I don't know how this could ever happen, though).
How should Smarty ever work if this isn't set probably, in which usercase it ever appears?

Re: [2.0] Smartifying the backend

Posted: Tue Mar 27, 2012 10:46 am
by garvinhicking
Hi!
Timbalu wrote:Yes, understanding Garvins last post in this single way...
but - turning in a circle - as I said already, Smarty3 is gonna fail, if the essential compile dir is not writable (even if I don't know how this could ever happen, though).
How should Smarty ever work if this isn't set probably, in which usercase it ever appears?
THIS IS WHAT NEEDS WORK! :-)

There is IMHO no reason that Smarty would need a writable compile directory, and I thought you mentioned that this is true when using 'resource' eval fetch calls.

Serendipity needs to extend the Smarty object so, that when the compile dir is not writable, it uses a Smarty-Class that uses eval fetch calls, so that smarty will properly work, thus enabling the installer smarty templates, thus enabling the installer smarty template to print out proper diagnostic messages just like before.

I basically want the same user experience for the installation process as it currently stands without the smarty templates.

Ultimately, if we cannot get Smarty3 to behave that way, we will need to NOT template the installer.

Regards,
Garvin

Re: [2.0] Smartifying the backend

Posted: Tue Mar 27, 2012 11:32 am
by yellowled
garvinhicking wrote:Ultimately, if we cannot get Smarty3 to behave that way, we will need to NOT template the installer.
Remember, there is always the option to "backport" my changes to the smartified backend to some kind of hardcoded backend, be it for performance or other reasons. (Just wanted to add that before you guys start bumping heads here. :wink:)

YL

Re: [2.0] Smartifying the backend

Posted: Tue Mar 27, 2012 12:37 pm
by Timbalu
Hi Garvin
garvinhicking wrote:There is IMHO no reason that Smarty would need a writable compile directory, and I thought you mentioned that this is true when using 'resource' eval fetch calls.
In general or in the special installer case? In general Smarty does need a compile dir and errors if not. But within a working environment you can use 'resource' eval fetch calls.
garvinhicking wrote:Ultimately, if we cannot get Smarty3 to behave that way, we will need to NOT template the installer.
I really expect some patience in this question and hope these bigletters up there don't tell me you got out of range...
Did you really read my conclusion post (p=10429857) carefully?
That is what I have said, having left these three possible options...


My remembrance failure in my remaining question was, that the installer procedure would throw nice errors, but would run through leaving an erroring frontend. The last isn't true. So my vote changes again.
So after some more testing, I would conclude finally to save the installer.tpl as a raw php template, as I did some very long post ago (p=10429739)..., since I really like the nice page step1 in the installer to be presented to the user too.

Pace! :wink:

Re: [2.0] Smartifying the backend

Posted: Tue Mar 27, 2012 12:47 pm
by garvinhicking
Hi!
In general or in the special installer case? In general Smarty does need a compile dir and errors if not. But within a working environment you can use 'resource' eval fetch calls.
I still think this needs to work somehow. I've mailed Rodney to ask for it.
I really expect some patience in this question and hope these bigletters up there don't tell me you got out of range...


No, but I just want to state that a simple echo/sprintf errormessage is not the way I want to pursuit.

Let'S see if rodney finds a way, else we go the installer.php route.

Regards,
Garvin

Re: [2.0] Smartifying the backend

Posted: Tue Mar 27, 2012 12:55 pm
by Timbalu
pull that back Garvin

I just found a incredible easy solution! Commit in a minute. :D Good we talked about it.

Re: [2.0] Smartifying the backend

Posted: Tue Mar 27, 2012 1:28 pm
by garvinhicking
Hi!

Rodney posted this:

https://gist.github.com/2215060

Regards,
Garvin

Re: [2.0] Smartifying the backend

Posted: Tue Mar 27, 2012 1:42 pm
by Timbalu
looks like you are good in pestering too ;-)
...mine is shorter, but that one looks very professional! Its up to you.