Results 1 to 14 of 14

Thread: [solved/repair] Error when installed for the first time

  1. #1
    New user
    Join Date
    06-23-10.
    Posts
    4

    Default [solved/repair] Error when installed for the first time

    Hi,

    i'm new to contao. After setting up the core system i added the gallery by using the extension system of contao. That's leads me to a total brick of the whole installation with the message "An error occurred while executing this script!" on both, back and front end.

    So i read the logs and found this:

    [23-Jun-2010 16:23:43] PHP Fatal error: Uncaught exception 'Exception' with message 'Query error: Table 'dbname.tl_gallery_comments' doesn't exist (SELECT * FROM tl_gallery_comments)' thrown in /usr/local/pem/vhosts/17081/webspace/httpdocs/system/libraries/Database.php on line 599
    While investigating the sql file i found out that these two instructions:
    -- --------------------------------------------------------

    --
    -- Table `tl_user_group`
    --

    CREATE TABLE `tl_user_group` (
    `galleries` blob NULL
    `galleryp` blob NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;


    -- --------------------------------------------------------

    --
    -- Table `tl_user`
    --

    CREATE TABLE `tl_user` (
    `galleries` blob NULL
    `galleryp` blob NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
    do not work (cause of missing "," after the first NULL).

    And i found out, that there is no command for creating the tabel tl_gallery_comments. Reading some threads i found out, that the system now should use tl_comments for the comments. Which leads me to the question why and where the tl_gallery_comments is used and what fields it has, that i can create it manually.

  2. #2
    Core developer
    Official Contao Team
    leo's Avatar
    Join Date
    06-04-09.
    Location
    Wuppertal, Germany
    Posts
    201

    Default Re: Error when installed for the first time

    What is the exact name of the extension and who is the developer?

  3. #3
    New user
    Join Date
    06-23-10.
    Posts
    4

    Default Re: Error when installed for the first time

    Hi,


    sorry, it's the gallery extension by thyon, http://www.contao.org/erweiterungsliste ... 09.de.html?

    (thought this was the forum for that )

  4. #4
    New user
    Join Date
    06-23-10.
    Posts
    4

    Default Re: Error when installed for the first time

    So i found the problem by myself, and cause i hate such threads ending like this, cause nobody can use it, i post what i did.


    first in the /languages/en/ there exists old lt_gallery_comments.php which is useless.

    In the runonce.php there can be found the following code
    Code:
     64 $objComment = $this->Database->execute("SELECT * FROM tl_gallery_comments");
    So after installing, this would kill it, cause the database.sql does not create a tl_gallery_comments table. As thyon mentioned in another thread, now the tl_comments should be used. The code should be changed to this:

    Code:
     64 < code deleted >;
    That does it for me.

    --

    EDIT: Sorry I had to edit this as your solution is completely wrong and will probably harm existing installations with comments. This has been fixed in the latest build. This code was to upgrade older gallery installations with existing comments to the new integrated comments system introduced in TL 2.8.

  5. #5
    New user BugBuster's Avatar
    Join Date
    09-27-09.
    Location
    Berlin, Germany
    Posts
    22

    Default Re: Error when installed for the first time

    Hi Thyon,
    You should check whether the table tl_gallery_comments exists.
    Not tested, but so it should work:
    Code:
    public function run()
    {
        if($this->Database->tableExists('tl_gallery_comments')
        {
    		// Gallery comments
    		$objComment = $this->Database->execute("SELECT * FROM tl_gallery_comments");
    
    		while ($objComment->next())
    		{
    			$arrSet = $objComment->row();
    			
    			$arrSet['source'] = 'tl_gallery';
    			$arrSet['parent'] = $arrSet['pid'];
    			unset($arrSet['id']);
    			unset($arrSet['pid']);
    		
    			$this->Database->prepare("INSERT INTO tl_comments %s")->set($arrSet)->execute();
    		}
        }
    }
    Best regards, BugBuster [contao.ninja]
    Modules: Banner, Visitors, Integrity Check, Stardate, Bot Detection, ...

  6. #6
    Experienced user
    Join Date
    06-11-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Error when installed for the first time

    I've already fixed this.

    This is for people who are upgrading, and yes, I forgot to put a test in.

    The runonce.php file has been updated to check if the old table exists, then checks for existing entries to prevent it from running twice and give you double comments. Once you see your old comments in the new Comments system, then you can safely remove the tl_gallery_comments table.

    PS Bug, that's not the only test, otherwise it might keep migrating, so I had to ALSO check for the presence of existing entries.

  7. #7
    Experienced user
    Join Date
    06-11-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Error when installed for the first time

    Unfortunately I've never been able to get the forum to send me a message correctly when people post. It seems that when they post 1 item, I get a message and then nothing until I check. That means I only ever see the first message post and not the ones after that... So now I just have to manually check if there are any forum posts in the forums I subscribe to -- a bit pointless...

  8. #8
    Core developer
    Official Contao Team
    leo's Avatar
    Join Date
    06-04-09.
    Location
    Wuppertal, Germany
    Posts
    201

    Default Re: [solved/repair] Error when installed for the first time

    This is a major defect in the module. If the table does not exist, the code in the runonce.php file will throw an Exception and stop the script execution. Since this also prevents the runonce.php file from being deleted, it will be called upon each and every following request (including the install tool), which means you cannot access Contao anymore.

    Database queries in the runonce.php file should always reside inside a try-catch block (see the Live Update scripts). To prevent such situations in the future, I have also added a general try-catch block to the core in r456. To fix the problem on your server, simply delete the system/runonce.php file via FTP.

  9. #9
    Experienced user
    Join Date
    06-11-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: [solved/repair] Error when installed for the first time

    Hey leo

    (1) there are no instructions or a developer's guide on how to construct a runonce.php file. I just had to figure it out myself using some of your code to upgrade the news system's comments.

    (2) there are no developer guides to help us migrate our extensions from a previous version to a new version, imagine the frustration -- an extension is pretty much stable and does exactly what it needs to do, then Contao releases a new version making the extension completely obsolete and then users complain. As a part-time developer, publishing work I do for clients as extensions, this is a major concern, because now all my extensions require re-work -- something I just don't have the time for.

    For example the TL 2.8 comment system changes was quite a feat to get going and remove old code and make it work with the new version. There was no guidelines or even just a few bullet tips on what to do, I just had to look at News and figure out what you did and try my best to copy it without screwing up.

    Now with TL 2.9, most extensions require quite a bit of work to make FE modules compatible, as their links no longer work (do=modules => do=themes), and that's only the first thing I noticed. There might be other things that I'm not even aware of. How do we verify that our extension is "compatible" -- there is no checklist to see that you did all the necessary changes...

    I know that it's going to take additional time, but writing out a quick list of bullets of major re-work changes/points will certainly help -- the changelog isn't going to help as it's not specific enough.

    (4) Also in Tl 2.8 you instroduced a template for the CE Gallery can called it gallery_default.tpl, so basically you "stole" the name from my extension that was available since TL 2.5.8 and since TL 2.8, people have been moaning that their galleries don't render, and then finally I figured this out. Then I had to rename ALL my template to gal_xxx.tpl, since I can't use the name you took for your internal CE anymore. See how a simple change can cause a major disruption.

  10. #10
    New user
    Join Date
    06-23-10.
    Posts
    4

    Default Re: [solved/repair] Error when installed for the first time

    Since it looks like there's no standard for installation routines, the installation should be checked before publishing a release as stable. This failure should be noticed by an isntallation on a clean system, and that should be part of the testing process.
    This also would help to keep database errors away. Maybe there should be one function for upgrade and one for installation and not both in one.
    Otherwise the extension should not be marked as stable, cause stable should mean "you can install and use without (major) errors, cause i tested as much as i could".

    (Sorry for my english, i'm not a nativ speaker)

  11. #11
    Experienced user
    Join Date
    06-11-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: [solved/repair] Error when installed for the first time

    well I did test it as much as I could, but you can't always think of everything

    ps. there is no upgrade/new function in the extension repository. we have to make the application do both.

  12. #12
    New user
    Join Date
    11-08-10.
    Posts
    2

    Default Re: [solved/repair] Error when installed for the first time

    This is a major defect in the module. If the table does not exist, the code in the runonce.php file will throw an Exception and stop the script execution. Since this also prevents the runonce.php file from being deleted, it will be called upon each and every following request (including the install tool), which means you cannot access Contao anymore.

    Database queries in the runonce.php file should always reside inside a try-catch block (see the Live Update scripts). To prevent such situations in the future, I have also added a general try-catch block to the core in r456. To fix the problem on your server, simply delete the system/runonce.php file via FTP.

  13. #13
    Experienced user
    Join Date
    06-11-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: [solved/repair] Error when installed for the first time

    Why are you reposting leo's response when this was fixed?

  14. #14
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: [solved/repair] Error when installed for the first time

    Why are you reposting leo's response when this was fixed?
    Because daviidwilson is actually some kind of robot/script, repeating posts in a thread :twisted:
    Can a mod please get rid of this user before it confuses everyone.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •