[wp-hackers] Options table' varchar 64.
Nikola Nikolov
nikolov.tmw at gmail.com
Tue Jun 24 20:06:57 UTC 2014
What I've used before(and now I see is not the best) is to simply do
$key = md5( "my_{$complicated}_{$multi}_component_{$key}" );
Instead a better approach is
// Should not be longer than 13 characters, since md5() returns 32
characters => 32+13 = 45, which is the limit
$prefix = 'my_';
$key = $prefix . md5( "{$complicated}_{$multi}_component_{$key}" );
This way you can
DELETE FROM $wpdb->options WHERE option_name LIKE '$prefix%';
Which is good to do when your plugin is deactivated.
On Tue, Jun 24, 2014 at 10:52 PM, Andrew Nacin <wp at andrewnacin.com> wrote:
> I don't understand why you require anything more than 64 characters. It
> would be *nice to have*, but it's not a requirement.
>
> Stick to the existing limits and wait to see if core makes an adjustment in
> https://core.trac.wordpress.org/ticket/13310.
>
>
> On Tue, Jun 24, 2014 at 3:47 PM, Haluk Karamete <halukkaramete at gmail.com>
> wrote:
>
> > Now giving it a second thought, and considering what Morgan has brought
> > into the picture on this very quesition, doing this at a plug-in
> activation
> > time does not sound to me as good of an idea as it did an hour ago. :)
> >
> > If it's gonna take that much of time, then every time WP updates, ( and
> as
> > part of this update, all plugins are automatically deactivated and then
> > re-activated ) a nd as a result of this, some users will experience such
> > slowness, and my plug in would be the one causing that, it's hard for me
> to
> > take that route... See what I mean?
> >
> > I think if that code were to be planted in the wp-config.php file
> instead,
> > then that would have been better.
> >
> > At wp-config, and every time it runs ( meaning at each page load), a
> > constant can be probed to see if it is defined or not.
> >
> > If that constant is defined, I can drive the fact that the option names
> > has already been upped to varchar(128).
> >
> > What say you?
> >
> >
> > On Tue, Jun 24, 2014 at 7:06 AM, J.D. Grimes <jdg at codesymphony.co>
> wrote:
> >
> > > This is something that you need to change in the database table’s
> schema
> > > directly. So you need to run a single ALTER TABLE query. You don’t want
> > to
> > > be running this every page load. If this is part of a plugin, you
> should
> > do
> > > it on activation.
> > >
> > > Also, see https://core.trac.wordpress.org/ticket/13310
> > >
> > > -J.D.
> > >
> > > On Jun 24, 2014, at 9:42 AM, Haluk Karamete <halukkaramete at gmail.com>
> > > wrote:
> > >
> > > > Is there a harm to change the options table so that the field names
> for
> > > the
> > > > transients can have varchar 128 as opposed to varchar 64 and if
> > that's
> > > > okay, what's the best way to do this?
> > > >
> > > > In other words, what would be the best or the earliest hook for this
> > > kind
> > > > of s change? Or should this be done at wp-config?
> > > > _______________________________________________
> > > > wp-hackers mailing list
> > > > wp-hackers at lists.automattic.com
> > > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > >
> > > _______________________________________________
> > > wp-hackers mailing list
> > > wp-hackers at lists.automattic.com
> > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > >
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list