Static pages not working in 0.8.3?

Found a bug? Tell us!!
francisco
Regular
Posts: 42
Joined: Thu Jul 21, 2005 9:33 pm

Static pages not working in 0.8.3?

Post by francisco »

Before installing at an ISP I played with 0.8.2 and didn't have any problems with static pages.

Installed at ISP 0.8.3 and static pages are not working.

Don't have access to logs (have to ask ISP for it) so can't check tonight if there are any errors.

Anyone else experience any problems with static pages since switchign to 0.8.3?

When I save a static page all I get is a note saying that the settings have been saved, but no page is created.
wesley
Regular
Posts: 197
Joined: Sun Jul 10, 2005 11:15 am
Contact:

Post by wesley »

Static pages work fine on 0.8.3 here.

By 'no page is created', do you get a completely blank page, or do you
get a page with everything BUT the static page content? In case of former,
it's likely to be a permissions problem that might have occurred when you
upgraded it. Make sure templates_c folder has the permissions set in such
a way that the webserve user can write to it, but preferably, no one else.
I make s9y plugins, too.
My s9y blog depends on them. :)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Another error might be that your serendipity_staticpages database table is not the right one to use with the version of your plugin.

Can you look which colums your serendipity_staticpages table has (via phpMyAdmin or sth. like that) and then tell us which version of the staticpage plugin you're using? It show show up on the plugin installation screen.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
francisco
Regular
Posts: 42
Joined: Thu Jul 21, 2005 9:33 pm

Post by francisco »

garvinhicking wrote:Another error might be that your serendipity_staticpages database table is not the right one to use with the version of your plugin.
I should have added some additional info.
I did not upgrade.. I played with 0.8.2 in one machine and did a fresh install in another.
garvinhicking wrote:Can you look which colums your serendipity_staticpages table has (via phpMyAdmin or sth. like that) and then tell us which version of the staticpage plugin you're using?
Just in case.. Plugin version 1.22

Table details

Code: Select all

       Column       |          Type          
--------------------+------------------------
 id                 | integer                
 parent_id          | integer                
 articleformattitle | character varying(255) 
 articleformat      | smallint               
 markup             | smallint               
 pagetitle          | character varying(255) 
 permalink          | character varying(255) 
 is_startpage       | smallint               
 show_childpages    | smallint               
 content            | text                   
 pre_content        | text                   
 headline           | character varying(255) 
 filename           | character varying(255) 
 pass               | character varying(255) 
 timestamp          | integer                
 authorid           | integer                
Indexes:
"serendipity_staticpages_pkey" 
primary key, btree (id)
francisco
Regular
Posts: 42
Joined: Thu Jul 21, 2005 9:33 pm

Post by francisco »

wesley wrote:By 'no page is created', do you get a completely blank page, or do you get a page with everything BUT the static page content?
Checked rights and template_c directory rights seems fine. See pages created by the web server.

As I mentioned in previous post I should have mentioned.. this is a fresh install of 0.8.3

What I am doing and what is happening:
* Admin
* Static page
* Select New
* Hit Go
* Put some info
* Hit save

I get on green at the top
Done: The new settings have been saved at 08:34:38

Back at the blog I only see "Front Page" on the list of static pages.
Selecting Front Page just takes me back to the front page.

Requested access to web logs from ISP.. waiting at the moment..
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

I bet you're using postgreSQL, right? There might be once again some errors because of inserting "" instead of "0" or so.

I have enabled verbose error reporting in the latest plugin version, please also check your postgreSql error log if you can find it somewhere.

Regards,

Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
francisco
Regular
Posts: 42
Joined: Thu Jul 21, 2005 9:33 pm

Post by francisco »

garvinhicking wrote:I bet you're using postgreSQL, right? There might be once again some errors because of inserting "" instead of "0" or so.
Since I have much better control home installed 0.8.3 home.. numerous errors

Code: Select all

 Cannot use a scalar value as an array in /usr/home/www/backuptalk.com/include/functions.inc.php on line 126
