Family & Friends | Mittineague Park | Home | Walk Photos | Wildflowers | Scripting | Sitemap | Blog | Contact |
Mittineague.com Home Mittineague
Welcome to the Mittineague Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Clean Options warning message
Goto page 1, 2  Next
 
Posting is closed between 03:00:00 and 06:00:00 (GMT - 4 Hours)
Post new topic   Reply to topic    Mittineague Forum Index -> WordPress
View previous topic :: View next topic  
Author Message
Lok52
Newcomer Level I
Newcomer Level I



Joined: 04 Feb 2009
Posts: 16
Location: NW Ohio

PostPosted: February 04 2009, 17:10    Post subject: Clean Options warning message Reply with quote

I got this warning message when I ran the Clean Options plugin.

Code:
Warning: Invalid argument supplied for foreach() in /homepages/30/d155136878/htdocs/brincefieldinfo/blog/wp-content/plugin s/clean-options/cleanoptions.php on line 500


It still found and deleted a bunch of junk from old plugins, so I am certainly happy about that. But I didn't know if this was the symptom of something else wrong.
Back to top
View user's profile Send private message
Mittineague
Site Admin
Site Admin



Joined: 04 Jul 2006
Posts: 68
Location: West Springfield, Massachusetts

PostPosted: February 04 2009, 19:31    Post subject: invalid argument error Reply with quote

Hi Lok52, welcome and thanks for bringing this to my attention.

Are you using plugin version 1.1.0 ?

I have heard of this error from a few users, but had hoped I fixed things in the latest version by explictly asking the DB function to return an array instead of an object.

The line number 500 indicates that the error is in the function that finds the "rss_hash" options by finding rows WHERE the autoload field is not equal to yes. The get_results() query should now be returning an array unless the passed $query argument doesn't exist, in which case it returns NULL. This would break the plugin code, so I can add a conditional to ensure the return value is an array before entering the foreach loop. But the only possible way I can think of for the $query to not exist might be if your database prefix contains a quote, it doesn't does it?
Back to top
View user's profile Send private message
Lok52
Newcomer Level I
Newcomer Level I



Joined: 04 Feb 2009
Posts: 16
Location: NW Ohio

PostPosted: February 04 2009, 22:09    Post subject: Re: Clean Options warning message Reply with quote

I don't know. Tell where to look and I can check. But I could barely follow what you were saying there, and didn't really understand it, so make it simple. Laughing
Back to top
View user's profile Send private message
Mittineague
Site Admin
Site Admin



Joined: 04 Jul 2006
Posts: 68
Location: West Springfield, Massachusetts

PostPosted: February 05 2009, 18:31    Post subject: version and db prefix Reply with quote

The version of the plugin should be shown next to it's name on the plugins CP page. It's also in the plugin file's comments
Code:
/*
Plugin Name: Clean Options
Plugin URI: http://www.mittineague.com/dev/co.php
Description: finds orphaned options and allows for their removal from the wp_options table
Version: 1.1.0 RC
Author: Mittineague
Author URI: http://www.mittineague.com
*/
and the readme file's top version
Code:
== Version History ==
1.1.0 RC 27-Jan-2009   
- limit 'delete all' rss delete to < 100 highest id 
- added rss_ hash limited find 
- fixed and updated the $known_ ok array 
- improved robustness 
- - fixed searchdir() return type initialization 
- - set explicit return type in $wpdb->get_results queries 
- - ini_ get('safe_ mode') fixes 
- changed found rss_ hash options section 
- added javascript select/deselect all 
- various other minor tweaks 


As for your WordPress database prefix, the default is "wp_", but for better security it can be changed. If you look in your wp-config.php file, you'll see something like
Code:
/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = 'whatever';
**Please don't post what it is. I'm only wondering if it has quotes (or any other unusual characters) in it. That is, characters that are not "Only numbers, letters, and underscores".
Back to top
View user's profile Send private message
Lok52
Newcomer Level I
Newcomer Level I



Joined: 04 Feb 2009
Posts: 16
Location: NW Ohio

PostPosted: February 06 2009, 00:07    Post subject: Re: Clean Options warning message Reply with quote

Sorry, I did know the version number, but I was apparently brain dead. It is the latest version, 1.1.0 RC. It was that last paragraph of yours I had problems with.

But to answer your question, no, there are no quotation marks in my db table prefix, it follows the rules. I just installed and ran it again, and the same error came up.
Back to top
View user's profile Send private message
Mittineague
Site Admin
Site Admin



Joined: 04 Jul 2006
Posts: 68
Location: West Springfield, Massachusetts

PostPosted: February 21 2009, 21:03    Post subject: no foreach array argument Reply with quote

After some looking and testing I'm still not sure why you got that error, but I have made some changes that should help.

