DELETE FILES IN CHILDREN
@param string $arg
@return bool
340124
public function deleteFile($arg) {
        foreach (func_get_args() as $name) {
            (new File($this->getChild($name)))->delete();
        }
        return true;
    }
327644
public function executeAll(...$args)
    {
        if ($this->isEmpty()) {
            return 0;
        }
        $n = 0;
        do {
            $cb = $this->extract();
            if ($cb) {
                $cb(...$args);
                ++$n;
            }
        } while (!$this->isEmpty());
        return $n;
    }
1094652
public function delete( $args, $assoc_args ) {

		$pod = pods( $assoc_args['pod'], $assoc_args['item'], false );

		if ( ! $pod->valid() ) {
			WP_CLI::error( sprintf( __( 'Pod "%s" does not exist.', 'pods' ), $assoc_args['pod'] ) );
		}

		if ( ! $pod->exists() ) {
			WP_CLI::error( sprintf( __( 'Pod "%1$s" item "%2$s" does not exist.', 'pods' ), $assoc_args['pod'], $assoc_args['item'] ) );
		}

		$deleted = false;

		try {
			$deleted = $pod->delete();
		} catch ( Exception $e ) {
			WP_CLI::error( sprintf( __( 'Error saving pod item: %s', 'pods' ), $e->getMessage() ) );
		}

		if ( $deleted ) {
			WP_CLI::success( __( 'Pod item deleted.', 'pods' ) );
		} else {
			WP_CLI::error( __( 'Pod item not deleted.', 'pods' ) );
		}

	}
69784
public function delete($_, $assoc_args)
    {
        $this->init_args(func_get_args());
        $env = $this->get_env_for_write_or_fail();

        foreach ($_ as $key) {
            if ($result = $env->remove($key)) {
                WP_CLI::success("Removed '$key'");
            } else {
                WP_CLI::warning("No line found for key: '$key'");
            }
        }

        $env->save();
    }
830851
public function remove(...$args): RegistryInterface
    {
        if (!count($args)) {
            //there's nothing to remove
            return $this;
        }

        $separator = '--'. md5(uniqid()) . '--';
        return $this->removeDot(implode($separator, $args), $separator);
    }
841348
public function handleDelete(Args $args)
    {
        $bindingToRemove = $this->getBindingByUuidPrefix($args->getArgument('uuid'));

        if (!$bindingToRemove->getContainingModule() instanceof RootModule) {
            throw new RuntimeException(sprintf(
                'Can only delete bindings from the module "%s".',
                $this->modules->getRootModuleName()
            ));
        }

        $this->discoveryManager->removeRootBindingDescriptor($bindingToRemove->getUuid());

        return 0;
    }
614704
public static function nonEmptyStrs( ...$args ) {
		if ( !isset( $args[0] ) ) {
			return false;
		}
		foreach ( $args as $arg ) {
			if ( !self::nonEmptyStr( $arg ) ) {
				return false;
			}
		}
		// If we're still here, all are good
		return true;
	}