[11-Aug-2005 21:27:47] PHP Warning:  Invalid argument supplied for foreach() in /usr/home/www/backuptalk.com/include/functions.inc.php on line 124
[11-Aug-2005 21:27:50] PHP Warning:  Invalid argument supplied for foreach() in /usr/home/www/backuptalk.com/include/functions.inc.php on line 124
[11-Aug-2005 21:29:23] PHP Warning:  pg_query(): Query failed: ERROR:  currval of sequence "serendipity_staticpages_id_seq" is not yet defined in this session in /usr/home/www/backuptalk.com/include/db/postgres.inc.php on line 83
[11-Aug-2005 21:29:23] PHP Warning:  pg_num_rows(): supplied argument is not a valid PostgreSQL result resource in /usr/home/www/backuptalk.com/include/db/postgres.inc.php on line 84
[11-Aug-2005 21:29:23] PHP Warning:  pg_last_oid(): supplied argument is not a valid PostgreSQL result resource in /usr/home/www/backuptalk.com/include/db/postgres.inc.php on line 88
[11-Aug-2005 21:29:23] PHP Warning:  Invalid argument supplied for foreach() in /usr/home/www/backuptalk.com/include/functions.inc.php on line 124
Static page used to work in PostgreSQL in 0.8.2 :-(
francisco
Regular
Posts: 42
Joined: Thu Jul 21, 2005 9:33 pm

Post by francisco »

Looked at my database log.
The problem is with

Code: Select all

INSERT INTO serendipity_staticpages 
(headline,permalink,pagetitle,content,markup,articleformat,articleformattitle,
authorid,parent_id,show_childpages,pre_content,pass,filename,is_startpage) 
values 
('test', '/index.php?/pages/test.html', 'test', 'test
test', '1', '1', 'Test Backup site :: ', '1', '0', 'X', '', '', 'plugin_staticpage.tpl','X' );
The 'X' => '' and those are the problems as far as I can tell.

Tried to take a look at serendipity_event_staticpage.php, but didn't see where the variables are initialized. That file sure could use a few comments.. :-)

I did like though...
// Code copied from include/admin/plugins.inc.php. Sue me. ;-)
francisco
Regular
Posts: 42
Joined: Thu Jul 21, 2005 9:33 pm

Post by francisco »

I would like to help fix this problem if anyone can share any pointers.
In particular where I find the area where the SQL statement is created.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

I'm sorry for getting back later to you. I marked your message on my todo-list though.

I havejust committed a new version of the plugin. It was a bit tricky where those "" values came from:

Code: Select all

        $q = "SELECT *
                FROM {$serendipity['dbPrefix']}staticpages
               WHERE id = " . (int)$id . "
               LIMIT 1";
        $page = serendipity_db_query($q, true, 'assoc');
        if (is_array($page)) {
            $this->staticpage =& $page;
            if (empty($this->staticpage['filename'])) {
                $this->staticpage['filename'] = 'none.html';
            }
            if (empty($this->staticpage['timestamp'])) {
                $this->staticpage['timestamp'] = time();
            }
            if (empty($this->staticpage['show_childpages'])) {
                $this->staticpage['show_childpages'] = '0';
            }
            if (empty($this->staticpage['is_startpage'])) {
                $this->staticpage['is_startpage'] = '0';
            }
        }
The last two if-things were needed to set empty values to an "0" string to catch up properly on pgsql!

Hope it works,
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
francisco
Regular
Posts: 42
Joined: Thu Jul 21, 2005 9:33 pm

Post by francisco »

Doesn't seem like it worked.
To make sure I did it right.
File serendipity_event_staticpage/serendipity_event_staticpage.php
The code change was to be in the function fetchStaticPage and looks like

Code: Select all

function &fetchStaticPage($id) {
        global $serendipity;

        $q = "SELECT *
                FROM {$serendipity['dbPrefix']}staticpages
               WHERE id = " . (int)$id . "
               LIMIT 1";
        $page = serendipity_db_query($q, true, 'assoc');
        if (is_array($page)) {
            $this->staticpage =& $page;
            if (empty($this->staticpage['filename'])) {
                $this->staticpage['filename'] = 'none.html';
            }
            if (empty($this->staticpage['timestamp'])) {
                $this->staticpage['timestamp'] = time();
            }
            #Changes for PostgreSQL
            if (empty($this->staticpage['show_childpages'])) { 
                $this->staticpage['show_childpages'] = '0'; 
            } 
            if (empty($this->staticpage['is_startpage'])) { 
                $this->staticpage['is_startpage'] = '0'; 
            }
        }
    }

And the error report from PostgreSQL

Code: Select all

INSERT INTO serendipity_staticpages 
       (headline,permalink,pagetitle,content,markup,articleformat,articleformattitle,authorid,parent_id,show_childpages,pre_content,pass,filename,is_startpage) 
values ('test', '/index.php?/pages/pagetitle.html', 'pagetitle', 'test', '1', '1', 'Test Backup site :: ', '1', '0', '', '', '', 'p     lugin_staticpage.tpl', '')
francisco
Regular
Posts: 42
Joined: Thu Jul 21, 2005 9:33 pm

Post by francisco »

Just to make sure I didn't misstype any part of the patch I downloaded 1.38 from webcvs.

Same error.
francisco
Regular
Posts: 42
Joined: Thu Jul 21, 2005 9:33 pm

Additional errors in static page?

Post by francisco »

While trying to troubleshoot the PostgreSQL issue for static page I had the PostgreSQL log and the php log open.

Upon entering the static page menu php reported

Code: Select all

Invalid argument supplied for foreach() in /usr/home/www/backuptalk.com/include/functions.inc.php on line 124
francisco
Regular
Posts: 42
Joined: Thu Jul 21, 2005 9:33 pm

Patch not getting executed

Post by francisco »

While trying to troubleshoot the patch I put
exit(print_r ("<br>$page<br>\n"));

Inside the if of
function &fetchStaticPage($id)

It doesn't seem like it was executed.

I then change the code to

Code: Select all

function &fetchStaticPage($id) {
        global $serendipity;

        $q = "SELECT *
                FROM {$serendipity['dbPrefix']}staticpages
               WHERE id = " . (int)$id . "
               LIMIT 1";
        $page = serendipity_db_query($q, true, 'assoc');
        exit(print_r ("<br>$page<br>\n")); <============ Note
Exit displays a 1 instead of an array.
Basically it seems the function expects a record to exists in the database, but there is none.

Was the install of the plugin supposed to create a default page?
If not then why is the code looking for a page?

[Edit]
Inserted a record manually. Trying to edit after that, crashes too..
A patch simmilar to the one done for insert needs to be done for the update code.

Also even after the record I inserted manually new inserts still fail in PostgreSQL with the same error... a couple of numeric fields still submited as ''
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Patch not getting executed

Post by garvinhicking »

Francisco, thank so much for getting into this problem. I really appreciate this! I have just committed version 2.11 of the plugin which adds a new $this->checkPage() function call. That function always checks important set parameters and sets them to int values, if unset.

Can you check if that works?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply