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?

Comments

Bcwald’s picture

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.

minnur’s picture

Hi,
Please make sure that those fiels don't exists in the database. Run cron.
Alos you could try to install development version.

Thanks

Bcwald’s picture

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.

Bcwald’s picture

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?

sonictruth’s picture

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?

sonictruth’s picture

Priority: Normal » Critical

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

sonictruth’s picture

Priority: Critical » Normal

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.

minnur’s picture

Thanks Josh for the report and for this workaround. I will troubleshoot this problem.

xlyz’s picture

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.

I will troubleshoot this problem.

please do :) and do not forget the update path from 7.x-1.7

minnur’s picture

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.

xlyz’s picture

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

  // 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);
  }
minnur’s picture

@xlyz, Good catch, thank you for finding this. (this is fixed in the development version).

minnur’s picture

Assigned: Unassigned » minnur
Status: Active » Needs work
mapruter’s picture

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).

mapruter’s picture

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.

DrupalDan’s picture

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!

xs102758’s picture

Version: 7.x-1.8 » 7.x-1.x-dev

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!

alanmackenzie’s picture

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.

hozt’s picture

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.

DrupalDan’s picture

Thanks alanmackenzie. It's so good to be updated with new response, finally.

DrupalDan’s picture

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:)

alanmackenzie’s picture

There's 3 possible scenarios:

  1. The user ran a broken simpleads_update_7005().
  2. The user has never run simpleads_update_7005().
  3. The user fixed it themselves and successfully ran simpleads_update_7005().

This patch deals with all 3:

  1. If they've previously attempted to run it and failed we detect that and clean-up.
  2. If they've never run it before then it will now work first time, clean-up code is ignored.
  3. If the user has successfully run 7005 before then Drupal will prevent it from being run again.

If you have previously run a broken version the end result will be:

  • All published simplead nodes will be set to active, unless they were previously set inactive.
  • All unpublished simplead nodes are left at the default inactive.

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.

alanmackenzie’s picture

Status: Needs work » Needs review

Needs Review.

Status: Needs review » Needs work

The last submitted patch, simpleads-fix-for-broken-update-hook-1594798-22.patch, failed testing.

alanmackenzie’s picture

Status: Needs work » Needs review
StatusFileSize
new2.73 KB

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.

minnur’s picture

Alan, Thanks for the patch.

DrupalDan’s picture

StatusFileSize
new7.4 KB

@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.

alanmackenzie’s picture

@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.

DrupalDan’s picture

@alanmackenzie

Since I'm using the dev version I tried to patch #22.

alanmackenzie’s picture

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:

  • 7.x-1.x-dev branch (git) use patch #22
  • 7.x-1.x-dev release (red release on the project page) use patch #25
  • 7.x-1.x branch (git) use patch #25
DrupalDan’s picture

StatusFileSize
new24.19 KB

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.

hozt’s picture

#25 Did work for me. Thanks Alan for resolving this!

DrupalDan’s picture

Assigned: alanmackenzie » Unassigned

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.

DrupalDan’s picture

@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!

alanmackenzie’s picture

Assigned: Unassigned » alanmackenzie

@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.

DrupalDan’s picture

StatusFileSize
new12.01 KB
new7.18 KB

@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.

DrupalDan’s picture

Assigned: alanmackenzie » Unassigned

@minnur,

can you share your thought or insight here regarding the issue?

hozt’s picture

@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.

DrupalDan’s picture

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?

oscar_arnulfo’s picture

vip_sa’s picture

Priority: Normal » Major
Status: Needs review » Active

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

Cadyfatcat’s picture

Version: 7.x-1.x-dev » 7.x-1.8

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.

nquoctuan’s picture

It is failed. I have the same problem like you guys, eventhrough I already installed the path #25.
Please someone give me advice to fix this problem.

nquoctuan’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, simpleads-fix-for-broken-update-hook-1594798-24.patch, failed testing.

harmonyhalo’s picture

I'm having a similar problem (using 7.22), I'm working in my local environment and upon initial installation of the 7.x-1.8 stable release i had no image field for the simplead content type - only the title field and an option to select the campaign type.
I uninstalled, cleared the cache, ran cron and update.php and tried to reinstall but no matter which version i try to install, the 7.x-1.x-dev or the 7.x-2.x-dev release i keep getting the following error "DatabaseSchemaObjectExistsException: Table simpleads_impressions already exists..."
this is after i've gone into the databse and searched for all references to simplead in the title and deleted these. but for some reason it just won't take. If i do manage to get it installed After the error message) it is always missing the fields.
Any ideas would be much appreciated?
Thanks in advance

