Not signed in ( Sign In)

Categories

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorwade
    • CommentTimeSep 23rd 2009
     permalink
    Hi,

    Is there a way to rebuild index from command line? I'd like to run some cronjob that create some files like fp-content/content/YEAR/MONTH/entryDATE-TIME.txt My only problem is that I have to log in to web interface and run rebuild index manually. Could anyone give advice how to do it without logging into the GUI?
    Thanks
    Gabor
    •  
      CommentAuthorpaul
    • CommentTimeSep 24th 2009
     permalink
    Use this code, it expects your flatpress root directory as first parameter.

    #!/usr/bin/php
    <?php
    $flatpress_dir = $argv[1];

    $_SERVER['HTTP_HOST'] = 'dummy';

    chdir($flatpress_dir);
    require_once 'defaults.php';
    require_once INCLUDES_DIR . 'includes.php';
    define('ADMIN_PANEL', 'maintain');
    require_once ADMIN_DIR . 'includes/panels.prototypes.php';
    require_once ADMIN_DIR . 'panels/maintain/admin.maintain.php';

    // dummy class
    class dummy {
    function __set($a, $b){}
    function __call($a, $b){}
    }

    // echo "Rebuilding index...\n";
    $amd = new admin_maintain_default(new dummy());
    $amd->dodo('rebuild');
    return;
    ?>
    •  
      CommentAuthorwade
    • CommentTimeSep 25th 2009
     permalink
    Cool, it works! Thanks!
    •  
      CommentAuthorpaul
    • CommentTimeSep 25th 2009
     permalink
    May I ask why you need this?
    •  
      CommentAuthorwade
    • CommentTimeSep 25th 2009
     permalink
    Sure. I spend most of my time in command line, sometimes i don't have time (or don't want) to open a browser, and create a new entry in my blog, so I just create the text and put the file in to the correct place, and run index rebuild. Or simply create a post from my daily tweets from twitter. So let say, at every 10pm I run a cronjob that collect all my tweets on today, creates a summary and put it into a flatfile under fp-content/content/YEAR/MONTH. Now I can have a 'local backup' of my tweets and visitors who are not familiar with Twitter can see my thoughts what was in my mind during the day ;-)
  1.  permalink
    great. but still have problem ...

    i am using that code with "include" and it works well. but we are using a own interface for writing article, because we need multiple users. After the code finised, there should not be "DONE - Please, select the back arrow in your browser", there should be a redirect like "header("Location:http://www.domain.de/directory/file.html");".

    Is this possible?
    •  
      CommentAuthorpaul
    • CommentTimeMar 5th 2010
     permalink
    Yes, of course it is possible.
    Why don't you just do it?