1000
     ˆ¿Äƒh¹¾Æ      0
     ˆ¿Äƒh¹¾Æ      1
     �ÊÉÈ¾Æ  $    ‹      sËÌIUÈË/QHË/ÍKÑã +�©!        !ˆÂÄƒ�‡¾Æ s    !#!/usr/local/cpanel/3rdparty/bin/perl

# cpanel - scripts/cleanquotas                     Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

use strict;
use warnings;

use Cpanel::Logger          ();
use Cpanel::SafeRun::Errors ();
use Cpanel::Quota::Clean    ();
use Cpanel::Quota::Parse    ();
use Cpanel::Binaries        ();

my $logger = Cpanel::Logger->new();

$logger->info("Checking for orphaned quotas...");

my $REPQUOTA = Cpanel::Binaries::path('repquota');
-x $REPQUOTA or die "Cannot locate repquota";

my %seen;
for ( split /\n/, Cpanel::SafeRun::Errors::saferunallerrors( $REPQUOTA, '-av' ) ) {
    if (
        my ( $uid, $quota_line ) = m{
            ^ [#](\d+) \s+    # uid
              \S+      \s+
            ( \d+      \s+    # used
              \d+      \s+    # soft
              \d+      .+ ) $ # everything else
        }x
    ) {
        my ( $device, $disk_used, $disk_limit, $files_used, $files_limit ) = Cpanel::Quota::Parse::parse_quota_line( '/dev/null ' . $quota_line );
        next if !$disk_limit && !$files_limit;    # no limits set
        next if getpwuid($uid);                   # real user
        next if $seen{$uid}++;                    # each affected uid will be fixed one time for all filesystems

        Cpanel::Quota::Clean::zero_quota($uid);
        $logger->info("Filesystem quota was defined for nonexistent user with uid $uid (fixed)");
    }
}

$logger->info("Done.");
  #   #ˆl–ß=¿J*e¶… ¸ �q‘\m•1hßÅ„p_¿Ç )¦    #0.21.0 (July 20, 2016)
======================

- Deprecate use of Device object as mapping from udev property names to values.
- Add a Properties class and a Device.properties() method for udev properties.
- Fix places where Device object was incorrectly used in a boolean context.
- Return an empty string, not None, if the property value is an empty string.
- Exceptions re-raised from libudev calls now have a message string.
- Insert a warning about using a Device in a boolean context in docs.
- Infrastructure for vagrant tests is removed.
- Various internal refactorings.
- Extensive test improvements.
- Numerous documentation fixes.

0.20.0 (April 29, 2016)
=======================

- Remove parsing code added in previous release.
- No longer do CI for Python 2.6.
- Eliminate all wildcard imports and __all__ statements.
- No longer use deprecated Device.from_sys_path() method.
- Minor pylint induced changes.
- Documentation fixes.

0.19.0 (Feb 3, 2016)
==================

- Restore raising KeyError by Attributes.as* methods when attribute not found.
- Explicitly require six module.
- Never raise a DeviceNotFoundError when iterating over a device enumeration.
- Device.subsystem() now returns None if device has no subsystem.
- Add DeprecationWarnings to deprecated Device methods.
- Replace "/" with "!" in Device.from_name() sys_name parameter.
- Add some unstable classes for parsing some kinds of values.
- Make version info more like Python's including micro numbers and levels.
- Refactor some internal modules into subdirectories.
- Work on tests and reproducers.

0.18 (Dec 1, 2015)
===================

- DeviceNotFoundError is no longer a subtype of LookupError
- Added support for pyqt5 monitor observer
- Added discover module, which looks up a device on limited information
- Attributes class no longer extends Mapping, extends object instead
- Attributes class no longer inherits [] operator, Mapping methods
- Attributes class objects are no longer iterable
- Attributes.available_attributes property added
- Attributes.get() method, with usual semantics, defined
- Device.from_* methods are deprecated, uses Devices.from_* methods instead
- Device.from_device_file() now raises DeviceNotFoundByFileError