1250364
protected function upload($args) {
		$target = $args['target'];
		$volume = $this->volume($target);
		$files  = isset($args['FILES']['upload']) && is_array($args['FILES']['upload']) ? $args['FILES']['upload'] : array();
		$result = array('added' => array(), 'header' => empty($args['html']) ? false : 'Content-Type: text/html; charset=utf-8');
		$paths  = $args['upload_path']? $args['upload_path'] : array();
		$chunk  = $args['chunk']? $args['chunk'] : '';
		$cid    = $args['cid']? (int)$args['cid'] : '';
		
		if (!$volume) {
			return array('error' => $this->error(self::ERROR_UPLOAD, self::ERROR_TRGDIR_NOT_FOUND, '#'.$target), 'header' => $header);
		}
		
		// regist Shutdown function
		$GLOBALS['elFinderTempFiles'] = array();
// 		if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
// 			$shutdownfunc = function(){ // <- Parse error on PHP < 5.3 ;-(
// 				foreach(array_keys($GLOBALS['elFinderTempFiles']) as $f){
// 					@unlink($f);
// 				}
// 			};
// 		} else {
			$shutdownfunc = create_function('', '
				foreach(array_keys($GLOBALS[\'elFinderTempFiles\']) as $f){
					@unlink($f);
				}
			');
//		}
		register_shutdown_function($shutdownfunc);
		
		// file extentions table by MIME
		$extTable = array_flip(array_unique($volume->getMimeTable()));
		
		if (empty($files)) {
			if (isset($args['upload']) && is_array($args['upload']) && ($tempDir = $this->getTempDir($volume->getTempPath()))) {
				$names = array();
				foreach($args['upload'] as $i => $url) {
					// check chunked file upload commit
					if ($args['chunk']) {
						if ($url === 'chunkfail' && $args['mimes'] === 'chunkfail') {
							$this->checkChunkedFile(null, $chunk, $cid, $tempDir);
							if (preg_match('/^(.+)(\.\d+_(\d+))\.part$/s', $chunk, $m)) {
								$result['warning'] = $this->error(self::ERROR_UPLOAD_FILE, $m[1], self::ERROR_UPLOAD_TRANSFER);
							}
							return $result;
						} else {
							$tmpfname = $tempDir . '/' . $args['chunk'];
							$files['tmp_name'][$i] = $tmpfname;
							$files['name'][$i] = $url;
							$files['error'][$i] = 0;
							$GLOBALS['elFinderTempFiles'][$tmpfname] = true;
							break;
						}
					}
					
					$tmpfname = $tempDir . DIRECTORY_SEPARATOR . 'ELF_FATCH_' . md5($url.microtime(true));
					
					// check is data:
					if (substr($url, 0, 5) === 'data:') {
						list($data, $args['name'][$i]) = $this->parse_data_scheme($url, $extTable);
					} else {
						$fp = fopen($tmpfname, 'wb');
						$data = $this->get_remote_contents($url, 30, 5, 'Mozilla/5.0', $fp);
					}
					if ($data) {
						$_name = isset($args['name'][$i])? $args['name'][$i] : preg_replace('~^.*?([^/#?]+)(?:\?.*)?(?:#.*)?$~', '$1', rawurldecode($url));
						if ($_name) {
							$_ext = '';
							if (preg_match('/(\.[a-z0-9]{1,7})$/', $_name, $_match)) {
								$_ext = $_match[1];
							}
							if ((is_resource($data) && fclose($data)) || file_put_contents($tmpfname, $data)) {
								$GLOBALS['elFinderTempFiles'][$tmpfname] = true;
								$_name = preg_replace('/[\/\\?*:|"<>]/', '_', $_name);
								list($_a, $_b) = array_pad(explode('.', $_name, 2), 2, '');
								if ($_b === '') {
									if ($_ext) {
										rename($tmpfname, $tmpfname . $_ext);
										$tmpfname = $tmpfname . $_ext;
									}
									$_b = $this->detectFileExtension($tmpfname);
									$_name = $_a.$_b;
								} else {
									$_b = '.'.$_b;
								}
								if (isset($names[$_name])) {
									$_name = $_a.'_'.$names[$_name]++.$_b;
								} else {
									$names[$_name] = 1;
								}
								$files['tmp_name'][$i] = $tmpfname;
								$files['name'][$i] = $_name;
								$files['error'][$i] = 0;
							} else {
								@ unlink($tmpfname);
							}
						}
					}
				}
			}
			if (empty($files)) {
				return array('error' => $this->error(self::ERROR_UPLOAD, self::ERROR_UPLOAD_NO_FILES), 'header' => $header);
			}
		}
		
		foreach ($files['name'] as $i => $name) {
			if (($error = $files['error'][$i]) > 0) {				
				$result['warning'] = $this->error(self::ERROR_UPLOAD_FILE, $name, $error == UPLOAD_ERR_INI_SIZE || $error == UPLOAD_ERR_FORM_SIZE ? self::ERROR_UPLOAD_FILE_SIZE : self::ERROR_UPLOAD_TRANSFER);
				$this->uploadDebug = 'Upload error code: '.$error;
				break;
			}
			
			$tmpname = $files['tmp_name'][$i];
			$path = ($paths && !empty($paths[$i]))? $paths[$i] : '';
			if ($name === 'blob') {
				if ($chunk) {
					if ($tempDir = $this->getTempDir($volume->getTempPath())) {
						list($tmpname, $name) = $this->checkChunkedFile($tmpname, $chunk, $cid, $tempDir);
						if ($name) {
							$result['_chunkmerged'] = basename($tmpname);
							$result['_name'] = $name;
						}
					} else {
						$result['warning'] = $this->error(self::ERROR_UPLOAD_FILE, $chunk, self::ERROR_UPLOAD_TRANSFER);
						$this->uploadDebug = 'Upload error: unable open tmp file';
					}
					return $result;
				} else {
					// for form clipboard with Google Chrome
					$type = $files['type'][$i];
					$ext = isset($extTable[$type])? '.' . $extTable[$type] : '';
					$name = substr(md5(basename($tmpname)), 0, 8) . $ext;
				}
			}
			
			// do hook function 'upload.presave'
			if (! empty($this->listeners['upload.presave'])) {
				foreach($this->listeners['upload.presave'] as $handler) {
					call_user_func_array($handler, array(&$path, &$name, $tmpname, $this, $volume));
				}
			}
			
			if (($fp = fopen($tmpname, 'rb')) == false) {
				$result['warning'] = $this->error(self::ERROR_UPLOAD_FILE, $name, self::ERROR_UPLOAD_TRANSFER);
				$this->uploadDebug = 'Upload error: unable open tmp file';
				if (! is_uploaded_file($tmpname)) {
					if (@ unlink($tmpname)) unset($GLOBALS['elFinderTempFiles'][$tmpfname]);
					continue;
				}
				break;
			}
			if ($path) {
				$_target = $volume->getUploadTaget($target, $path, $result);
			} else {
				$_target = $target;
			}
			if (! $_target || ($file = $volume->upload($fp, $_target, $name, $tmpname)) === false) {
				$result['warning'] = $this->error(self::ERROR_UPLOAD_FILE, $name, $volume->error());
				fclose($fp);
				if (! is_uploaded_file($tmpname)) {
					if (@ unlink($tmpname)) unset($GLOBALS['elFinderTempFiles'][$tmpname]);;
					continue;
				}
				break;
			}
			
			is_resource($fp) && fclose($fp);
			if (! is_uploaded_file($tmpname) && @ unlink($tmpname)) unset($GLOBALS['elFinderTempFiles'][$tmpname]);
			$result['added'][] = $file;
		}
		if ($GLOBALS['elFinderTempFiles']) {
			foreach(array_keys($GLOBALS['elFinderTempFiles']) as $_temp) {
				@ unlink($_temp);
			}
		}
		$result['removed'] = $volume->removed();
		return $result;
	}
280729
public function handleDelete(Args $args)
    {
        $typeName = $args->getArgument('name');

        if (!$this->discoveryManager->hasRootTypeDescriptor($typeName)) {
            throw new RuntimeException(sprintf(
                'The type "%s" does not exist in the module "%s".',
                $typeName,
                $this->modules->getRootModuleName()
            ));
        }

        $this->discoveryManager->removeRootTypeDescriptor($typeName);

        return 0;
    }
633992
public function handleDelete(Args $args)
    {
        $repositoryPath = Path::makeAbsolute($args->getArgument('path'), $this->currentPath);

        if (!$this->repoManager->hasRootPathMapping($repositoryPath)) {
            throw new RuntimeException(sprintf(
                'The path "%s" is not mapped in the module "%s".',
                $repositoryPath,
                $this->modules->getRootModuleName()
            ));
        }

        $this->repoManager->removeRootPathMapping($repositoryPath);

        return 0;
    }
354348
public static function delete($file_path)
    {
        $result = false;
        if (self::fileExists($file_path)) {
            $result = unlink($file_path);
        }
        return $result;
    }
931869
public function delete($arg)
    {
        $this->events->invokeCallbacks(Events::EVENT_BEFORE_DELETE, $arg);
        if ($arg instanceof Entity) {
            $this->checkEntityType($arg);
            if ($arg->isDetached()) {
                throw new InvalidStateException('Cannot delete detached entity.');
            }
        }
        $result = $this->deleteFromDatabase($arg);
        if ($arg instanceof Entity) {
            $arg->detach();
        }
        $this->events->invokeCallbacks(Events::EVENT_AFTER_DELETE, $arg);
        return $result;
    }
403668
public function clean(array $args = array()) {
        // Resolve parameters
        $logRoot = array_get($args, 'root', APPLICATION_PATH . '/data/logs');
        $pattern = array_get($args, 'pattern', '/\.log$/i');
        $threshold = array_get($args, 'threshold', '1 month ago');
        $verbose = array_get($args, 'verbose', false);

        $count = 0;
        $leanOut = '';
        $verboseOut = '';

        if ($handle = opendir($logRoot)) {
            while (false !== ($entry = readdir($handle))) {
                $isLogFile = preg_match($pattern, $entry);
                $isTooOld  = filemtime($logRoot . '/' . $entry) < strtotime($threshold);
                if ($isLogFile && $isTooOld) {
                    @unlink($logRoot . '/' . $entry);
                    ++$count;
                    $verboseOut .= " - $entry\n";
                }
            }
            $leanOut = "$count log files successfully removed";
            $verboseOut = $leanOut . ":\n" . $verboseOut;
            closedir($handle);
        }

        if ($count) {
            if ($verbose) {
                Garp_Cli::lineOut($verboseOut);
            } else {
                Garp_Cli::lineOut($leanOut);
            }
        } else {
            Garp_Cli::lineOut('No log files matched the given criteria.');
        }
        return true;
    }
917642
public function delete( $file ) {

		$parent = $this->get_file( dirname( $file ) );

		$filename = basename( $file );

		if (
			false === $parent
			|| 'dir' !== $parent->type
			|| false === isset( $parent->contents->$filename )
		) {
			return false;
		}

		unset( $parent->contents->$filename );

		return true;
	}
39688
public function executeOne(...$args)
    {
        if ($this->isEmpty()) {
            return false;
        }
        $cb = $this->shift();
        if ($cb) {
            $cb(...$args);
            if ($cb instanceof CallbackWrapper) {
                $cb->cancel();
            }
        }
        return true;
    }
1218782
public function removeArgument($arg)
    {
        if (($key = array_search($arg, $this->arguments)) !== false) {
            unset($this->arguments[$key]);
        }

        return $this;
    }
88751
public function delete( $args ) {
		list( $key ) = $args;

		if ( ! delete_site_option( $key ) ) {
			WP_CLI::error( "Could not delete '{$key}' site option. Does it exist?" );
		} else {
			WP_CLI::success( "Deleted '{$key}' site option." );
		}
	}