| 10399 | | sub js_check_mtview { |
|---|
| 10400 | | my $app = shift; |
|---|
| 10401 | | $app->validate_magic or return; |
|---|
| 10402 | | my $blog_id = $app->param('blog_id'); |
|---|
| 10403 | | my $blog = MT::Blog->load($blog_id, { cached_ok => 1 }); |
|---|
| 10404 | | return $app->errtrans('Blog (ID: [_1]) can\'t be found', $blog_id) if !defined($blog); |
|---|
| 10405 | | |
|---|
| 10406 | | my $cache = 0; |
|---|
| 10407 | | my $conditional = 0; |
|---|
| 10408 | | my $mtview_path = File::Spec->catfile($blog->site_path(), "mtview.php"); |
|---|
| 10409 | | if (-f $mtview_path) { |
|---|
| 10410 | | open my($fh), $mtview_path; |
|---|
| 10411 | | while (my $line = <$fh>) { |
|---|
| 10412 | | $cache = 1 if $line =~ m/^\s*\$mt->caching\s*=\s*true;/i; |
|---|
| 10413 | | $conditional = 1 if $line =~ /^\s*\$mt->conditional\s*=\s*true;/i; |
|---|
| 10414 | | } |
|---|
| 10415 | | close $fh; |
|---|
| 10416 | | } |
|---|
| 10417 | | $app->send_http_header('text/javascript'); |
|---|
| 10418 | | $app->{no_print_body} = 1; |
|---|
| 10419 | | $app->print("{cache: $cache, conditional: $conditional}"); |
|---|
| 10420 | | } |
|---|
| 10421 | | |
|---|