/**
     * Remove images direcotry
     *
     * @param string $dir            
     */
    public function rrmdir($dir) {
        /**
         * Remove directory
         */
        if (is_dir ( $dir )) {
            $objects = scandir ( $dir );
            foreach ( $objects as $object ) {
                if ($object != "." && $object != "..") {
                    $this->unlinkDir ( $dir, $object );
                }
            }
            /**
             * Reset objects
             */
            reset ( $objects );
            rmdir ( $dir );
        }
    }
    
    /**
     * Unlink dir
     *
     * @param string $dir            
     * @param array $object            
     */
    public function unlinkDir($dir, $object) {
        if (filetype ( $dir . "/" . $object ) == "dir") {
            Mage::helper ( 'marketplace/image' )->rrmdir ( $dir . "/" . $object );
        } else {
            /**
             * Unlink file
             */
            unlink ( $dir . "/" . $object );
        }
    }

 

Your Answer
Sign In
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.