Tagged: mptt updates Toggle Comment Threads | Keyboard Shortcuts

  • diegocaro 7:30 pm on August 10, 2009 Permalink
    Tags: , mptt updates,   

    Hi everyone, finally I have the patch fo… 

    Hi everyone, finally I have the patch for MPTT in categories and Pages.

    Download the update-pack in http://dl.getdropbox.com/u/173207/pack_20090810.tar.gz

    The update-pack includes the patch for WordPress (developer version at today), and two plugins called MPTT, and MPTT-test.

    The first plugin MPTT, include a little code for view the tree data in categories and pages (only for view and check the results of add/edit nodes). And with the second plugin MPTT-test, you can insert artificial tree data (hundred and thousands nodes) into categories and get the speedup MPTT V/S Recursive way for get categories.

    Remember install the diff patch only in a not important WordPress installation.

    Bye bye, and good luck with the tests!

  • diegocaro 4:06 am on July 14, 2009 Permalink
    Tags: , mptt updates   

    Hello everyone, this week had been slow…. 

    Hello everyone, this week had been slow. I only change the stack for managing the depth on the tree [because this week was my final week in the university 🙂 ].
    BTW, this and the next week the code develop will be stopped (I’m going to vacations).

    When I’ll be back, I will check why my code only get 7-10% of speedup.

    Bye bye… and happy coding!

  • diegocaro 7:46 am on July 8, 2009 Permalink
    Tags: , mptt updates   

    Hello :), This week has been test, test,… 

    Hello :),
    This week has been test, test, test, test with a lot of categories. To do the test with categories, I wrote code for another way of insert categories in mysql (without WordPress functions and MPTT functions), because the WP execution was stopped by php (stopped by max_time_execution and memory limit when I try to insert 20000 to 100000 categories).
    The idea is get the inserts statements for to can do “one big insert” using only text, executing the script and insert directly to the database [ example: php -n insert-sql.php | mysql -u user -ppass wp_db]. The script is in mptt-test/insert-sql.php .

    For get the speedup, I get the categories 5 times and calculate the time of execution with the code:
    $start = microtime( true );
    mptt_wp_dropdown_categories( $args );
    $finish = microtime( true );
    $total = $finish – $start;

    The speedup is beetwen 7-10% with synthetic data (20000 to 100000 categories with depth 5), and real XML data. You can see the results in http://spreadsheets.google.com/pub?key=tWef2b-aEpdU5LOFwUe65DA&output=html .

    Now, the code for categories goes ok (I coded a plugin that extends the core functions for test the mptt). When you install the mptt plugin, automatically add new fields of the database with metadata. In the admin panel you can view the tree of categories using mptt menu.
    With mptt-test you can insert artificial data into database, for make test or benchmark the algorithm.

    You can see the plugin code of mptt, mptt-test and little patch to core in http://files.getdropbox.com/u/173207/mptt-pack.zip (this pack have a bug) http://files.getdropbox.com/u/173207/pack_fixed.zip

    Feel free for test, modified, reuse the code ;).

    Bye byeee

    • diegocaro 8:17 am on July 8, 2009 Permalink

      D’oh, my mptt algorithm have a bug.

      When some categories doesn’t have posts, they are deleted from the results (in get_terms function), so when the algorithm in walk() method (class MPTT_Walker), can’t get the next depth of the tree. This is because I use a “for bucle” for traverse the results of function get_terms.

      The solution is easy, only change the way of get the next depth :).

  • diegocaro 6:20 am on June 17, 2009 Permalink
    Tags: , mptt updates,   

    Hello, this week I worked on a class for… 

    Hello, this week I worked on a class for update the tree, this class include an algorithm for reindex tree (when you migrate from the old method for get tree data), update a node when WP add a new category or edit an existent category.

    But I have a problem when a category was deleted , the action hook (called delete_category) doesn’t show the right and left field of the deleted category, for solve it I execute the method for reindex, but I think that is bad because use some resources. Maybe I will modify the delete_category hook to show data in the category before it is removed.

    I added a column called depth, only for get more faster the tree data (I need prove it).

    For the next week, I will add functions for install and remove the plugin, better code for my mptt_walker class [I have a problem when max_depth is active] and I will search code for make tests.

    Bye byeeeee

  • diegocaro 12:07 am on June 13, 2009 Permalink
    Tags: mptt updates,   

    Hello for all, sorry for my late update … 

    Hello for all, sorry for my late update (I was in a special course of Database Integration during this week).
    This week, I worked on save items. For that, I used actions called “created_category, updated_category, delete_category).

    The point is that I don’t will modify the native functions of taxonomy because I will write the code for to use actions.

    For the next week the code for create, update and delete tree data (in categories) will be finished. Also I’ll be working on functions for migrate the old tree data to mptt tree data.

    Bye byee

  • diegocaro 3:15 am on May 12, 2009 Permalink
    Tags: mptt updates   

    Hi!. I go to start this week jejej. I re… 

    Hi!. I go to start this week jejej. I read some documentation pages in Codex (like http://codex.wordpress.org/Developer_Documentation), but I need something else for faster understand of the code :).

    I need an “Api documentation site”, something like CakePHP Api Docs in http://api.cakephp.org/class/sanitize . I’ve read http://adambrown.info/p/wp_hooks, but doesn’t have documentation of classes.

    Anyway, I’m reading the Walker code (It’s for store tree-like data structures ).

    Bye byeeee

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc