File: rebuild-pages

package info (click to toggle)
movabletype-opensource 4.2.3-1%2Blenny3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 21,268 kB
  • ctags: 15,862
  • sloc: perl: 178,892; php: 26,178; sh: 161; makefile: 82
file content (32 lines) | stat: -rwxr-xr-x 866 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/perl

#use strict;

use LWP::UserAgent::Local;
use HTTP::Request;

use MT;
my $mt = new MT;

my $ua = new LWP::UserAgent::Local( {ScriptAlias => '/mt/'} );

my ($username, $password) = @ARGV;

my $blog_id = 1;

my $build_type = 'Individual,Monthly,Daily,Weekly,index';
my $next = '0';
use MT::Entry;
my $total_entries = MT::Entry->count({blog_id => $blog_id});
my $offset = '0';
my $limit = '20';

my $url = "http://localhost/mt/mt.cgi?__mode=rebuild&blog_id=$blog_id&type=$build_type&next=$next&offset=$offset&limit=$limit&total_entries=$total_entries&entry_id=$entry_id";
do {
    $url .= "&username=$username&password=$password";
    my $req = new HTTP::Request(GET => $url);
    my $resp = $ua->request($req);
    ($url) = $resp->content() =~ /window.location='(.*)'/;
    print (($url || "done") . "\n");
#    print $resp->content();
} while ($url);