Skip to content

Instantly share code, notes, and snippets.

@muskie9
Last active December 8, 2015 20:30
Show Gist options
  • Save muskie9/ad9dcce496ec58f26ee5 to your computer and use it in GitHub Desktop.
Save muskie9/ad9dcce496ec58f26ee5 to your computer and use it in GitHub Desktop.
<?php
class FileUpdateTask extends BuildTask{
protected $title = 'File Update Task';
protected $enabled = true;
protected $description = 'Update files from cloud files to normal';
public function run($request){
$updateFile = function($file){
$file->ClassName = ($file->ClassName == 'CloudImage') ? 'Image' : 'File';
$file->write();
};
File::get()->filterAny(array('ClassName' => array('CloudImage', 'CloudFile')))->each($updateFile);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment