Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: unzip_file

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
1845       *
1846       * @since 6.4.0
1847       *
1848       * @param true|WP_Error $result         The result of unzipping the archive. True on success, otherwise WP_Error. Default true.
1849       * @param string        $file           Full path and filename of ZIP archive.
1850       * @param string        $to             Full path on the filesystem the archive was extracted to.
1851       * @param string[]      $needed_dirs    A full list of required folders that were created.
1852       * @param float         $required_space The space required to unzip the file and copy its contents, with a 10% buffer.
1853       */
1854      $result = apply_filters( 'unzip_file', true, $file, $to, $needed_dirs, $required_space );
1855
1856      unset( $needed_dirs );
1857
1858      return $result;
1859 }
1860
1861 /**
1862  * Attempts to unzip an archive using the PclZip library.
1863  *
 
Line Code
1987                continue;
1988           }
1989
1990           if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE ) ) {
1991                return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $file['filename'] );
1992           }
1993      }
1994
1995      /** This action is documented in src/wp-admin/includes/file.php */
1996      $result = apply_filters( 'unzip_file', true, $file, $to, $needed_dirs, $required_space );
1997
1998      unset( $needed_dirs );
1999
2000      return $result;
2001 }
2002
2003 /**
2004  * Copies a directory from one location to another via the WordPress Filesystem
2005  * Abstraction.