It may be that the query was using "field = string" instead of "field LIKE string". Technically the = is for comparing numerics and the LIKE is for comparing strings. Although using the = in the query has not caused universal problems, it may be that in some circumstances (such as yours?) it does, so I changed that.

I had hoped that specifying ARRAY_A (associative array) would ensure that the query returned an array for the foreach. However, the function returns null if the query fails, irregardless of whether the return type is specfied as an object, associative array, or numeric array.

So I added a test for the query's return type. If it's not an array, an error message will display showing the query that failed, and an empty array will be passed to to the foreach. This means no options for that query will be displayed, but hopefully the error message will facilitate further trouble-shooting.

With luck the change to LIKE in the query will have resolved the problem for you. Please install the new version 1.1.1 and let me know if you still have a problem.

Thanks.


Last edited by Mittineague on February 24 2009, 22:12; edited 1 time in total
Back to top
View user's profile Send private message
Lok52
Newcomer Level I
Newcomer Level I



Joined: 04 Feb 2009
Posts: 16
Location: NW Ohio

PostPosted: February 22 2009, 14:03    Post subject: Re: Clean Options warning message Reply with quote

I tried the old version, to be sure I was still getting the old error message, which I did. (I have moved my blog to a new database because of corruptions in the old database caused by some plugins.) I then upgraded to your new version and did get a warning:
Code:
WARNING !!

Database Error
    SELECT option_name, option_value FROM *_options WHERE autoload NOT LIKE '%yes%' (the "RSS_" Options query) did not return an array


I don't have an asterisk there, I blanked it for posting here. It found the same options in the database as the old version, but after the warning it explained the information on RSS options, then said there were no "RSS_" options.
Back to top
View user's profile Send private message
Mittineague
Site Admin
Site Admin



Joined: 04 Jul 2006
Posts: 68
Location: West Springfield, Massachusetts

PostPosted: February 22 2009, 20:00    Post subject: Re: Clean Options warning message Reply with quote

Thanks for posting the warning message, it helps a lot.

I did some testing, if for some reason an "RSS_" option row was autoload "yes" instead of "no", it shows with the plugin options. Any other value, no, empty or whatever, and it shows in the "RSS_" options.

It does not seem to be a query problem, as a similar query finds the "LIKE %yes%" option rows. This suggests that either your blog doesn't fetch any RSS feeds (not likely as the dashboard does), or in fact there really are no "RSS_" option rows.

This would be the case if the MAGPIE_CACHE_ON constant is not true/1

The init() function in the wp-includes/rss.php file checks to see if that constant is already defined, and if not, defines it as 1

So I'm guessing that somewhere (maybe the wp-config.php file, the rss.php file, or maybe a plugin file), the constant is being defined as false/0

If so, this means that every time a page that has an RSS feed in it loads, a new HTTP request for the feed will occur. The feed caching is meant to reduce the number of HTTP requests that are made, and if you have a lot of feeds that show often in your blog caching would be a help in reducing page load times. But there may be a good reason for getting "fresh" feed content all the time.

I'm curious what plugins you have activated as I'm not sure how to get the value of this constant and it may be easier to check for the plugin(s) involved.
Back to top
View user's profile Send private message
Lok52
Newcomer Level I
Newcomer Level I



Joined: 04 Feb 2009
Posts: 16
Location: NW Ohio

PostPosted: February 22 2009, 21:03    Post subject: Re: Clean Options warning message Reply with quote

I have a lot of plugins running. I will start with the ones that are the likeliest to do something with the RSS feed.

CommentLuv
Contact Form 7
Flaresmith
Share This
Subscribe to Comments

When I click on my RSS feed, it starts up my reader, so I guess it is working.
Back to top
View user's profile Send private message
Mittineague
Site Admin
Site Admin



Joined: 04 Jul 2006
Posts: 68
Location: West Springfield, Massachusetts

PostPosted: February 23 2009, 00:35    Post subject: magpie cache constant Reply with quote

I downloaded and checked those plugins, but none of them define the MAGPIE_CACHE_ON constant.

I did some searching and did find one that does however, the Twitter for WordPress plugin. It turns off caching so the tweets will be in "real time" and won't go un-updated for an hour at a time.

I also saw a recommendation to put the define() in the theme's function.php file.

So there is a very good chance that you in fact have no "RSS_" options.

I'll have to either think of a way to get the constant's value for an accurate message or at least reword the warning to alert people of the possibility.

Thanks again.
Back to top
View user's profile Send private message
Lok52
Newcomer Level I
Newcomer Level I



Joined: 04 Feb 2009
Posts: 16
Location: NW Ohio

PostPosted: February 23 2009, 01:08    Post subject: Re: Clean Options warning message Reply with quote

