Codebase list phpggc / 0a0732bb-898c-41f1-b464-b9ba025c444d/main lib / PHPGGC / GadgetChain / FileDelete.php
0a0732bb-898c-41f1-b464-b9ba025c444d/main

Tree @0a0732bb-898c-41f1-b464-b9ba025c444d/main (Download .tar.gz)

FileDelete.php @0a0732bb-898c-41f1-b464-b9ba025c444d/mainraw · history · blame

<?php

namespace PHPGGC\GadgetChain;

abstract class FileDelete extends \PHPGGC\GadgetChain
{
    public static $type = self::TYPE_FD;
    public static $parameters = [
        'remote_path'
    ];

    public function test_setup()
    {
        return [
            'remote_path' => \PHPGGC\Util::rand_file('test file delete')
        ];
    }

    public function test_confirm($arguments, $output)
    {
        return !file_exists($arguments['remote_path']);
    }

    public function test_cleanup($arguments)
    {
        if(file_exists($arguments['remote_path']))
            unlink($arguments['remote_path']);
    }
}