Skip to content

Instantly share code, notes, and snippets.

@alfasado
Created March 24, 2014 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alfasado/9734064 to your computer and use it in GitHub Desktop.
Save alfasado/9734064 to your computer and use it in GitHub Desktop.
name: GetListFiles
id: GetListFiles
version: 0.1
applications:
cms:
methods:
get_listfiles: >
sub {
my $app = shift;
if (! $app->user->is_superuser ) {
return $app->trans_error( 'Permission denied.' );
}
require MT::FileInfo;
my $iter = MT::FileInfo->load_iter();
my $res = '<h2>FileInfo</h2><pre>';
while ( my $fi = $iter->() ) {
if (! $fi->virtual ) {
$res .= $fi->file_path . "\n";
}
}
$res .= '</pre><h2>Assets</h2><pre>';
require MT::Asset;
$iter = MT::Asset->load_iter( { class => '*' } );
while ( my $fi = $iter->() ) {
$res .= $fi->file_path . "\n";
}
return $res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment