Ron Strilaeff
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Which is the best hook to use when creating a custom db table?While I’m on the subject of programatically creating tables, apparently there is a problem with dbDelta creating duplicate indexes. I am creating a table within the init action hook (for now) like this:
function sv_create_favorites_table(){ global $wpdb; $table_name = $wpdb->prefix . "favorites"; $sql = "CREATE TABLE IF NOT EXISTS $table_name ( fav_id bigint(20) not null auto_increment, post_id bigint(20) not null, user_id bigint(20) not null, fav_date timestamp not null, PRIMARY KEY (fav_id), KEY (post_id), KEY (user_id) );"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); }; add_action( 'init', 'sv_create_favorites_table');… and the only way I could prevent it from creating multiple duplicate indexes named post_id_2, 3, 4, etc was to add the “IF NOT EXISTS” clause to the CREATE TABLE statement.
But the real question remains .. is there a better hook than init?, so that this create table statement is run exactly once as long as the site is alive (or I need to change it)?
I’m working with some ajax post/response logic and notice that occasionally I get a zero char in my response when the php-ajax side does not execute a die() or exit() statement. It can be successful, but still not terminated properly. Hope this is another useful clue.
Forum: Plugins
In reply to: [Quick Cache (Speed Without Compromise)] How long does "Clear Cache" take?The only way that I’ve found so far to reliably and quickly clear the cache in Quick Cache is to simply turn it off for a couple of minutes, look in filezilla to see that the wp-content/cache directory is empty (except for that mutex file) then turn it back on.
My motivation for deleting those 19k old files is that it takes way too long to backup (using filezilla) and they are not critical files.
Tobias, I have a clue on the origin of that stray zero char …
Stick this in your browser’s address bar:
http://tobiasnygren.se/wp-admin/admin-ajax.phpUse any other wordpress site’s domain name … the admin-ajax.php must be returning a false or zero after some internal function.
Hi, I’m learning how to do something similar.
Did you figure out how to implement the .ajaxForm or .ajaxSubmit methods in a wordpress frontend form?
Forum: Plugins
In reply to: [Quick Cache (Speed Without Compromise)] How long does "Clear Cache" take?By the way I do appreciate the depth of knowledge you (kellog9) and other posters have on these very technical subjects. I read that primothemes/websharks/s2member (the plugin author) is making some changes. Do you work for WebSharks? If not, why is there no input from them?
To all orphaned Quick Cache users…. I’m seriously considering switching over to WP Super Cache since the author Donncha O Caoimh is a bonafide automattic guru and should be around a while.
And although many big sites swear by W3 Total Cache, I’ve never gotten it to work properly since it seems way too complicated and I think it does some weird things with caching database queries. Everytime I’ve tried to activate and configure it, my sites come to a grinding halt, but maybe that’s because there is a lot of intitial overhead for it to get the magic going.
Forum: Plugins
In reply to: [Quick Cache (Speed Without Compromise)] How long does "Clear Cache" take?The “GET Requests” option is “True (Don’t Cache)” so that’s not an issue.
Pasting in the URL from the QC comment at the bottom of a stale cache file does recreate a new cache file (with the same MD5 name), so that’s good too.
I do make use of the autocache feature which, as I understand it, will immediately cache a page that is changed so no anonymous visitor has to experience that 1 or 2 second first hit delay.
Also, on that site we get 10k hits per day and I’m sure they are not all unique.
So that leads me back to the question about why so many old files. I thought the QC “garbage collector” is supposed to run every hour, and since my expire time is set to 3602 seconds, there should not be any files older than 2 hours + 2 minutes. There is a scheduled task for this in the wp_options table. I’m pretty sure my wp_cron is executing normally since I do get wp plugin update notices.
My best guess is I think the garbage collection routine is not working, and there is some not-so-unusual (since I’m not the only one experiencing this) combination of settings that make it not run. Do you think it is by design that unvisited pages/files would remain dormant in that folder forever? Isn’t garbage collection supposed to get rid of that to prevent bloat?
Forum: Plugins
In reply to: [Quick Cache (Speed Without Compromise)] Cache directory is enormous@dicknet … did you every find out why it seems to be ignoring your 3600 sec “cache expiration time” ?
I just did an experiment to clear my 19K (1.6GB or 3+ month’s worth) of old cached files:
A. Yesterday the “clear cache” button on the top admin bar never completed.
B: Using filezilla to delete the contents caused filezilla to hang (or I just gave up)
C: Just now, I changed the cache expiration time to 3601 and within seconds all stale cached files automagically disappeared. Yay!Fortunately my failed attempts never broke anything but I had to do something, since all file management tasks (like backup) were starting to fail due to the sheer volume of obsolete files.
@websharks or @primothemes (developer, if you are still supporting this) … my intuition says that there should never be any cached files on my server disk older than the “cache expiration time”. If I’m wrong, what is the logic here?
Forum: Plugins
In reply to: [Quick Cache (Speed Without Compromise)] How long does "Clear Cache" take?Thanks for that confirmation.
However, it still bothers me that there would be 19k (1.6GB) cached files dating back 3 months when I have my QC config option “Cache Expiration Time” set to 3600 seconds (1 hour).
The site seems to be performing well. I’ll try to test if it is actually presenting one of those old files to a non-logged in user. Any tips on how to prove that?
Thanks, Ron
Forum: Fixing WordPress
In reply to: autocomplete just not working!I have a need for this and will dive in soon get it working.
Are you basing your code on this jQuery UI?
Forum: Plugins
In reply to: [Drag & Drop for Post Thumbnails] Works with WordPress Version 3.5More testing:
In this plugin, The droppable file count should be limited to one, but it may be hard to do since I think there is minor bug (or misunderstanding) in the plupload js-plugin that this is based on. It seems to ignore the “multi_selection: false,” setting.
Right now, in this plugin, if I selected 4 images and dropped them onto the droparea, all of them get attached to the post and the last one becomes the thumbnail. I guess that’s OK as long as the user understands that.
That multi-file drop ability is the default for the WP version 3.5 media uploader (which is vastly improved IMHO).
By the way, in order to implement this D&D functionality on a user-facing submit form in a page template (like a contact form), I’m digging in to the plupload API (and ajax and jCrop which is stretching my comprehension of js).
Thanks Tobias for the inspiration, and I will share my code with you when I get it all working.
Hey Jeff,
Don’t worry about the CPT and Taxonomy, I can see how to do that myself.
My real need however, is for enhanced image functionality (drag, drop, upload, crop, preview, save as featured image), but I don’t think that is on your radar yet for this plugin.
Here is some hopefully valuable feedback:
I love your options page, but it should have a button to reset to default now, not just when reactivated.
I know its a bit complicated but there should be a specific error message for each failed input, like it took me a long time to realize that my image was too big. I thought the plugin was broken.
Where exactly is the image supposed to show up? Even when a user submits a post, the moderator still has to go into the media library and guess where the user wanted to place the image. But I guess that level of functionality (contributors) is already built in on the admin side.
Good luck to you … I enjoy your blog (and Chris’s) 🙂
Forum: Hacks
In reply to: How to use plUpload in meta box for uploading images?Here is a lean and mean plugin that does exactly what it says:
http://wordpress.org/extend/plugins/drag-drop-for-post-thumbnails/ , and leverages all the standard wordpress hooks to do it on the admin side.I’m working on a front end version of this for my own purposes using plupload and jcrop. If it is something that makes sense as a plugin, it maybe my first. There is a lot of interest in this nice frontend stuff, and I bet gravity forms or somebody will come out with something really great soon.
I think I found the answer to my question. The plupload.js and jcrop.js javascript code (and jquery.js since everything is dependendt on it) is included automatically by wordpress in wp-includes/script-loader.php
And the media_upload_form is not needed by my custom input/upload form. I just need the most basic plupload drag and drop and upload functionality of which there are numerous examples (in bits and pieces) on the web.
Thanks,
Yeah I’m going to have to go back to the basics and roll my own. Once I get the uploaded image in hand I can figure out the jCopy stuff.
It seems the trickiest part right now is is getting the javascript plupload.full.js to even be available. Is WP supposed to have that already loaded or does every php file have to enqueue it?
Ron