• Hi mates, any chance to process all the posts, without using a query?
    I can’t simply write a PHP batch, because I need some WP/plugins functionality

    Any hint? Some documents to start with? Any primer?

Viewing 14 replies - 1 through 14 (of 14 total)
  • What do you mean by “process”?

    Thread Starter Blutarsky

    (@blutarsky)

    I need to read each post (in a “batch” fashion), modify some post content and title, and store.

    I’m still not clear on what you are trying to do but the Search and Replace plugin may help.

    Thread Starter Blutarsky

    (@blutarsky)

    It’s not a simple search & replace matter.
    I need quite long code running on each post, search & replace is unfit.
    Any other idea?

    Unless there is some common thing that you want to change on all the posts, I don’t know of any way to do it in a batch fashion. I still don’t really know what you are trying to do.

    Thread Starter Blutarsky

    (@blutarsky)

    As I have said, I need to change the contents in each post, from the first one to the last one but content modification in each post will change depending on post content itself.

    There is no way to make individual changes as a batch, in any program, anywhere…

    It defies the very explanation of what a batch process is.

    Thread Starter Blutarsky

    (@blutarsky)

    (′bach ′pr?s·es·i?)

    (computer science) A technique that uses a single program loading to process many individual jobs, tasks, or requests for service.

    In my case, iterate through ALL posts, from first one to last one; per each post do something (read post, modify contents, store post).

    While this could be achieved EASILY within WordPress environment, it actually can’t , just because of timeout limitations.

    Sounds to me like you need cron processes, for automated procedures..

    Try google and if not much help, check out this page to.

    Thread Starter Blutarsky

    (@blutarsky)

    No,no,no! ??
    Is it possible that no one wrote some PHP code to iterate through all the posts of a WordPress install?

    Pseudocode:

    – Use proper SELECT to start
    – read first post
    (a) End of dataset? if not continue, otherwise exit
    – do the updates to the post content and title
    – save the post
    – read next post
    – goto (a)

    – Use proper SELECT to start
    – read first post
    (a) End of dataset? if not continue, otherwise exit
    – do the updates to the post content and title
    – save the post
    – read next post
    – goto (a)

    What makes you think a Cron process couldn’t do exactly what you’ve described?

    Else if it’s just a series of “get a” adjust to “b”, update “c”, etc… write a script to do it..

    The WordPress database class for reference.
    https://codex.www.ads-software.com/Function_Reference/wpdb_Class

    Thread Starter Blutarsky

    (@blutarsky)

    Sorry for the duped post.

    Do you think can use that class avoiding timeouts? It’s a quite lenghty job, I would say it would last some 20 minutes to run on some 3000 records….

    Maybe adjusting Apache & PHP timeouts….. What do you think?

    No idea honestly, i’m simply offering some suggestions..

    If this a process you want automated i would suggest taking a further look at Cron processing, even if it means dividing the overall task into several smaller ones (that could help with timeout issues – maybe?).

    About as close as i’ve been to batch processing is writing the odd .bat file on windows to open up my apps or run a defrag, so i’m not speaking from experience.

    I’m not sure your question is nessarily specific to WordPress, the only element that makes this about WordPress is the fact you’re performing operations on data in the WordPress database, but i don’t think that means you necessarily need exclude other batch scripts as possibilities. I think the WP cron functions are the way to go personally, but it’s not really something i’ve had experience with myself.

    Your question might be better suited posted on one of the following mailing lists.

    https://codex.www.ads-software.com/Mailing_Lists#Hackers
    https://codex.www.ads-software.com/Mailing_Lists#Professional

    I’ll move your thread to the Advanced forum later today, this seems a little bit outside the scope of the regular “how do i do this on the blog” questions that typically reside in this forum. I’ll let the thread have a little life here first though, then move it onto the Advanced section.

    are you looking for this?

    in theory you can run a php script as long as needed,
    and you dont need apache to run php.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Batch processing all the posts’ is closed to new replies.