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