#62 ✓resolved
Gustavo Carreno

Plugins do not register

Reported by Gustavo Carreno | April 14th, 2010 @ 03:31 AM | in 1.09

Version 1.05 ships with at least 3 plugins in there, but none show up.

I've even tried to edit the table by hand but it just gets wiped out.

Or is this on such an initial phase that it's just to "give a taste" ?

Comments and changes to this ticket

  • Gustavo Carreno

    Gustavo Carreno April 14th, 2010 @ 04:31 AM

    • State changed from “new” to “open”
    • Tag changed from bug, plugin-system to matt needs some sleep, bug, plugin-system
    • Milestone set to 1.06

    Oky I've got the solution for this.

    First you have to remove the NOT NULL from field plugins.config.

    Second, you have to change 'active'=>false to 'active'=>0 on line 34 of plugins_controller.php

    I've also added '.svn' and 'empty' to the array of files to ignore. Don't know if it makes a difference but heck, it won't harm.

    After that, all of the plugins register OK and can be activated.

  • Matt Curry

    Matt Curry April 14th, 2010 @ 04:59 AM

    Thanks. I keep forgetting my MySQL allows a field to be NOT NULL w/out a default, but that doesn't work for others.

  • Gustavo Carreno

    Gustavo Carreno April 14th, 2010 @ 05:14 AM

    No problem mate, that's why you have us Beta slaves^H^H^H^H^H^Htesters to get those weeds out :P

  • Anh Quang Do

    Anh Quang Do April 14th, 2010 @ 11:06 AM

    In my case I didn't do anything and 2 plugins show up: Boss Key Roulette and Open in New Window. Are there any more plugins expected to be there?

    By the way, the plugin system will rock. I can't wait to play around with my Twitter stream.

  • Matt Curry

    Matt Curry April 14th, 2010 @ 01:56 PM

    Uh...beta...yeah...

    Only 2 for now. 1.07's mark seen items as read will be a plugin.

  • Paul Willis

    Paul Willis April 14th, 2010 @ 02:18 PM

    Ditto "In my case I didn't do anything and 2 plugins show up: Boss Key Roulette and Open in New Window"

  • Gustavo Carreno

    Gustavo Carreno April 14th, 2010 @ 06:49 PM

    • Tag changed from matt needs some sleep, bug, plugin-system to bug, plugin-system

    Matt, could it be that because I'm using PHP 5.3.2 that the plugins did not register?

    Never the less it has something to do with either the datasource or something since 'active'=>true did not save well. With 0 it was ok.

    But now I'm baffled cuz don't really know if it was my MySQL or my PHP version :(

  • Matt Curry

    Matt Curry April 15th, 2010 @ 01:39 AM

    • State changed from “open” to “resolved”

    I think it's a MySQL thing. 1.06 update should fix plugins schema.

  • Gustavo Carreno

    Gustavo Carreno April 17th, 2010 @ 04:49 PM

    • Milestone changed from 1.06 to 1.10
    • State changed from “resolved” to “open”

    I'm reopening this one for the following reason:

    My plugins just get registered if I change this:

    function index() {
        //get list of plugins
        $plugins = $this->Plugin->find('all');
        $knownPlugins = Set::extract('/Plugin/path', $plugins);
    
        //check for new and remove deleted
        App::import('Core', 'Folder');
        $Folder = new Folder(Configure::read('Plugin.path'));
        $allPlugins = $Folder->read(true, array('.', 'find'));
        if (!empty($allPlugins[0])) {
            foreach($allPlugins[0] as $i => $newPlugin) {
                if (!in_array($newPlugin, $knownPlugins)) {
                    $NewPlugin = $this->Plugin->load($newPlugin);
                    $this->Plugin->create();
                    $this->Plugin->save(array('name' => $NewPlugin->name,
        'description' => $NewPlugin->description,
        'author' => $NewPlugin->author,
        'link' => $NewPlugin->link,
        'version' => $NewPlugin->version,
        'path' => $newPlugin,
        'active' => false)); <--------- Watch this line
                }
            }
        }
    

    to this:

    function index() {
        //get list of plugins
        $plugins = $this->Plugin->find('all');
        $knownPlugins = Set::extract('/Plugin/path', $plugins);
    
        //check for new and remove deleted
        App::import('Core', 'Folder');
        $Folder = new Folder(Configure::read('Plugin.path'));
        $allPlugins = $Folder->read(true, array('.', 'find'));
        if (!empty($allPlugins[0])) {
            foreach($allPlugins[0] as $i => $newPlugin) {
                if (!in_array($newPlugin, $knownPlugins)) {
                    $NewPlugin = $this->Plugin->load($newPlugin);
                    $this->Plugin->create();
                    $this->Plugin->save(array('name' => $NewPlugin->name,
                                'description' => $NewPlugin->description,
                                'author' => $NewPlugin->author,
                                'link' => $NewPlugin->link,
                                'version' => $NewPlugin->version,
                                'path' => $newPlugin,
                                'active' => 0)); <------ This one!!!
                }
            }
        }
    

    And I've only now took notice that I have 2, yes TWO more plugins since my upgrades to 1.07 and 1.08, meaning that I've missed one plugin on 1.07.

    If this is working with the False for you, is this something related to PHP 5.3.2 ????

  • Matt Curry

    Matt Curry April 18th, 2010 @ 12:30 AM

    • Milestone cleared.

    If you can a chance do you mind putting it back to false and then setting debug to 2 in /app/config/core.php, then checking the SQL queries that are run when you view the index? I'm interested to see if Cake is somehow messing this up or for whatever reason your MySQL install is different.

  • Gustavo Carreno

    Gustavo Carreno April 18th, 2010 @ 12:58 PM

    Yes ofc.
    Why didn't I think of it!?!?!
    Will do!!

  • Gustavo Carreno

    Gustavo Carreno April 19th, 2010 @ 09:26 AM

    Ok, got it at debug 2 and it looks like it's translating false and true to an empty string:

    SQL Error: 1366: Incorrect integer value: '' for column 'active' at row 1 [CORE\cake\libs\model\datasources\dbo_source.php, line 666]
    Query: INSERT INTO plugins (active, name, description, author, link, version, path, modified, created) VALUES ('', 'Boss Key Roulette', 'Press F9 to replace 20Couch with Google.com 99% of the time. The other 1%? Porn. Hardcore. Girl-on-girl-on-guy-on-bike-with-cup porn.', '20Couch', '20couch.com', '1.0', 'boss_key_roulette', '2010-04-19 09:19:03', '2010-04-19 09:19:03')

    It's also throwing an error when I try to deactivate any of them.
    It is the same problem.

    I've replaced all false and true by 0 and 1, everywhere in the PluginsController and it now works like a charm.

    Somehow Cake is not dealing with true and false as a 0 and 1 value for the active field.

  • Matt Curry

    Matt Curry April 20th, 2010 @ 02:38 AM

    Shoot. I think that field was created as a tinyint(4), but it should be a tinyint(1). Not sure how that happened. Try switching it and see if that fixes it. If so I'll include the update in the next release.

  • Gustavo Carreno

    Gustavo Carreno April 20th, 2010 @ 07:27 AM

    I was actually thinking about the size of the tiny int myself, but
    have been a tad busy in real life to actually go and investigate.
    I'm quite sure it will fix the issue, but I'll test it and give some
    feedback on it.

  • Gustavo Carreno

    Gustavo Carreno April 20th, 2010 @ 09:41 PM

    • State changed from “open” to “resolved”

    You were absolutely right, the change from size 4 to size 1 did the job.

    Can someone explain to me why I'm having these ODD issues. Do I have such a strange environment?

    I've been the "Extremely odd issue Beta Tester" for PHPEdit and even had a revision detect my license and pop-up a nice question just because I'm the douche that always gets entangled in very odd issues. Is this my Karma or I'm just in a very bad Mexican Soap opera?

    Why did it work for others? Can anyone give me a simple explanation?

  • Matt Curry

    Matt Curry April 22nd, 2010 @ 05:03 AM

    • Milestone set to 1.09
    • State changed from “resolved” to “open”
  • Matt Curry

    Matt Curry April 22nd, 2010 @ 05:04 AM

    Just checked my install and it generates the same insert query, with "" being the value for the active field. For some reason my MySQL doesn't balk. Either way, fixing that col to tinyint(1);

  • Matt Curry

    Matt Curry April 22nd, 2010 @ 05:06 AM

    • State changed from “open” to “resolved”
  • Gustavo Carreno

    Gustavo Carreno October 23rd, 2012 @ 03:31 PM

    • Milestone order changed from “0” to “0”

    LinkedIn

    I'd like to add you to my professional network on LinkedIn.

    • Gustavo

    Gustavo Carreno
    Senior PHP Developer at Self Employed
    Lancaster, United Kingdom

    Confirm that you know Gustavo Carreno:
    https://www.linkedin.com/e/98n5ei-h8n68vr0-4h/isd/9216547593/PE3zPc...

    -- You are receiving Invitation to Connect emails. Click to unsubscribe:
    http://www.linkedin.com/e/98n5ei-h8n68vr0-4h/pk08WqwxIC5-6XK_AFfH3s...

    (c) 2012 LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Shared Ticket Bins

People watching this ticket

Pages