disk_free_space example

return $this->_get($this->_options['cache_dir'], 'matchingAny', $tags);
    }

    /** * Return the filling percentage of the backend storage * * @throws Zend_Cache_Exception * @return int integer between 0 and 100 */
    public function getFillingPercentage()
    {
        $free = disk_free_space($this->_options['cache_dir']);
        $total = disk_total_space($this->_options['cache_dir']);
        if ($total == 0) {
            Zend_Cache::throwException('can\'t get disk_total_space');
        } else {
            if ($free >= $total) {
                return 100;
            }
            return ((int) (100. * ($total - $free) / $total));
        }
    }

    


    /** * Checks the disk free space * * @return bool|string */
    private function checkDiskFreeSpace()
    {
        if (\function_exists('disk_free_space')) {
            // Prevent Warning: disk_free_space() [function.disk-free-space]: Value too large for defined data type             $freeSpace = @disk_free_space(__DIR__);

            return $this->encodeSize($freeSpace);
        }

        return false;
    }

    /** * Checks the suhosin.get.max_value_length which limits the max get parameter length. */
    private function checkSuhosinGetMaxValueLength(): int
    {
// Path to a file.             $needed_dirs[] = $to . untrailingslashit( $dirname );
        }
    }

    /* * disk_free_space() could return false. Assume that any falsey value is an error. * A disk that has zero free bytes has bigger problems. * Require we have enough space to unzip the file and copy its contents, with a 10% buffer. */
    if ( wp_doing_cron() ) {
        $available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR ) : false;

        if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space ) {
            return new WP_Error(
                'disk_full_unzip_file',
                __( 'Could not copy files. You may have run out of disk space.' ),
                compact( 'uncompressed_size', 'available_space' )
            );
        }
    }

    $needed_dirs = array_unique( $needed_dirs );

    
return $result;
    }

    /** * Tests available disk space for updates. * * @since 6.3.0 * * @return array The test results. */
    public function get_test_available_updates_disk_space() {
        $available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR . '/upgrade/' ) : false;

        $result = array(
            'label'       => __( 'Disk space available to safely perform updates' ),
            'status'      => 'good',
            'badge'       => array(
                'label' => __( 'Security' ),
                'color' => 'blue',
            ),
            'description' => sprintf(
                /* translators: %s: Available disk space in MB or GB. */
                '<p>' . __( '%s available disk space was detected, update routines can be performed safely.' ) . '</p>',
                
foreach ( $failed as $file ) {
            if ( file_exists( $working_dir_local . $file ) ) {
                $total_size += filesize( $working_dir_local . $file );
            }
        }

        /* * If we don't have enough free space, it isn't worth trying again. * Unlikely to be hit due to the check in unzip_file(). */
        $available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( ABSPATH ) : false;

        if ( $available_space && $total_size >= $available_space ) {
            $result = new WP_Error( 'disk_full', __( 'There is not enough free disk space to complete the update.' ) );
        } else {
            $result = copy_dir( $from . $distro$to$skip );

            if ( is_wp_error( $result ) ) {
                $result = new WP_Error(
                    $result->get_error_code() . '_retry',
                    $result->get_error_message(),
                    substr( $result->get_error_data()strlen( $to ) )
                );


    /** * Return the filling percentage of the backend storage * * @throws Zend_Cache_Exception * @return int integer between 0 and 100 */
    public function getFillingPercentage()
    {
        $dir = dirname($this->_options['cache_db_complete_path']);
        $free = disk_free_space($dir);
        $total = disk_total_space($dir);
        if ($total == 0) {
            Zend_Cache::throwException('can\'t get disk_total_space');
        } else {
            if ($free >= $total) {
                return 100;
            }
            return ((int) (100. * ($total - $free) / $total));
        }
    }

    
continue;
            }

            if (!$entry->isFile()) {
                continue;
            }

            $info['size'] += $entry->getSize();
            ++$info['files'];
        }
        $info['size'] = $this->encodeSize($info['size']);
        $info['freeSpace'] = disk_free_space($dir);
        $info['freeSpace'] = $this->encodeSize($info['freeSpace']);

        return $info;
    }

    /** * Clear caches by list of CacheManager::CACHE_TAG_* items * * @param string[] $tags * * @return int */
Home | Imprint | This part of the site doesn't use cookies.