Plugin Directory

Changeset 2816792


Ignore:
Timestamp:
11/11/2022 06:56:44 PM (3 years ago)
Author:
stockpack
Message:

Improve composer performance

Location:
stockpack/trunk
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • stockpack/trunk/composer.json

    r2393460 r2816792  
    2222        "tareq1988/wordpress-settings-api-class": "~1.2",
    2323        "collizo4sky/persist-admin-notices-dismissal": "~1.4.3"
     24    },
     25    "config": {
     26        "prepend-autoloader": false
    2427    }
    2528}
  • stockpack/trunk/readme.txt

    r2815781 r2816792  
    44Requires at least: 4.6
    55Tested up to: 6.1.0
    6 Stable tag: 3.3.4
     6Stable tag: 3.3.5
    77License: GPL
    88License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
     
    135135
    136136= 3.3.4 =
     137Regenerated composer with -a flag
     138
     139= 3.3.4 =
    137140Add providers checkbox to settings page
    138141
  • stockpack/trunk/stockpack.php

    r2815781 r2816792  
    66 * Author: Derikon Development
    77 * Author URI: https://derikon.com/
    8  * Version: 3.3.4
     8 * Version: 3.3.5
    99 * Text Domain: stockpack
    1010 * Domain Path: /languages
  • stockpack/trunk/vendor/autoload.php

    r2311398 r2816792  
    33// autoload.php @generated by Composer
    44
     5if (PHP_VERSION_ID < 50600) {
     6    if (!headers_sent()) {
     7        header('HTTP/1.1 500 Internal Server Error');
     8    }
     9    $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
     10    if (!ini_get('display_errors')) {
     11        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
     12            fwrite(STDERR, $err);
     13        } elseif (!headers_sent()) {
     14            echo $err;
     15        }
     16    }
     17    trigger_error(
     18        $err,
     19        E_USER_ERROR
     20    );
     21}
     22
    523require_once __DIR__ . '/composer/autoload_real.php';
    624
  • stockpack/trunk/vendor/composer/ClassLoader.php

    r2393460 r2816792  
    3838 * @author Fabien Potencier <fabien@symfony.com>
    3939 * @author Jordi Boggiano <j.boggiano@seld.be>
    40  * @see    http://www.php-fig.org/psr/psr-0/
    41  * @see    http://www.php-fig.org/psr/psr-4/
     40 * @see    https://www.php-fig.org/psr/psr-0/
     41 * @see    https://www.php-fig.org/psr/psr-4/
    4242 */
    4343class ClassLoader
    4444{
     45    /** @var ?string */
     46    private $vendorDir;
     47
    4548    // PSR-4
     49    /**
     50     * @var array[]
     51     * @psalm-var array<string, array<string, int>>
     52     */
    4653    private $prefixLengthsPsr4 = array();
     54    /**
     55     * @var array[]
     56     * @psalm-var array<string, array<int, string>>
     57     */
    4758    private $prefixDirsPsr4 = array();
     59    /**
     60     * @var array[]
     61     * @psalm-var array<string, string>
     62     */
    4863    private $fallbackDirsPsr4 = array();
    4964
    5065    // PSR-0
     66    /**
     67     * @var array[]
     68     * @psalm-var array<string, array<string, string[]>>
     69     */
    5170    private $prefixesPsr0 = array();
     71    /**
     72     * @var array[]
     73     * @psalm-var array<string, string>
     74     */
    5275    private $fallbackDirsPsr0 = array();
    5376
     77    /** @var bool */
    5478    private $useIncludePath = false;
     79
     80    /**
     81     * @var string[]
     82     * @psalm-var array<string, string>
     83     */
    5584    private $classMap = array();
     85
     86    /** @var bool */
    5687    private $classMapAuthoritative = false;
     88
     89    /**
     90     * @var bool[]
     91     * @psalm-var array<string, bool>
     92     */
    5793    private $missingClasses = array();
     94
     95    /** @var ?string */
    5896    private $apcuPrefix;
    5997
     98    /**
     99     * @var self[]
     100     */
     101    private static $registeredLoaders = array();
     102
     103    /**
     104     * @param ?string $vendorDir
     105     */
     106    public function __construct($vendorDir = null)
     107    {
     108        $this->vendorDir = $vendorDir;
     109    }
     110
     111    /**
     112     * @return string[]
     113     */
    60114    public function getPrefixes()
    61115    {
    62116        if (!empty($this->prefixesPsr0)) {
    63             return call_user_func_array('array_merge', $this->prefixesPsr0);
     117            return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
    64118        }
    65119
     
    67121    }
    68122
     123    /**
     124     * @return array[]
     125     * @psalm-return array<string, array<int, string>>
     126     */
    69127    public function getPrefixesPsr4()
    70128    {
     
    72130    }
    73131
     132    /**
     133     * @return array[]
     134     * @psalm-return array<string, string>
     135     */
    74136    public function getFallbackDirs()
    75137    {
     
    77139    }
    78140
     141    /**
     142     * @return array[]
     143     * @psalm-return array<string, string>
     144     */
    79145    public function getFallbackDirsPsr4()
    80146    {
     
    82148    }
    83149
     150    /**
     151     * @return string[] Array of classname => path
     152     * @psalm-return array<string, string>
     153     */
    84154    public function getClassMap()
    85155    {
     
    88158
    89159    /**
    90      * @param array $classMap Class to filename map
     160     * @param string[] $classMap Class to filename map
     161     * @psalm-param array<string, string> $classMap
     162     *
     163     * @return void
    91164     */
    92165    public function addClassMap(array $classMap)
     
    103176     * appending or prepending to the ones previously set for this prefix.
    104177     *
    105      * @param string       $prefix  The prefix
    106      * @param array|string $paths   The PSR-0 root directories
    107      * @param bool         $prepend Whether to prepend the directories
     178     * @param string          $prefix  The prefix
     179     * @param string[]|string $paths   The PSR-0 root directories
     180     * @param bool            $prepend Whether to prepend the directories
     181     *
     182     * @return void
    108183     */
    109184    public function add($prefix, $paths, $prepend = false)
     
    148223     * appending or prepending to the ones previously set for this namespace.
    149224     *
    150      * @param string       $prefix  The prefix/namespace, with trailing '\\'
    151      * @param array|string $paths   The PSR-4 base directories
    152      * @param bool         $prepend Whether to prepend the directories
     225     * @param string          $prefix  The prefix/namespace, with trailing '\\'
     226     * @param string[]|string $paths   The PSR-4 base directories
     227     * @param bool            $prepend Whether to prepend the directories
    153228     *
    154229     * @throws \InvalidArgumentException
     230     *
     231     * @return void
    155232     */
    156233    public function addPsr4($prefix, $paths, $prepend = false)
     
    196273     * replacing any others previously set for this prefix.
    197274     *
    198      * @param string       $prefix The prefix
    199      * @param array|string $paths  The PSR-0 base directories
     275     * @param string          $prefix The prefix
     276     * @param string[]|string $paths  The PSR-0 base directories
     277     *
     278     * @return void
    200279     */
    201280    public function set($prefix, $paths)
     
    212291     * replacing any others previously set for this namespace.
    213292     *
    214      * @param string       $prefix The prefix/namespace, with trailing '\\'
    215      * @param array|string $paths  The PSR-4 base directories
     293     * @param string          $prefix The prefix/namespace, with trailing '\\'
     294     * @param string[]|string $paths  The PSR-4 base directories
    216295     *
    217296     * @throws \InvalidArgumentException
     297     *
     298     * @return void
    218299     */
    219300    public function setPsr4($prefix, $paths)
     
    235316     *
    236317     * @param bool $useIncludePath
     318     *
     319     * @return void
    237320     */
    238321    public function setUseIncludePath($useIncludePath)
     
    257340     *
    258341     * @param bool $classMapAuthoritative
     342     *
     343     * @return void
    259344     */
    260345    public function setClassMapAuthoritative($classMapAuthoritative)
     
    277362     *
    278363     * @param string|null $apcuPrefix
     364     *
     365     * @return void
    279366     */
    280367    public function setApcuPrefix($apcuPrefix)
     
    297384     *
    298385     * @param bool $prepend Whether to prepend the autoloader or not
     386     *
     387     * @return void
    299388     */
    300389    public function register($prepend = false)
    301390    {
    302391        spl_autoload_register(array($this, 'loadClass'), true, $prepend);
     392
     393        if (null === $this->vendorDir) {
     394            return;
     395        }
     396
     397        if ($prepend) {
     398            self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
     399        } else {
     400            unset(self::$registeredLoaders[$this->vendorDir]);
     401            self::$registeredLoaders[$this->vendorDir] = $this;
     402        }
    303403    }
    304404
    305405    /**
    306406     * Unregisters this instance as an autoloader.
     407     *
     408     * @return void
    307409     */
    308410    public function unregister()
    309411    {
    310412        spl_autoload_unregister(array($this, 'loadClass'));
     413
     414        if (null !== $this->vendorDir) {
     415            unset(self::$registeredLoaders[$this->vendorDir]);
     416        }
    311417    }
    312418
     
    315421     *
    316422     * @param  string    $class The name of the class
    317      * @return bool|null True if loaded, null otherwise
     423     * @return true|null True if loaded, null otherwise
    318424     */
    319425    public function loadClass($class)
     
    324430            return true;
    325431        }
     432
     433        return null;
    326434    }
    327435
     
    368476    }
    369477
     478    /**
     479     * Returns the currently registered loaders indexed by their corresponding vendor directories.
     480     *
     481     * @return self[]
     482     */
     483    public static function getRegisteredLoaders()
     484    {
     485        return self::$registeredLoaders;
     486    }
     487
     488    /**
     489     * @param  string       $class
     490     * @param  string       $ext
     491     * @return string|false
     492     */
    370493    private function findFileWithExtension($class, $ext)
    371494    {
     
    439562 *
    440563 * Prevents access to $this/self from included files.
     564 *
     565 * @param  string $file
     566 * @return void
     567 * @private
    441568 */
    442569function includeFile($file)
  • stockpack/trunk/vendor/composer/autoload_classmap.php

    r2393460 r2816792  
    33// autoload_classmap.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
    88return array(
     9    'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
    910    'PAnD' => $vendorDir . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php',
    1011    'StockpackAdmin' => $baseDir . '/src/class-stockpackadmin.php',
  • stockpack/trunk/vendor/composer/autoload_files.php

    r2393460 r2816792  
    33// autoload_files.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • stockpack/trunk/vendor/composer/autoload_namespaces.php

    r2205013 r2816792  
    33// autoload_namespaces.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • stockpack/trunk/vendor/composer/autoload_psr4.php

    r2311380 r2816792  
    33// autoload_psr4.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • stockpack/trunk/vendor/composer/autoload_real.php

    r2393460 r2816792  
    2323        }
    2424
    25         spl_autoload_register(array('ComposerAutoloaderIniteeaf91f5611f5a62896fdf85026b48c8', 'loadClassLoader'), true, true);
    26         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
     25        require __DIR__ . '/platform_check.php';
     26
     27        spl_autoload_register(array('ComposerAutoloaderIniteeaf91f5611f5a62896fdf85026b48c8', 'loadClassLoader'), true, false);
     28        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    2729        spl_autoload_unregister(array('ComposerAutoloaderIniteeaf91f5611f5a62896fdf85026b48c8', 'loadClassLoader'));
    2830
    29         $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
    30         if ($useStaticLoader) {
    31             require_once __DIR__ . '/autoload_static.php';
     31        require __DIR__ . '/autoload_static.php';
     32        call_user_func(\Composer\Autoload\ComposerStaticIniteeaf91f5611f5a62896fdf85026b48c8::getInitializer($loader));
    3233
    33             call_user_func(\Composer\Autoload\ComposerStaticIniteeaf91f5611f5a62896fdf85026b48c8::getInitializer($loader));
    34         } else {
    35             $map = require __DIR__ . '/autoload_namespaces.php';
    36             foreach ($map as $namespace => $path) {
    37                 $loader->set($namespace, $path);
    38             }
     34        $loader->setClassMapAuthoritative(true);
     35        $loader->register(false);
    3936
    40             $map = require __DIR__ . '/autoload_psr4.php';
    41             foreach ($map as $namespace => $path) {
    42                 $loader->setPsr4($namespace, $path);
    43             }
    44 
    45             $classMap = require __DIR__ . '/autoload_classmap.php';
    46             if ($classMap) {
    47                 $loader->addClassMap($classMap);
    48             }
    49         }
    50 
    51         $loader->register(true);
    52 
    53         if ($useStaticLoader) {
    54             $includeFiles = Composer\Autoload\ComposerStaticIniteeaf91f5611f5a62896fdf85026b48c8::$files;
    55         } else {
    56             $includeFiles = require __DIR__ . '/autoload_files.php';
    57         }
     37        $includeFiles = \Composer\Autoload\ComposerStaticIniteeaf91f5611f5a62896fdf85026b48c8::$files;
    5838        foreach ($includeFiles as $fileIdentifier => $file) {
    5939            composerRequireeeaf91f5611f5a62896fdf85026b48c8($fileIdentifier, $file);
     
    6444}
    6545
     46/**
     47 * @param string $fileIdentifier
     48 * @param string $file
     49 * @return void
     50 */
    6651function composerRequireeeaf91f5611f5a62896fdf85026b48c8($fileIdentifier, $file)
    6752{
    6853    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
     54        $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
     55
    6956        require $file;
    70 
    71         $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
    7257    }
    7358}
  • stockpack/trunk/vendor/composer/autoload_static.php

    r2393460 r2816792  
    1212
    1313    public static $classMap = array (
     14        'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
    1415        'PAnD' => __DIR__ . '/..' . '/collizo4sky/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php',
    1516        'StockpackAdmin' => __DIR__ . '/../..' . '/src/class-stockpackadmin.php',
Note: See TracChangeset for help on using the changeset viewer.