Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Problem with pictures (avatars and uploads)

12346»

Comments

  • meshugymeshugy Musician/Hacker ✭✭

    Thanks @River

    I already tried turning off all the plugins except Advanced Editor and it still wouldn't process Thumbnails correctly. I just increased my memory limit all the way to 512MB and it still doesn't work. Do you have any other ideas what may be wrong? I had this same problem with FileUpload and the change that @peregrine suggested above made it work. I wonder if that can be adapted to Advanced Editor.

  • RiverRiver MVP
    edited August 2016

    @meshugy said:
    Thanks @River

    Do you have any other ideas what may be wrong?

    yes. will pm you.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • RiverRiver MVP
    edited August 2016

    meanwhile you can run /utility/structure, utility/update and delete the ini files in your cache folder.

    I need you to set debug again.

    https://github.com/vanilla/vanilla/blob/master/plugins/editor/class.editor.plugin.php#L1432

            $model->save(array(
                'MediaID' => $media_id,
                'ThumbWidth' => $thumb_width,
                'ThumbHeight' => $thumb_height,
                'ThumbPath' => $filepath_parsed['SaveName']
            ));
            // Remove cf scratch copy, typically in cftemp, if there was actually a file pulled in from CF.
            if (strpos($local_path, 'cftemp') !== false) {
                if (!unlink($local_path)) {
                    // Maybe add logging for local cf copies not deleted.
                }
            }
            $url = $filepath_parsed['Url'];
        } else {
    

    to

            // Save thumbnail information to DB.
            $model->save(array(
                'MediaID' => $media_id,
                'ThumbWidth' => $thumb_width,
                'ThumbHeight' => $thumb_height,
                'ThumbPath' => $filepath_parsed['SaveName']
            ));
    
    
        //debuglog
                       ob_start();
            decho($filepath_parsed);
            $Result = ob_get_clean();
            LogMessage(__FILE__,__LINE__,'Object','Method', "saveinfo" .  $thumb_width .$thumb_height  .$Result ); 
    
    
            // Remove cf scratch copy, typically in cftemp, if there was actually a file pulled in from CF.
            if (strpos($local_path, 'cftemp') !== false) {
                if (!unlink($local_path)) {
                    // Maybe add logging for local cf copies not deleted.
                }
            }
            $url = $filepath_parsed['Url'];
    
    
        //debuglogagain.
                       ob_start();
            decho($filepath_parsed);
            $Result = ob_get_clean();
            LogMessage(__FILE__,__LINE__,'Object','Method', "afterlocal" .  $thumb_width .$thumb_height  .$Result ); 
    
        } else {
    

    also keep the backup original of class.model.php

    https://github.com/vanilla/vanilla/blob/master/library/core/class.model.php#L244

        public function save($FormPostValues, $Settings = false) {
    
            // Define the primary key in this model's table.
            $this->defineSchema();
            // See if a primary key value was posted and decide how to save
            $PrimaryKeyVal = val($this->PrimaryKey, $FormPostValues, false);
            $Insert = $PrimaryKeyVal == false ? true : false;
            if ($Insert) {
                $this->addInsertFields($FormPostValues);
            } else {
                $this->addUpdateFields($FormPostValues);
            }
            // Validate the form posted values
            if ($this->validate($FormPostValues, $Insert) === true) {
                $Fields = $this->Validation->validationFields();
                $Fields = $this->coerceData($Fields, false);
                unset($Fields[$this->PrimaryKey]); // Don't try to insert or update the primary key
                if ($Insert === false) {
                    $this->update($Fields, array($this->PrimaryKey => $PrimaryKeyVal));
                } else {
                    $PrimaryKeyVal = $this->insert($Fields);
                }
            } else {
                $PrimaryKeyVal = false;
            }
            return $PrimaryKeyVal;
        }
    

    to

        public function save($FormPostValues, $Settings = false) {
                    //debuglogagain.
                               ob_start();
                    decho($FormPostValues);
                    $Result = ob_get_clean();
                    LogMessage(__FILE__,__LINE__,'Object','Method', "modelpost"   .$Result ); 
    
                    // Define the primary key in this model's table.
                    $this->defineSchema();
                    // See if a primary key value was posted and decide how to save
                    $PrimaryKeyVal = val($this->PrimaryKey, $FormPostValues, false);
                    $Insert = $PrimaryKeyVal == false ? true : false;
                    if ($Insert) {
                        $this->addInsertFields($FormPostValues);
                    } else {
                        $this->addUpdateFields($FormPostValues);
                    }
                    // Validate the form posted values
                    if ($this->validate($FormPostValues, $Insert) === true) {
                        $Fields = $this->Validation->validationFields();
                        $Fields = $this->coerceData($Fields, false);
                        unset($Fields[$this->PrimaryKey]); // Don't try to insert or update the primary key
                        if ($Insert === false) {
                            $this->update($Fields, array($this->PrimaryKey => $PrimaryKeyVal));
                        } else {
                            $PrimaryKeyVal = $this->insert($Fields);
                        }
                    } else {
                        $PrimaryKeyVal = false;
                    }
    
         //debuglogagain.
                    ob_start();
                    decho($PrimaryKeyVal);
                    $Result = ob_get_clean();
                    LogMessage(__FILE__,__LINE__,'Object','Method', "insert-" . $Insert . "-model -key"   .$Result ); 
    
    
                   ob_start();
                    decho($Fields);
                    $Result = ob_get_clean();
                    LogMessage(__FILE__,__LINE__,'Object','Method', "model - fields"   .$Result ); 
    
                    return $PrimaryKeyVal;
                }
    

    after you make the above changes.

    start a new discussion. add the word "Test" and upload a png image. leave the discussion intact. don't delete it.
    upload a small png with about 640 x 640 footprint.

    repeat and start a second discussion add the word "Test2" and upload a jpg image. leave the discussion intact. don't delete it. upload a small jpg with about 640 x 640 footprint

    leave the discussions intact.

    then restore your original files after the test.

    ZIP up your debuglog and post it as an attachment. PLEASE zip it.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • RiverRiver MVP
    edited August 2016

    also clear your ini files in cache. and remove all the plugins in your plugin folder that you are no longer using that are not part of the core.

    you have quite a few mapped to broken plugins and plugins that don't work with 2.1 or 2.2.1

    you need to clean up all the junk, and it will be easier to work effectively.

    zip up the fileupload plugin and delete the fileupload folder. do the same for Aeliafoundation , logger and any other plugin that you don't use, and don't keep broken plugins lying around, they usually create hard to solve problems. Just remove them from your plugins folder.

    also you could remove NeoLogger at least until this is solved.

    after the clean up above.

    disable all your other plugins and apps except vanilla and advanced editor. make sure Yaga and discussionpolls are disabled

    delete the ini files.

    repeat the above test https://vanillaforums.org/discussion/comment/242813/#Comment_242813

    be detailed about what you did and follow the instructions.

    also do what I sent you in the pm.

    make sure you disable plugins and apps via the dashboard NOT by editing the config file.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • RiverRiver MVP
    edited August 2016

    @meshugy

    after you clean up and get rid of the plugins that you no longer need by deleting them from the plugin folder (don't touch the core plugins.), upgrade the plugins that you are using, you are using old versions of plugins as well.

    here is a list of core plugins

    https://github.com/vanilla/vanilla/tree/Vanilla_2.2.1/plugins

    if it is not a core plugin AND you are not using a plugin that is not a core plugin - best to delete it from your plugins folder.\

    the debuglog should alow us to zero in on problem why media model is not updating table. cache issue, replacement issue, variables not set, overwriting, related json, sql issue.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • RiverRiver MVP
    edited August 2016

    I made a mistake with the save in the model (used master instead of 2.2.1

    so use this instead. all the other info I still need as specified. everything else remains the same except this change

    the debug portion for the model is as follows:

    https://github.com/vanilla/vanilla/blob/Vanilla_2.2.1/library/core/class.model.php#L185

    change

     public function save($FormPostValues, $Settings = false) {
            // Define the primary key in this model's table.
            $this->defineSchema();
    
            // See if a primary key value was posted and decide how to save
            $PrimaryKeyVal = val($this->PrimaryKey, $FormPostValues, false);
            $Insert = $PrimaryKeyVal == false ? true : false;
            if ($Insert) {
                $this->addInsertFields($FormPostValues);
            } else {
                $this->addUpdateFields($FormPostValues);
            }
    
            // Validate the form posted values
            if ($this->validate($FormPostValues, $Insert) === true) {
                $Fields = $this->Validation->validationFields();
                $Fields = removeKeyFromArray($Fields, $this->PrimaryKey); // Don't try to insert or update the primary key
                if ($Insert === false) {
                    $this->update($Fields, array($this->PrimaryKey => $PrimaryKeyVal));
                } else {
                    $PrimaryKeyVal = $this->insert($Fields);
                }
            } else {
                $PrimaryKeyVal = false;
            }
            return $PrimaryKeyVal;
        }    
    

    to

    public function save($FormPostValues, $Settings = false) {
    
                          //debuglogagain.
                               ob_start();
                    decho($FormPostValues);
                    $Result = ob_get_clean();
                    LogMessage(__FILE__,__LINE__,'Object','Method', "modelpost"   .$Result ); 
    
    
    
            // Define the primary key in this model's table.
            $this->defineSchema();
    
            // See if a primary key value was posted and decide how to save
            $PrimaryKeyVal = val($this->PrimaryKey, $FormPostValues, false);
            $Insert = $PrimaryKeyVal == false ? true : false;
            if ($Insert) {
                $this->addInsertFields($FormPostValues);
            } else {
                $this->addUpdateFields($FormPostValues);
            }
    
            // Validate the form posted values
            if ($this->validate($FormPostValues, $Insert) === true) {
                $Fields = $this->Validation->validationFields();
                $Fields = removeKeyFromArray($Fields, $this->PrimaryKey); // Don't try to insert or update the primary key
                if ($Insert === false) {
                    $this->update($Fields, array($this->PrimaryKey => $PrimaryKeyVal));
                } else {
                    $PrimaryKeyVal = $this->insert($Fields);
                }
            } else {
                $PrimaryKeyVal = false;
            }
    
         //debuglogagain.
                        ob_start();
                        var_dump($PrimaryKeyVal);
                        $Result = ob_get_clean();
                        LogMessage(__FILE__,__LINE__,'Object','Method', "PrimaryKeyVal is"   .$Result ); 
    
                        ob_start();
                        var_dump($Insert);
                        $Result = ob_get_clean();
                        LogMessage(__FILE__,__LINE__,'Object','Method', "Insert is"   .$Insert ); 
    
    
                       ob_start();
                        decho($Fields);
                        $Result = ob_get_clean();
                        LogMessage(__FILE__,__LINE__,'Object','Method', "model - fields"   .$Result ); 
                        return $PrimaryKeyVal;
    
    
            return $PrimaryKeyVal;
        }
    
    
    
    take your time cleaning up folder, deleting plugins, and following directions. Do your best to post everything requested,  or give reason why you won't.   and leave your test discussions intact.
    

    check for errors in error log and check for js console errors, and if you have some kind of caching enabled let me know.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • RiverRiver MVP
    edited August 2016

    @vrijvlinder said:
    Check your php version ?

    good idea, and provide phpinfo() resullts

    @meshugy

    if you are running sql in strict mode, you might disable - could be the potential cause of your issue with the update, if the 3 thumb fields are set in model save update (as opposed to the first insert) but not in the table.

    • check for errors in error log and check for js console errors (which you have).
    • a link to your phpinfo() results
    • posting of config.php with passwords and salts and emails removed.
    • screenshots of the media table for the media id that is not updating in your next attempt.
    • disable broken plugins which you have enabled.
    • remove unused non-core plugins, especially plugins that are not compatible with 2.2.1 (which you have).

    you might change

     LogMessage(__FILE__,__LINE__,'Object','Method', "Insert is" .$Insert ); 
    

    to

    LogMessage(__FILE__,__LINE__,'Object','Method', "Insert is" .$Result );

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

Sign In or Register to comment.