Posted by SweetCircus on May 22, 2012 at 3:46pm
16 followers
| Project: | SimpleAds |
| Version: | 7.x-1.8 |
| Component: | Code |
| Category: | bug report |
| Priority: | major |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I was having issues with the module, so I uninstalled it, and tried reinstalling (flushed all caches and stuff first). now none of the fields are being created in the database. attacehed is a screenshot of creating a new node with no fields.
Any idea what I can do?
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| Screen Shot 2012-05-22 at 11.42.05 AM.jpg | 57.57 KB | Ignored: Check issue status. | None | None |
Comments
#1
I should also note that none of the fields that the module is suppose to create is in the field list (reports/fieldlist) so I know that its not conflicting on install.
#2
Hi,
Please make sure that those fiels don't exists in the database. Run cron.
Alos you could try to install development version.
Thanks
#3
Hi Minnur,
Thanks for the suggestions, I have checked the DB, they do not exisit. I have run cron as well. I will try the development version now.
#4
Update: installing the dev version has added the fields back in, so that part is working. Now I am having an issue I was not having before I upgraded (not sure if its related).
I have a region (sidebar)
I have 3 differnt ad groups in the region:
sidebar top, sidebar middle, sidebar bottom.
The ads display (and rotate) fine in the top ad group, but nothing wil appear in the other two ad groups even though I have active ads in it.
Any suggestions?
#5
The same thing happened to me but it happened on first install. Everything seems to work fine except that the simpleads content type had no fields other than title and URL path settings. I have downloaded the dev version, done a complete uninstall, ran cron, cleared caches and reinstalled — still the same issue — no fields.
Any ideas?
#6
This is a real road blocker for me. I need to use this module — seems there's no alternative for D7. I'm totally willing to work with someone on getting to the bottom of this bug but I don't even know where to start looking. The install file looks fine and obviously it works for other people so I'm at a bit of a loss.
Any help would be greatly appreciated.
Josh
#7
Ok I finally have my issue sorted and I will record what happened here for other's sake and also because I believe there is still a bug.
On first install the fields didn't appear on the simple ad manage fields page or the field list page. However the database tables for the fields were created. When uninstalling the module the tables aren't deleted. When trying to turn the module back on again I was getting an error saying that 'field_ad_type table already exists' however the module page reported that the module was on but the fields still didn't show up on the fore mentioned pages.
So I think there are possibly two bugs: 1 where something goes wrong in install and 1 where the field tables aren't removed on uninstall.
What I did to fix this was:
- turn off the module
- uninstall
- run cron
- clear caches
- delete the Simple Ad field tables from the database (search in your db for all fields containing 'field_ad' will get them all— don't forget the revision tables)
- run cron
- clear caches
- reinstall module
This time it worked.
#8
Thanks Josh for the report and for this workaround. I will troubleshoot this problem.
#9
take care that the workaround at #7 is not a viable solution if simpleads is already in use and its tables are populated. see also #1571356: Error on latest Update.
please do :) and do not forget the update path from 7.x-1.7
#10
Provide more information (list of modules installed, version of Drupal).
I couldn't reproduce on my machine.
It would be really helpful if you guys could provide me with a DB dump and the code so I can troubleshoot more.
Over 400 sites upgraded their installation of SimpleAds module from 1.7 to 1.8 without any problems and I would like to identify what's different with your installation.
Thank you.
#11
I identified my problem: in simpleads.update.inc the code that sets the status of the existing ads did not filter ads from other node types. This means every node was loaded in memory, and this was killing the update with an out of memory error, leaving garbage in the db. To reproduce just try it on a 100k nodes db with php memory limit set at 128M :)
adding the following line let me update correctly
<?php// Set all published ads to be active.
$result = db_select('node', 'n')
->fields('n', array('nid'))
->condition('n.status', 1)
+ ->condition('n.type', 'simpleads')
->execute();
foreach ($result as $row) {
$node = node_load($row->nid);
$node->field_ad_status[$node->language][0]['value'] = 1;
node_save($node);
}
?>
#12
@xlyz, Good catch, thank you for finding this. (this is fixed in the development version).
#13
#14
So I updated this with the developmental version and I am still getting the same failed error.
The following updates returned messages
simpleads module
Update #7005
Failed: FieldException: Attempt to create field name field_ad_status which already exists and is active. in field_create_field() (line 85 of /var/www/vhosts/thelocalshottest.com/httpdocs/modules/field/field.crud.inc).
#15
I tried deleting the fields by finding them in the reports and I get an error, but it looks as though it deletes the fields. Then I tried running the db update. Same error. I tried deleting the fields and deleting them out of the mysql database, same error.
#16
Hi guys,
Can any of you please post some screenshots that show how the UI looks like when the module runs properly? I installed the dev version but still cannot find the fields you guys were talking about, and all I can see at http://localhost/node/add/simple-ad is the field of title. I know I sound like a fool, but I still don't quite understand how this module works actually. Any help would be appreicated.
Thanks you in advance!
#17
Hello everyone,
I just installed the dev version but the fields are not there. This is not a reinstallation and the dev is the only version I installed so far. I thought if I install the dev instad of 7.18 I should be fine but the fields still don't show up, which is basically the same as the screenshot attached to the initial issue report. However, the fields have been created in the db.
I followed the steps described at #7 but still not working.
Can anyone please tell me how to make it work?
Thanks!
#18
I had the same problem.
Here's step by step instructions on how to fix your site:
IF YOU HAVE ANY ADS SET TO INACTIVE THIS WILL SET THEM BACK TO ACTIVE.
Apply the fix as shown in comment #11 in simpleads.update.inc line 606 or use the dev version.
Run the following drush commands:
drush php-eval 'field_delete_field("field_ad_status"); field_purge_batch(100); echo "Deleted field_ad_status.\n"'drush -v updatedb
drush php-eval 'field_info_field("field_ad_status") !== NULL ? $str = "Everything is ok." : $str = "Something bad happened."; echo $str . "\n";'
Your site will now be up to date. However as in bold above any Simple Ads you had set to inactive will now be active again.
If the maintainer wishes I can write an update hook that will provide an upgrade path for effected users and keep their advert status data intact.
#19
Thanks Alan for the fix. I am sure others besides myself would greatly appreciate a patch for the issues that does not enable all our ads.
#20
Thanks alanmackenzie. It's so good to be updated with new response, finally.
#21
I agree with hoZt. It would be so much easier if there's a patch. I'm relatively new to drupal; I think I know how to patch a module but runing drush commands is something currently beyond me:)
#22
There's 3 possible scenarios:
simpleads_update_7005().simpleads_update_7005().simpleads_update_7005().This patch deals with all 3:
If you have previously run a broken version the end result will be:
Additionally in all cases
simpleads_update_7005()runs successfully, applying the changes that were in 1.8 but removed in the dev version.This patch is for the dev version if you're using the broken 7.x-1.8 version you will need to replace it before applying the patch.
@minnur, Please give me attribution with:
git commit --author="alanmackenzie <alanmackenzie@1045032.no-reply.drupal.org>"@hoZt, @DrupalDan, Please share the outcome of using this with the rest of the community.
#23
Needs Review.
#24
The last submitted patch, simpleads-fix-for-broken-update-hook-1594798-22.patch, failed testing.
#25
The above patch was for 7.x-1.x-dev. I don't know why the test bot didn't like it.
Here's a re-rolled version for 7.x-1.x.
#26
Alan, Thanks for the patch.
#27
@alanmackenzie, thanks for the patch. I just tried it but it seems that there's an error and the patch doesn't apply. Screenshot attached.
#28
@DrupalDan
What patch did you use #22 or #25?
What version of simpleads are you attempting to patch?
#22 is for 7.x-1.x-dev, i.e. the red dev release on the simpleads project page.
#25 is for unreleased HEAD of the 7.x-1.x branch.
Neither will work with the broken 1.7 release, writing a patch for that would mean it would be discarded after use and not fed back to the rest of the community.
#29
@alanmackenzie
Since I'm using the dev version I tried to patch #22.
#30
Thanks for this Dan.
It appears that the 7.x-1.x-dev branch is different from the released version (there's no tag?). Fortunately the patch in #24 works with the released version.
Here's the final mapping:
#31
Hi alan, thanks for letting me know this. The maping makes things very clear.
Since I'm using the 7.x-1.x-dev release (red release on the project page) I use #25 and I sucessfully patched the module. Unforunately, after I flush cache and run core, those fields are still missing. Screenshot attached for your information.
#32
#25 Did work for me. Thanks Alan for resolving this!
#33
I just tried to reinstall the module in case I miss anything. After I disabled, uninstalled the module, run core, clear cache, I tried to reinstall it. There is no error during the installation, but when I tried to enable it, I got the following error:
The website encountered an unexpected error. Please try again later.
at http://localhost/admin/modules/list/confirm.
But at the module page, the status of the module is enabled, but in db no field associatied with "ad_field" is there.
#34
@hoZt,
can you share a bit of the steps you make things work? After I patch the mdoule using git bash, i clear cache and run cron, and that didn't work. Did I miss anything?
Thanks!
#35
@Dan
Looks like your issue was with installation, not simply updating an already installed version - my patch fixes the updating issue.
My assumption is in your case the database tables were not properly created on installation thus not properly removed on uninstall. Unfortunately this is not something can be solved through a code fix. Drupal modules are supposed to leave existing database tables intact, writing something that touches them on installation might have an impact on other users in a bad way.
My advice would be to follow the steps in #7. If you don't have the skills to drop the database tables yourself I can either write a bash script or a drush command to do it and upload it here for you. Also note that you need to uninstall the module completely, not simply disable it.
#36
@alanmackenzie,
Thank you very much for everything. Yeah I agree with you that my current issue has something to do with the installation, not the patch. Well, perhaps I didn't make it clear eariler. Once I realized the patch doesn't work on my site, I assume that has something to do with my site. So I tried to unstall it so that I can reinstall it. To do so I disabled, uninstalled the module, and run cron and clear cache, and then I went to phpmyadmin searching for "field_ad". Two fields were found (screenshot attached) and I checked and drop them. Then I run cron and clear cache again.
After I reinstalled the module I tried to enable the module, but at that time the system throws me an error as described #33. I went back trying to enabling it again but at the module page I noticed that the module is already enabled. To make sure the fields are written into db, I went to check there (screenshot attached) and I think some fields are still missing.
I tried doing the same thing many times but same problem.
I just wonder why it throws me that error when enabling the module and how to fix this.
#37
@minnur,
can you share your thought or insight here regarding the issue?
#38
@DupalDan I am using the 7.18 version of simpleads and just downloaded the patch and applied it with the patch command. Then I did an update and it completed without any errors.
#39
Thank you guys for your help. I'm still working on enabling the module without any error. I tried again but still after enabling the module the system throws me that error. But this time I check the recent log message and I found this:
FieldException: Attempt to create field name field_ad_status which already exists and is active. in field_create_field() (line 85 of C:\wamp\www\modules\field\field.crud.inc).
This is very strange as before I reinstalled the module, I drop all of the tables related to this module including field_ad_status. And to be sure no tables are there before reinstallation I entered "field_ad_status" into the phpmyadmin filter box and it returns no result.
Any insight, please?
#40
#25: simpleads-fix-for-broken-update-hook-1594798-24.patch queued for re-testing.
#41
I also cannot get this module to work. I have installed uninstall I used the latest dev version and I still cannot get the module to create the necessary fields for the module. Please can someone assist me as this is really a critical issue cause this module is great and I don't want to use any other
#42
I can also not install this module successfully. the 1.8 version on Drupal 7.12: the module seems like it installs correctly but is never able to creates new content types. I tried both the dev and release versions.