Skip to content

Instantly share code, notes, and snippets.

View alfasado's full-sized avatar

Alfasado Inc. alfasado

View GitHub Profile
name: GetListFiles
id: GetListFiles
version: 0.1
applications:
cms:
methods:
get_listfiles: >
sub {
my $app = shift;
if (! $app->user->is_superuser ) {
name: Garbage Cleaner
id: GarbageCleaner
version: 0.1
callbacks:
MT::FileInfo::post_remove: >
sub {
my ( $cb, $obj ) = @_;
my $path = $obj->file_path;
require MT::FileMgr;
my $fmgr = MT::FileMgr->new( 'Local' )
tags:
function:
GetEpoc: sub{return time}
@alfasado
alfasado / mt-plugin-rewritearchiver.php
Last active August 29, 2015 13:57
mt/plugin/RewriteArchiver/php/config.php
<?php
class RewriteArchiver extends MTPlugin {
var $registry = array(
'config_settings' => array(
'RewriteArchiverRewriteTo' => array( 'default' => '/archiver.html' ),
),
'callbacks' => array(
'post_init' => 'rewrite_archiver',
),
);
@alfasado
alfasado / mt-plugin-http-https-transfer.php
Created April 2, 2014 07:31
mt/plugins/HttpHttpsTransfer/php/config.php
<?php
class HttpHttpsTransfer extends MTPlugin {
var $registry = array(
'config_settings' => array(
'HttpHttpsTransferPathBegin' => array( 'default' => '/entry_form/' ),
),
'callbacks' => array(
'post_init' => 'post_init',
),
);
@alfasado
alfasado / mt-tool-rebuild-file
Created February 18, 2016 04:00
Run MT::Worker::Publish specify the file path or template_id.
#!/usr/bin/perl
package MT::Tool::RebuildFile;
use strict;
use warnings;
use File::Spec;
use FindBin;
use lib map File::Spec->catdir( $FindBin::Bin, File::Spec->updir, $_ ), qw/lib extlib/;
use base qw( MT::Tool );
use MT::Util qw( log_time );
sub usage { '--file /path/to/file or or --template_id n' }
@alfasado
alfasado / mt-tool-speed-rebuild
Last active April 4, 2016 06:32
Alternative script of MT::Worker::Publish.
#!/usr/bin/perl
package MT::Tool::SpeedRebuild;
use strict;
use warnings;
use File::Spec;
use FindBin;
use lib map File::Spec->catdir( $FindBin::Bin, File::Spec->updir, $_ ), qw/lib extlib/;
use base qw( MT::Tool );
use MT::FileMgr;
use MT::Util qw( log_time );