After installing the apps module and the level ten app server, I tried installing the social media app - it downloaded 2 components. Unpon installing/activating those, my system popped up an error message about duplicate entries for some .png files - and then the message that is the subject of this issue appears on the "apps" tab in my drupal install.

this is a completely unhelpful message as there is no way to trouble shoot.

CommentFileSizeAuthor
#12 correct_pdo_error-12-1830680.patch517 byteswadmiraal

Comments

letapjar’s picture

Title: The website encountered an unexpected error. Please try again later. » PDOException SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry

Here is the error message I found in the logs:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://apps/webform_screenshot_27.png' for key 'uri': UPDATE {file_managed} SET uid=:db_update_placeholder_0, filename=:db_update_placeholder_1, uri=:db_update_placeholder_2, filemime=:db_update_placeholder_3, filesize=:db_update_placeholder_4, status=:db_update_placeholder_5, timestamp=:db_update_placeholder_6 WHERE (fid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => 1 [:db_update_placeholder_1] => webform_screenshot.png [:db_update_placeholder_2] => public://apps/webform_screenshot_27.png [:db_update_placeholder_3] => image/png [:db_update_placeholder_4] => 7390 [:db_update_placeholder_5] => 1 [:db_update_placeholder_6] => 1352065850 [:db_condition_placeholder_0] => 61 ) in drupal_write_record() (line 7036 of [/my/drupal/install]/includes/common.inc).

letapjar’s picture

I ended up fixing the issue for myself by manually editing the files_managed table to remove the records with uri key like "public://apps/webform_%"

I hope this does not happen every time an app is installed - for a module marked as release candidate - this is a major bug as far as the user experience goes.

bcobin’s picture

Confirmed here - this is really bogus. Disabling the module until there's a fix here.

vintorg’s picture

I've had this on multiple client sites. The app is unusable.

Graham_W’s picture

Me too.
Took a while to pin it down to this module. What gave it a way was an accidental click on the 'App' button on the admin menu which triggered the above error message.
Can't see much evidence on Level Ten's website that they are pursuing this potentially useful concept. Uninstalled.

jedsmith13’s picture

The fix in #2 worked for me as well.

vintorg’s picture

It works, but you have to do it for every time you get into it.

koosjr’s picture

I had the same issue this morning. It opened fine the first time until I installed SEO Tools. There after the error message.

Luckily, I am now a day old rookie to Drupal so I am just playing at the moment to get the feel and eliminate apps that does not gel. However, I will stick around here for a while. This SEO tools seems powerful.

eric_sea’s picture

Multiple Notices: Undefined property: stdClass::$uri in file_save() (line 566 of .../public_html/includes/file.inc). Working on clean/updated D7 install. Fix 2 ^^ seems to work but as reported the process need to be repeated with use. Also experiencing issues with Warning: Illegal offset type in _widgets_error() http://drupal.org/node/1468030 and applied patch http://drupal.org/node/1468030#comment-6448130.

rhyan’s picture

I fix mine by deleting the records in my file_managed like public://apps/

same as letapjar

wadmiraal’s picture

Actually, this would almost seem like a Drupal Core issue. The Apps module does use the File API correctly. It seems, though, that Apps triggers an edge case that was not planned.

For now, I corrected the issue on my side by correcting the Apps module (not LevelTen apps) by commenting a line:

// Function apps_retrieve_app_image() in file apps.manifest.inc

$file = file_save_data($request->data, $uri, FILE_EXISTS_RENAME);
if ($current) {
  //$file->fid = $current->fid; <- Comment this line. This will prevent Apps from updating an existing file, creating new ones instead.
}
$file->title = $title ? $title : '';

This solves the PDOException error. And you don't need to manually remove entries from the DB.

wadmiraal’s picture

StatusFileSize
new517 bytes

Here's a patch that solves it (for now).

stevenfaraday’s picture

I installed correct_pdo_error-12-1830680.patch and it seems to take care of getting the LevelTen apps to work correctly. However, I am left w/ a single error message and I'm not sure why. It doesn't appear to interfere w/ anything (as far as I can tell), but I would still like to clear the error. Here is the error:

Notice: Undefined index: last-modified in apps_retrieve_app_image() (line 259 of /home4/steveoh3/public_html/sites/all/modules/apps/apps.manifest.inc).

There are no other errors.

elkiwi’s picture

#2 Worked for me too. Thanks letapjar.

chris pergantis’s picture

webform_screenshot_40.png

I am not sure what the files that are being created are for? I have over 70 of them after a clean up from a week ago. The ones with webform_screenshot_## show up in the media library as non images. The others are numerous and seem to have some naming affinity to modules and nodes within the site. None of them are actually PNG images; or if they are supposed to be, the format is corrupted according to my image editor. They all reside within the /sites/default/files/app/

I will apply the patch suggested but may I ask "Are these being generated on purpose? If so for what purpose?" Understanding their format or purpose could be valuable in determining the trouble but especially the resolution.

Thanks for the patch letapjar.