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
1814       *
1815       * @since 6.4.0
1816       *
1817       * @param true|WP_Error $result         The result of unzipping the archive. True on success, otherwise WP_Error. Default true.
1818       * @param string        $file           Full path and filename of ZIP archive.
1819       * @param string        $to             Full path on the filesystem the archive was extracted to.
1820       * @param string[]      $needed_dirs    A full list of required folders that were created.
1821       * @param float         $required_space The space required to unzip the file and copy its contents, with a 10% buffer.
1822       */
1823      $result = apply_filters( 'unzip_file', true, $file, $to, $needed_dirs, $required_space );
1824
1825      unset( $needed_dirs );
1826
1827      return $result;
1828 }
1829
1830 /**
1831  * Attempts to unzip an archive using the PclZip library.
1832  *
 
Line Code
1956                continue;
1957           }
1958
1959           if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE ) ) {
1960                return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $file['filename'] );
1961           }
1962      }
1963
1964      /** This action is documented in src/wp-admin/includes/file.php */
1965      $result = apply_filters( 'unzip_file', true, $file, $to, $needed_dirs, $required_space );
1966
1967      unset( $needed_dirs );
1968
1969      return $result;
1970 }
1971
1972 /**
1973  * Copies a directory from one location to another via the WordPress Filesystem
1974  * Abstraction.