Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.