google-code-export / digitalus-cms

Automatically exported from code.google.com/p/digitalus-cms
1 stars 1 forks source link

Installing crashes apache #119

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When trying to do a clean install, apache crashes when getting to the
Digitalus_Installer_Database::_populate(), more specifically with the long
page content insert (starting with 'Congratulations!') and the xml content
insert.

This was occurring with PHP 5.3, apache 2.2.11 under Windows Vista.

It can be stopped with a rewrite of the _populate() method so that it uses
prepared statments, such as:

    private function _populate()
    {
        $queries = array(
            'INSERT INTO `content_nodes` VALUES (?, ?, ?, ?, ?, ?)' => array(
                array(1,  'page_1', 'content', null, null, 'Welcome to
Digitalus CMS'),
                array(2,  'page_1', 'tagline', 'en', null, 'About Digitalus'),
                array(3,  'page_1', 'content', 'en', null,
"Congratulations! You have successfully installed Digitalus CMS.<br>To get
started why don't you log in and change this page:<br><ol><li>Log in to
site administration with the username and password you set up in the
installer.</li><li>Go to the pages section.</li><li>Click on the Home page
on the left sidebar.</li><li>Now update it and click update
page!</li></ol>If you have any questions here are some helpful
links:<br><ul><li><a href=\"http://forum.digitaluscms.com\">Digitalus
Forum</a></li><li><a href=\"http://wiki.digitaluscms.com\">Digitalus
Documentation</a><br></li></ul>"),
                array(4,  'page_1', 'headline', 'en', null, 'Digitalus CMS'),
                array(5,  'page_1', 'teaser', 'en', null, ''),
                array(6,  'page_2', 'headline', 'en', null, 'HTTP/1.1 404
Not Found'),
                array(7,  'page_2', 'teaser', 'en', null, ''),
                array(8,  'page_2', 'content', 'en', null, 'Sorry, the page
you are looking for has moved or been renamed.'),
                array(9,  'page_3', 'headline', 'en', null, 'Site Offline'),
                array(10, 'page_3', 'teaser', 'en', null, ''),
                array(11, 'page_3', 'content', 'en', null, 'Sorry, our site
is currently offline for maintenance.')
            ),
            'INSERT INTO `data` VALUES (?, ?, ?)' => array(
                array(1, 'site_settings', "<?xml
version=\"1.0\"?>\n<settings><name>Digitalus CMS
Site</name><online>1</online><addMenuLinks>0</addMenuLinks><default_locale/><def
ault_language>en</default_language><default_charset>utf-8</default_charset><defa
ult_timezone>America/Los_Angeles</default_timezone><default_date_format/><defaul
t_currency_format/><default_email/><default_email_sender/><use_smtp_mail>0</use_
smtp_mail><smtp_host/><smtp_username/><smtp_password/><google_tracking/><google_
verify/><title_separator>
-
</title_separator><add_menu_links>1</add_menu_links><doc_type>XHTML1_TRANSITIONA
L</doc_type><home_page>1</home_page><page_not_found>2</page_not_found><offline_p
age>3</offline_page><meta_description/><meta_keywords/></settings>\n")
            ),
            'INSERT INTO `pages` VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?)' => array(
                array(1, 1, '1231952304', null, null, null, 'Home', '',
'content', 'default_default', null, 0, 2, 1, 1, null),
                array(2, 1, '1234630372', null, null, null, '404 Page', '',
'content', 'default_default', null, 0, 0, null, 0, null),
                array(3, 1, '1234630436', null, null, null, 'Site Offline',
'', 'content', 'default_default', null, 0, 1, null, 0, null)
            )
        );

        foreach ($queries as $sql => $inserts) {
            $stmt = $this->_db->prepare($sql);
            foreach ($inserts as $data) {
                $stmt->execute($data);
            }
        }
    }

Original issue reported on code.google.com by sussexwe...@gmail.com on 24 Jul 2009 at 9:14

GoogleCodeExporter commented 9 years ago
Hello webteam@sussex.ac.uk,

have a look here for more info on this subject:
http://community.digitaluscms.com/viewtopic.php?f=7&t=4&start=10

Cheers,
LowTower

Original comment by lowtower1974@gmail.com on 24 Jul 2009 at 11:38

GoogleCodeExporter commented 9 years ago
Hi LowTower,

I had read the forum post you indicated yesterday, but didn't see an issue 
report on
here so thought I should add one. :)  The original solutions with a foreach loop
doing inserts and then a couple standalone inserts after that didn't feel as 
'fluid'
(for want of a better word) as the prepared statements posted above (which I
accidentally posted under my work account - oops!)

Anyway; apologies for the duplication of a forum thread on the issue list. :)

Andy

Original comment by amnuts@gmail.com on 24 Jul 2009 at 12:42

GoogleCodeExporter commented 9 years ago

Original comment by lowtower1974@gmail.com on 25 Nov 2009 at 7:27