It is possible the cache is turned off, but not by that plugin. I have never had it on my live site.

I just looked at my MySQL database, there are about a half dozen RSS_ option fields, all set with autoload off. I have no idea what that means for your programming, but I thought it would be good for you to know.
Back to top
View user's profile Send private message
Mittineague
Site Admin
Site Admin



Joined: 04 Jul 2006
Posts: 68
Location: West Springfield, Massachusetts

PostPosted: February 24 2009, 22:34    Post subject: database problem Reply with quote

Well, I'm at a bit of a loss. You have an *_options table, and it has the option_name, option_value, and autoload fields. Even if the autoload values are "off" instead of "no", since they are not "yes" they should be found OK.

And you do have "RSS_" rows, so the MAGPIE_CACHE_ON idea is moot (for you at least).

My thought was that maybe when you moved from the old database to the new, some fields may have contained multibyte characters that broke either MySQL or WordPress' implementation of EZSQL. But even though I can test for multibyte characters, I'm still not sure if that is the problem, and even if it is, fixing it is not something that the plugin can do, as it requires some rather serious database work.

I have learned that simply removing the hide_errors() does not mean database errors will show, so I have now explicitly added show_errors(true). These error messages should provide more useful information than the "this query failed" messages, and hopefully help those that should fix their database to do so.

I should be releasing version 1.1.2 after I test it a bit more, either later today or tomorrow.
Back to top
View user's profile Send private message
Lok52
Newcomer Level I
Newcomer Level I



Joined: 04 Feb 2009
Posts: 16
Location: NW Ohio

PostPosted: February 24 2009, 22:43    Post subject: Re: Clean Options warning message Reply with quote

I am sure I still have some problems in the database. I get strange glitches on occasion, especially when editing posts, and I have some problems adding and updating plugins, while the same ones work fine on my test site, which is loaded down with dozens of extra plugins I am writing about.

I will give things a try again with the new version when it is ready and let you know how things go.
Back to top
View user's profile Send private message
Lok52
Newcomer Level I
Newcomer Level I



Joined: 04 Feb 2009
Posts: 16
Location: NW Ohio

PostPosted: February 26 2009, 03:52    Post subject: Re: Clean Options warning message Reply with quote

I got 2 errors this time. Looks like it is my database that is the problem.

Code:
WordPress database error: [MySQL client ran out of memory]
SELECT option_name, option_value FROM *_options WHERE autoload NOT LIKE '%yes%'


Code:
WARNING !!

Database Error
    SELECT option_name, option_value FROM *_options WHERE autoload NOT LIKE '%yes%' (the "RSS_" Options query) did not return an array


I checked my host, my memory is fixed on the shared hosting plan I am on. Even changing the .htaccess file will not do anything.

EDIT: I removed the table prefix from your post. - Mittineague
Back to top
View user's profile Send private message
Mittineague
Site Admin
Site Admin



Joined: 04 Jul 2006
Posts: 68
Location: West Springfield, Massachusetts

PostPosted: February 26 2009, 05:01    Post subject: database memory Reply with quote

Lok52 wrote:
... there are about a half dozen RSS_ option fields, all set with autoload off. ...

For you to have a memory problem I would expect that you had a lot more than a half dozen. even if not as many as 740,000

When you first go to the plugins page, how many rows does it say you have for $opt_tbl_len? i.e.
Code:
<p>The Options table currently has <b><?php echo $opt_tbl_len; ?></b> found rows.</p>


I know WordPress uses EZSQL to work with MySQL and saves the last result of the "last query" until it's flushed to make it easier to work with the results. I'll take a closer look and see if an explicit flush() might help, although a new query automatically flushes the last one so I don't think that will help much. Another possibility might be to limit the query somehow so the amount being saved at any time isn't too much. The "limited find" I recently added works after the database call to cut down on PHP memory use, as some were having problems with that. But if I can think of a way to limit the query instead, that would solve issues with PHP memory and database memory. Ironically, to do so I may need to add an option to the wp_options table to keep track of the offset. Wink

EDIT: I've come up with a way to limit the query without using an option that should work OK. It will be in the version 1.1.3 release.


Last edited by Mittineague on March 01 2009, 14:11; edited 2 times in total
Back to top
View user's profile Send private message
Display posts from previous:   
Posting is closed between 03:00:00 and 06:00:00 (GMT - 4 Hours)
Post new topic   Reply to topic    Mittineague Forum Index -> WordPress All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




P o w e r e d   b y   p h p B B   ©   2 0 0 1 ,   2 0 0 5   p h p B B   G r o u p
Family & Friends | Mittineague Park | Home | Walk Photos | Wildflowers | Scripting | Sitemap | Blog | Contact |