ps. for the record, i tested this on a different machine but i chose to install the 7.x-2.x-dev release initially, and then i uninstalled it and tried to reinstall once more (following all the previous steps) and i ran into the same problem.

koffer’s picture

Terrible! I install the module in a new site and dont work! I believe is a problem with versions of drupal. I a site with 7.17 the module work. In the new site with 7.23 dont. Right now we dont have options to run a system of ads in drupal 7

sui_page’s picture

I've search everywhere and have tried various methods to get this working with current version of Dupral 7 to no success. It seems like a really good module but I just need it to work. Has anyone got this working recently?

Ravi Devnani’s picture

Title: Reinstall module does not create the fields for content type » Reinstallation
Version: 7.x-1.8 » 7.x-2.x-dev
Issue summary: View changes
Issue tags: +simpleads database module update

I have gone through every step posted online and tested to see if I could get simpleads to work on the latest version of drupal 7. I can install it on a clean installation fine, but initializing the module within an large site has had many complications. I followed the process from post #7, which did not work. I have ended up reviewing the .install file for database tables and content that is installed that would need to be removed.

One thing that could be problematic is that initially the site had Simpleleads 1.8 installed and disabled. Then was upgraded to 2.x dev.

I went in excess of searching the database for any entry (word association) to simpleads, and found many other aspects where the core system still retained links for "add content" and other entries. I removed everything I could find to see if I could either crash the site, or or successfully remove the module to reinstall. I honestly don't remember how many times I have done this, but the last attempt seemed to be semi functional.

  • Add new content "links" for all three features work
  • One form has problems with inserting content within a table (notes later on)

Notes
Here are the current errors that I am seeing.


FieldException: Attempt to create field name field_ad_type which already exists and is active. in field_create_field() (line 85 of /home/duprisin/public_html/modules/field/field.crud.inc).

FieldException: Attempt to create field name field_adcamp_list which already exists and is active. in field_create_field() (line 85 of /home/duprisin/public_html/modules/field/field.crud.inc).

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'duprisin_3dsync.field_revision_field_ad_ad_image' doesn't exist: INSERT INTO {field_revision_field_ad_ad_image} (entity_type, entity_id, revision_id, bundle, delta, language, field_ad_ad_image_fid, field_ad_ad_image_alt, field_ad_ad_image_title, field_ad_ad_image_width, field_ad_ad_image_height) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 382 [:db_insert_placeholder_2] => 382 [:db_insert_placeholder_3] => advertisements_promotions [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => 408 [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => 540 [:db_insert_placeholder_10] => 712 ) in field_sql_storage_field_storage_write() (line 495 of /home/duprisin/public_html/modules/field/modules/field_sql_storage/field_sql_storage.module).


I am hesitant to start over with more aspects of this working than prior. I am not sure, but it seems the next best step is to manually create the table (if need be) and create the missing columns. I wanted to see if anyone else had been successful in this approach or had any advice.
Ravi Devnani’s picture

Title: Reinstallation » Reinstallation Solved
Issue tags: -simpleads database module update +simpleads database module update 1.8 - 2.x

After many re-installations of the Database, I finally was able to install a working version of "SimpleAds 2.x" from "SimpleAds 1.8" .

How I was able to enable this module.

The way that worked was following the steps from #7 entry. Though previously I was never able to view the "SimpleAds" module on the "Uninstall" page of "Modules" administration, so I never was able to allow Drupal 7's core system to go through the uninstall procedure. So I re-installed SimpleAds 1.8 (there were errors, but refreshing the modules page showed a check mark after the modules semi-successful re-installation), I installed each aspect of the module individually; advertisement, then campaign module. Then I "Uninstalled" the same set of modules by unchecking the module and saving (two steps, campaign then advertisement {core module}), I did clear the cache after each stage was completed.

Finally, this allowed for Drupal's core system to list the "SimpleAds" module on the "Unistall" page. This removes all of the various database entries that configure page like "content add", "add advertisment", and "add campaign". So that the two varying database for systems within the "SimpleAds" 1.8 when converting to 2.x did not have any conflicting entries.

(note: After being able to uninstall the module through "modules" uninstall page, I did not have to remove any entries from the database manually. All searches for "simple" and "_ad" returned nothing relevant)

Installing 2.x, I installed each module individually and the system was back up and running.

The last submitted patch, 25: simpleads-fix-for-broken-update-hook-1594798-24.patch, failed testing.

avpaderno’s picture

Issue tags: -simpleads database module update 1.8 - 2.x
minnur’s picture

Status: Needs work » Closed (won't fix)
avpaderno’s picture

Title: Reinstallation Solved » Reinstalling the module does not create the content type fields