Make WordPress Core

Opened 16 years ago

Closed 15 years ago

#6646 closed defect (bug) (wontfix)

Wp-Cron does not include admin-related functions required by some plugins.

Reported by: i_hate_otto_destruct's profile I_hate_Otto_Destruct Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: General Keywords: has-patch needs-testing dev-feedback 2nd-opinion
Focuses: Cc:

Description

Last time I reported a security flaw you all accused me of smoking crack, and then you patched my flaw. So you do not have the right to talk to me. No, i will not further elaborate on how broken your cron system is. DO NOT CONTACT ME.

The reason why i am reporting this is because i burned my time on this stupid contract and i don't want another poor wordpress plugin developer to waste their time because of your trash. I see a ton of people complaining about your broken broken cron system that i felt bad for them, not you.

The problem i had is as follows:
i wrote a plugin that used wp_schedule_single_event();

No matter what i did i couldn't get wp_schedule_single_event() to run my action, no error message, it just wouldn't fucking run.

It turns out in my action i was calling wp_create_category().
When i called wp-cron.php with my browser and i saw that i was getting an error saying that wp_create_category() cannot be found.
How i fixed this bullshit was i added this line before my call to wp_create_category():

if(!function_exists('wp_create_category')) {

include_once('broken_include.php');

}

broken_include.php will be attached, but it is just functions from :
ABSPATH . 'wp-admin/includes/taxonomy.php'

DO NOT CONTACT ME.

Attachments (2)

broken_include.php (1.1 KB) - added by I_hate_Otto_Destruct 16 years ago.
functions from taxonomy.php
6646.diff (405 bytes) - added by DD32 16 years ago.

Download all attachments as: .zip

Change History (10)

@I_hate_Otto_Destruct
16 years ago

functions from taxonomy.php

#1 @DD32
16 years ago

  • Keywords has-patch needs-testing dev-feedback 2nd-opinion added
  • Milestone set to 2.6
  • Priority changed from high to normal
  • Severity changed from major to normal

Ok, So a more sane way of saying this:

Certain admin-related functions are not included into wordpress during Cron events.

Given that Cron events are often Admin-related it makes sense that such functions may be needed. Post insert/update functions are defined in the wp-includes as they are often used outside of the admin interface. Category creation however rarely takes place outside of the admin.

One solution:

  • Get rid of wp-admin/includes/ and merge it all back into /wp-includes/ - which doesnt make much sense, as the files are rarely needed.
  • Include the Admin includes on cron events (Patch attached)

I've not had a chance to test this patch, as i do not have any cron-related plugins available.

@DD32
16 years ago

#2 @DD32
16 years ago

  • Summary changed from I partially fixed your very broken cron system to Wp-Cron does not include admin-related functions required by some plugins.

Get rid of wp-admin/includes/ and merge it all back into /wp-includes/ - which doesnt make much sense, as the files are rarely needed.

And also taking into account that seperating functions which are generally only required by the admin into admin-only includes makes general sense in increasing performance and reducing load times.

#3 @ryan
16 years ago

We already do too many kitchen sink includes. I think we should just document that cron handlers that want admin functions have to pull them in explicitly.

#4 @ryan
16 years ago

Although, files included from a cron handler probably won't get full opcode caching treatment since they are conditional. Soooo, a non-conditional kitchen sink include might be faster for those with APC or other op code cachers.

#5 @westi
16 years ago

-1 to kitchen sink including everything here.

It just feels wrong.

If a plugin author wants to call functions that aren't included then they can include the file themselves as they would in other cases.

We need cron to be lean and fast so it is better not to include stuff that is not normally needed. At most we could add a event type that said it was an admin event and then this files were included but I am not convinced of it's benefit.

#6 @neoxx
16 years ago

I had a similar problem with wp_update_plugins(). Cost me a couple of hours to find out.

Maybe it would be a great idea to catch occurring PHP errors and save a status message within the cronjobs array. Moreover, we could additionally let cronjobs send an error or success-code. Would ease debugging a lot...

#7 @DD32
16 years ago

Maybe some file-level PHPDoc to Admin includes could be used to remind authors that the file is only included if the admin is loaded, Else the file needs to be included manually?

#8 @DD32
15 years ago

  • Milestone 2.9 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Closing as wontfix, 2 major releases have been made since, No more complaints have been made by any other authors, no traction.

Note: See TracTickets for help on using tickets.