Codebase list phpggc / 890f972 lib / PHPGGC / GadgetChain / FileDelete.php
890f972

Tree @890f972 (Download .tar.gz)

FileDelete.php @890f972raw · 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']);
    }
}