Plugin Directory

Changeset 3293356


Ignore:
Timestamp:
05/14/2025 02:18:29 PM (9 months ago)
Author:
spinupwp
Message:

Preparing for 1.8.0 release

Location:
spinupwp/trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • spinupwp/trunk/drop-ins/object-cache.php

    r3029656 r3293356  
    44Plugin URI: http://wordpress.org/plugins/spinupwp/
    55Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, HHVM, replication, clustering and WP-CLI.
    6 Version: 1.5.1
     6Version: 1.8.0
    77Author: SpinupWP
    88Author URI: https://spinupwp.com/
     
    634634            'host' => '127.0.0.1',
    635635            'port' => 6379,
    636             'database' => 0,
     636            'database' => getenv('SPINUPWP_CACHE_DB') ?? 0,
    637637            'timeout' => 5,
    638638            'read_timeout' => 5,
     
    653653        ];
    654654
     655
     656        if ( getenv( 'SPINUPWP_CACHE_USERNAME' ) && getenv( 'SPINUPWP_CACHE_PASSWORD' ) ) {
     657            $parameters['password'] = [getenv( 'SPINUPWP_CACHE_USERNAME' ), getenv( 'SPINUPWP_CACHE_PASSWORD' )];
     658        }
     659
    655660        foreach ( $settings as $setting ) {
    656661            $constant = sprintf( 'WP_REDIS_%s', strtoupper( $setting ) );
     
    736741
    737742            if ( isset( $parameters['password'] ) ) {
     743
    738744                $args['password'] = $parameters['password'];
     745
    739746                $this->redis->auth( $parameters['password'] );
    740747            }
  • spinupwp/trunk/readme.txt

    r3192083 r3293356  
    33Tags: cache, caching, performance
    44Requires at least: 4.7
    5 Tested up to: 6.7
     5Tested up to: 6.8
    66Requires PHP: 7.1
    7 Stable tag: 1.7.1
     7Stable tag: 1.8.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    8787== Changelog ==
    8888
     89= 1.8.0 (2025-05-13) =
     90* New: Support for Redis ACL and separate Redis databases
     91* Improvement: Register cache command when page cache disabled
     92* Bug Fix: Purge URLs with and without trailing slash
     93* Bug Fix: Replace for FILTER_SANITIZE_STRING which is now deprecated
     94* Bug Fix: Fix "load_text_domain" notice
     95
    8996= 1.7.1 (2024-06-03) =
    9097* Bug Fix: Magic Login not working when WordPress installed in a subdirectory.
  • spinupwp/trunk/spinupwp.php

    r3111769 r3293356  
    55Description:  SpinupWP helper plugin.
    66Author:       SpinupWP
    7 Version:      1.7.1
     7Version:      1.8.0
    88Network:      True
    99Text Domain:  spinupwp
  • spinupwp/trunk/src/AdminNotices.php

    r2774192 r3293356  
    5252        }
    5353
    54         $notice = filter_var( $_POST['notice'], FILTER_SANITIZE_STRING );
     54        $notice = isset( $_POST['notice'] ) ? sanitize_text_field( $_POST['notice'] ) : '';
     55
     56        if ( empty( $notice ) ) {
     57            wp_die( - 1, 400 );
     58        }
    5559
    5660        update_site_option( "spinupwp_{$notice}_notice_dismissed", true );
  • spinupwp/trunk/src/Cache.php

    r3029656 r3293356  
    3939        $this->set_cache_path();
    4040
    41         if ( $this->is_object_cache_enabled() && $this->is_page_cache_enabled() ) {
    42             $this->admin_bar->add_item( __( 'Purge All Caches', 'spinupwp' ), 'purge-all' );
    43         }
    44 
    45         if ( $this->is_object_cache_enabled() ) {
    46             $this->admin_bar->add_item( __( 'Purge Object Cache', 'spinupwp' ), 'purge-object' );
    47         }
    48 
    49         if ( $this->is_page_cache_enabled() ) {
    50             $this->admin_bar->add_item( __( 'Purge Page Cache', 'spinupwp' ), 'purge-page' );
    51             $this->cli->register_command( 'spinupwp cache', CacheCommands::class );
    52         }
    53 
    54         if ( $this->is_page_cache_enabled() && ! is_admin() ) {
    55             $this->admin_bar->add_item( __( 'Purge this URL', 'spinupwp' ), 'purge-url' );
    56         }
    57 
     41        $this->cli->register_command( 'spinupwp cache', CacheCommands::class );
     42
     43        add_action( 'init', array( $this, 'register_admin_bar_menu_items' ) );
    5844        add_action( 'spinupwp_purge_object_cache', array( $this, 'purge_object_cache' ) );
    5945        add_action( 'spinupwp_purge_page_cache', array( $this, 'purge_page_cache' ) );
     
    6854    }
    6955
     56    /**
     57     * Register cache purge menu items in the admin bar.
     58     *
     59     * @return void
     60     */
     61    public function register_admin_bar_menu_items() {
     62        if ( $this->is_object_cache_enabled() && $this->is_page_cache_enabled() ) {
     63            $this->admin_bar->add_item( __( 'Purge All Caches', 'spinupwp' ), 'purge-all' );
     64        }
     65
     66        if ( $this->is_object_cache_enabled() ) {
     67            $this->admin_bar->add_item( __( 'Purge Object Cache', 'spinupwp' ), 'purge-object' );
     68        }
     69
     70        if ( $this->is_page_cache_enabled() ) {
     71            $this->admin_bar->add_item( __( 'Purge Page Cache', 'spinupwp' ), 'purge-page' );
     72        }
     73
     74        if ( $this->is_page_cache_enabled() && ! is_admin() ) {
     75            $this->admin_bar->add_item( __( 'Purge this URL', 'spinupwp' ), 'purge-url' );
     76        }
     77    }
     78
    7079
    7180    /**
     
    8998        if ( 'purge-all' === $action ) {
    9099            $purge_object_cache = $this->purge_object_cache();
    91             $purge_page_cache = $this->purge_page_cache();
    92            
     100            $purge_page_cache   = $this->purge_page_cache();
     101
    93102            $purge = $purge_object_cache && $purge_page_cache;
    94103            $type  = 'all';
     
    104113            $type  = 'page';
    105114        }
    106        
     115
    107116        if ( 'purge-url' === $action ) {
    108             $url = $_SERVER['HTTP_REFERER'];
    109             $purge = $this->purge_url($url);
     117            $url   = $_SERVER['HTTP_REFERER'];
     118            $purge = $this->purge_url( $url );
    110119            $type  = 'url';
    111120        }
     
    303312    public function purge_url( $url ) {
    304313        $cache_paths = $this->get_cache_paths_for_url( $url );
    305        
     314
    306315        $all_deleted = true;
    307         foreach ($cache_paths as $path) {
    308             $deleted =  $this->delete( $path );
     316        foreach ( $cache_paths as $path ) {
     317            $deleted = $this->delete( $path );
    309318            do_action( 'spinupwp_url_purged', $url, $deleted );
    310319            $all_deleted &= $deleted;
    311320        }
    312        
     321
    313322        return $all_deleted;
    314323    }
     
    316325    /**
    317326     * Gets the cache file paths for a given URL.
    318      * 
     327     *
    319328     * Must be using the default Nginx cache options (levels=1:2)
    320329     * https://www.digitalocean.com/community/tutorials/how-to-setup-fastcgi-caching-with-nginx-on-your-vps#purging-the-cache
     
    326335    private function get_cache_paths_for_url( $url ) {
    327336        $cache_keys = $this->get_cache_keys_for_url( $url );
    328        
     337
    329338        $cache_paths = array();
    330         foreach ($cache_keys as $key) {
    331             $hashed_key = md5($key);
    332             $path = substr( $hashed_key, - 1 ) . '/' . substr( $hashed_key, - 3, 2 ) . '/' . $hashed_key;
     339        foreach ( $cache_keys as $key ) {
     340            $hashed_key    = md5( $key );
     341            $path          = substr( $hashed_key, - 1 ) . '/' . substr( $hashed_key, - 3, 2 ) . '/' . $hashed_key;
    333342            $cache_paths[] = trailingslashit( $this->cache_path ) . $path;
    334343        }
    335        
     344
    336345        return $cache_paths;
    337346    }
     
    349358     */
    350359    private function get_cache_keys_for_url( $url ) {
    351         // Default cache key
    352         $parsed_url = parse_url( trailingslashit( $url ) );
    353         $cache_keys = array($parsed_url['scheme'] . 'GET' . $parsed_url['host'] . $parsed_url['path']);
     360        $parsed_url = parse_url( $url );
     361
     362        $cache_keys = array(
     363            $parsed_url['scheme'] . 'GET' . $parsed_url['host'] . trailingslashit( $parsed_url['path'] ),
     364            $parsed_url['scheme'] . 'GET' . $parsed_url['host'] . untrailingslashit( $parsed_url['path'] ),
     365        );
    354366
    355367        // Allow the cache keys to be modified
    356         $cache_keys = apply_filters('spinupwp_cache_keys_for_url', $cache_keys, $url);
    357        
     368        $cache_keys = apply_filters( 'spinupwp_cache_keys_for_url', $cache_keys, $url );
     369
    358370        return $cache_keys;
    359371    }
  • spinupwp/trunk/src/Cli/CacheCommands.php

    r2774192 r3293356  
    2525     */
    2626    public function purge_site() {
     27        if ( ! spinupwp()->cache->is_page_cache_enabled() ) {
     28            WP_CLI::error( __( 'The page cache is not enabled.', 'spinupwp' ) );
     29        }
     30
    2731        if ( spinupwp()->cache->purge_page_cache() ) {
    2832            WP_CLI::success( __( 'The page cache was purged.', 'spinupwp' ) );
     
    4751     */
    4852    public function purge_post( $args ) {
     53        if ( ! spinupwp()->cache->is_page_cache_enabled() ) {
     54            WP_CLI::error( __( 'The page cache is not enabled.', 'spinupwp' ) );
     55        }
     56
    4957        $post = get_post( $args[0] );
    5058
     
    7785     */
    7886    public function purge_url( $args ) {
     87        if ( ! spinupwp()->cache->is_page_cache_enabled() ) {
     88            WP_CLI::error( __( 'The page cache is not enabled.', 'spinupwp' ) );
     89        }
     90
    7991        if ( spinupwp()->cache->purge_url( $args[0] ) ) {
    8092            WP_CLI::success( __( 'URL purged from the page cache.', 'spinupwp' ) );
  • spinupwp/trunk/vendor/autoload.php

    r2089375 r3293356  
    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    throw new RuntimeException($err);
     18}
     19
    520require_once __DIR__ . '/composer/autoload_real.php';
    621
  • spinupwp/trunk/vendor/composer/ClassLoader.php

    r2671502 r3293356  
    4343class ClassLoader
    4444{
     45    /** @var \Closure(string):void */
     46    private static $includeFile;
     47
     48    /** @var string|null */
    4549    private $vendorDir;
    4650
    4751    // PSR-4
     52    /**
     53     * @var array<string, array<string, int>>
     54     */
    4855    private $prefixLengthsPsr4 = array();
     56    /**
     57     * @var array<string, list<string>>
     58     */
    4959    private $prefixDirsPsr4 = array();
     60    /**
     61     * @var list<string>
     62     */
    5063    private $fallbackDirsPsr4 = array();
    5164
    5265    // PSR-0
     66    /**
     67     * List of PSR-0 prefixes
     68     *
     69     * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
     70     *
     71     * @var array<string, array<string, list<string>>>
     72     */
    5373    private $prefixesPsr0 = array();
     74    /**
     75     * @var list<string>
     76     */
    5477    private $fallbackDirsPsr0 = array();
    5578
     79    /** @var bool */
    5680    private $useIncludePath = false;
     81
     82    /**
     83     * @var array<string, string>
     84     */
    5785    private $classMap = array();
     86
     87    /** @var bool */
    5888    private $classMapAuthoritative = false;
     89
     90    /**
     91     * @var array<string, bool>
     92     */
    5993    private $missingClasses = array();
     94
     95    /** @var string|null */
    6096    private $apcuPrefix;
    6197
     98    /**
     99     * @var array<string, self>
     100     */
    62101    private static $registeredLoaders = array();
    63102
     103    /**
     104     * @param string|null $vendorDir
     105     */
    64106    public function __construct($vendorDir = null)
    65107    {
    66108        $this->vendorDir = $vendorDir;
    67     }
    68 
     109        self::initializeIncludeClosure();
     110    }
     111
     112    /**
     113     * @return array<string, list<string>>
     114     */
    69115    public function getPrefixes()
    70116    {
     
    76122    }
    77123
     124    /**
     125     * @return array<string, list<string>>
     126     */
    78127    public function getPrefixesPsr4()
    79128    {
     
    81130    }
    82131
     132    /**
     133     * @return list<string>
     134     */
    83135    public function getFallbackDirs()
    84136    {
     
    86138    }
    87139
     140    /**
     141     * @return list<string>
     142     */
    88143    public function getFallbackDirsPsr4()
    89144    {
     
    91146    }
    92147
     148    /**
     149     * @return array<string, string> Array of classname => path
     150     */
    93151    public function getClassMap()
    94152    {
     
    97155
    98156    /**
    99      * @param array $classMap Class to filename map
     157     * @param array<string, string> $classMap Class to filename map
     158     *
     159     * @return void
    100160     */
    101161    public function addClassMap(array $classMap)
     
    112172     * appending or prepending to the ones previously set for this prefix.
    113173     *
    114      * @param string       $prefix  The prefix
    115      * @param array|string $paths   The PSR-0 root directories
    116      * @param bool         $prepend Whether to prepend the directories
     174     * @param string              $prefix  The prefix
     175     * @param list<string>|string $paths   The PSR-0 root directories
     176     * @param bool                $prepend Whether to prepend the directories
     177     *
     178     * @return void
    117179     */
    118180    public function add($prefix, $paths, $prepend = false)
    119181    {
     182        $paths = (array) $paths;
    120183        if (!$prefix) {
    121184            if ($prepend) {
    122185                $this->fallbackDirsPsr0 = array_merge(
    123                     (array) $paths,
     186                    $paths,
    124187                    $this->fallbackDirsPsr0
    125188                );
     
    127190                $this->fallbackDirsPsr0 = array_merge(
    128191                    $this->fallbackDirsPsr0,
    129                     (array) $paths
     192                    $paths
    130193                );
    131194            }
     
    136199        $first = $prefix[0];
    137200        if (!isset($this->prefixesPsr0[$first][$prefix])) {
    138             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
     201            $this->prefixesPsr0[$first][$prefix] = $paths;
    139202
    140203            return;
     
    142205        if ($prepend) {
    143206            $this->prefixesPsr0[$first][$prefix] = array_merge(
    144                 (array) $paths,
     207                $paths,
    145208                $this->prefixesPsr0[$first][$prefix]
    146209            );
     
    148211            $this->prefixesPsr0[$first][$prefix] = array_merge(
    149212                $this->prefixesPsr0[$first][$prefix],
    150                 (array) $paths
     213                $paths
    151214            );
    152215        }
     
    157220     * appending or prepending to the ones previously set for this namespace.
    158221     *
    159      * @param string       $prefix  The prefix/namespace, with trailing '\\'
    160      * @param array|string $paths   The PSR-4 base directories
    161      * @param bool         $prepend Whether to prepend the directories
     222     * @param string              $prefix  The prefix/namespace, with trailing '\\'
     223     * @param list<string>|string $paths   The PSR-4 base directories
     224     * @param bool                $prepend Whether to prepend the directories
    162225     *
    163226     * @throws \InvalidArgumentException
     227     *
     228     * @return void
    164229     */
    165230    public function addPsr4($prefix, $paths, $prepend = false)
    166231    {
     232        $paths = (array) $paths;
    167233        if (!$prefix) {
    168234            // Register directories for the root namespace.
    169235            if ($prepend) {
    170236                $this->fallbackDirsPsr4 = array_merge(
    171                     (array) $paths,
     237                    $paths,
    172238                    $this->fallbackDirsPsr4
    173239                );
     
    175241                $this->fallbackDirsPsr4 = array_merge(
    176242                    $this->fallbackDirsPsr4,
    177                     (array) $paths
     243                    $paths
    178244                );
    179245            }
     
    185251            }
    186252            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    187             $this->prefixDirsPsr4[$prefix] = (array) $paths;
     253            $this->prefixDirsPsr4[$prefix] = $paths;
    188254        } elseif ($prepend) {
    189255            // Prepend directories for an already registered namespace.
    190256            $this->prefixDirsPsr4[$prefix] = array_merge(
    191                 (array) $paths,
     257                $paths,
    192258                $this->prefixDirsPsr4[$prefix]
    193259            );
     
    196262            $this->prefixDirsPsr4[$prefix] = array_merge(
    197263                $this->prefixDirsPsr4[$prefix],
    198                 (array) $paths
     264                $paths
    199265            );
    200266        }
     
    205271     * replacing any others previously set for this prefix.
    206272     *
    207      * @param string       $prefix The prefix
    208      * @param array|string $paths  The PSR-0 base directories
     273     * @param string              $prefix The prefix
     274     * @param list<string>|string $paths  The PSR-0 base directories
     275     *
     276     * @return void
    209277     */
    210278    public function set($prefix, $paths)
     
    221289     * replacing any others previously set for this namespace.
    222290     *
    223      * @param string       $prefix The prefix/namespace, with trailing '\\'
    224      * @param array|string $paths  The PSR-4 base directories
     291     * @param string              $prefix The prefix/namespace, with trailing '\\'
     292     * @param list<string>|string $paths  The PSR-4 base directories
    225293     *
    226294     * @throws \InvalidArgumentException
     295     *
     296     * @return void
    227297     */
    228298    public function setPsr4($prefix, $paths)
     
    244314     *
    245315     * @param bool $useIncludePath
     316     *
     317     * @return void
    246318     */
    247319    public function setUseIncludePath($useIncludePath)
     
    266338     *
    267339     * @param bool $classMapAuthoritative
     340     *
     341     * @return void
    268342     */
    269343    public function setClassMapAuthoritative($classMapAuthoritative)
     
    286360     *
    287361     * @param string|null $apcuPrefix
     362     *
     363     * @return void
    288364     */
    289365    public function setApcuPrefix($apcuPrefix)
     
    306382     *
    307383     * @param bool $prepend Whether to prepend the autoloader or not
     384     *
     385     * @return void
    308386     */
    309387    public function register($prepend = false)
     
    325403    /**
    326404     * Unregisters this instance as an autoloader.
     405     *
     406     * @return void
    327407     */
    328408    public function unregister()
     
    344424    {
    345425        if ($file = $this->findFile($class)) {
    346             includeFile($file);
     426            $includeFile = self::$includeFile;
     427            $includeFile($file);
    347428
    348429            return true;
     
    395476
    396477    /**
    397      * Returns the currently registered loaders indexed by their corresponding vendor directories.
    398      *
    399      * @return self[]
     478     * Returns the currently registered loaders keyed by their corresponding vendor directories.
     479     *
     480     * @return array<string, self>
    400481     */
    401482    public static function getRegisteredLoaders()
     
    404485    }
    405486
     487    /**
     488     * @param  string       $class
     489     * @param  string       $ext
     490     * @return string|false
     491     */
    406492    private function findFileWithExtension($class, $ext)
    407493    {
     
    469555        return false;
    470556    }
     557
     558    /**
     559     * @return void
     560     */
     561    private static function initializeIncludeClosure()
     562    {
     563        if (self::$includeFile !== null) {
     564            return;
     565        }
     566
     567        /**
     568         * Scope isolated include.
     569         *
     570         * Prevents access to $this/self from included files.
     571         *
     572         * @param  string $file
     573         * @return void
     574         */
     575        self::$includeFile = \Closure::bind(static function($file) {
     576            include $file;
     577        }, null, null);
     578    }
    471579}
    472 
    473 /**
    474  * Scope isolated include.
    475  *
    476  * Prevents access to $this/self from included files.
    477  */
    478 function includeFile($file)
    479 {
    480     include $file;
    481 }
  • spinupwp/trunk/vendor/composer/InstalledVersions.php

    r2671502 r3293356  
    2121 * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
    2222 *
    23  * To require it's presence, you can require `composer-runtime-api ^2.0`
     23 * To require its presence, you can require `composer-runtime-api ^2.0`
     24 *
     25 * @final
    2426 */
    2527class InstalledVersions
    2628{
     29    /**
     30     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
     31     * @internal
     32     */
     33    private static $selfDir = null;
     34
     35    /**
     36     * @var mixed[]|null
     37     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
     38     */
    2739    private static $installed;
     40
     41    /**
     42     * @var bool
     43     */
     44    private static $installedIsLocalDir;
     45
     46    /**
     47     * @var bool|null
     48     */
    2849    private static $canGetVendors;
     50
     51    /**
     52     * @var array[]
     53     * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
     54     */
    2955    private static $installedByVendor = array();
    3056
     
    84110        foreach (self::getInstalled() as $installed) {
    85111            if (isset($installed['versions'][$packageName])) {
    86                 return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
     112                return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
    87113            }
    88114        }
     
    105131    public static function satisfies(VersionParser $parser, $packageName, $constraint)
    106132    {
    107         $constraint = $parser->parseConstraints($constraint);
     133        $constraint = $parser->parseConstraints((string) $constraint);
    108134        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    109135
     
    229255    /**
    230256     * @return array
    231      * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}
     257     * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
    232258     */
    233259    public static function getRootPackage()
     
    243269     * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
    244270     * @return array[]
    245      * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}
     271     * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
    246272     */
    247273    public static function getRawData()
     
    266292     *
    267293     * @return array[]
    268      * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
     294     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
    269295     */
    270296    public static function getAllRawData()
     
    289315     * @return void
    290316     *
    291      * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>} $data
     317     * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
    292318     */
    293319    public static function reload($data)
     
    295321        self::$installed = $data;
    296322        self::$installedByVendor = array();
     323
     324        // when using reload, we disable the duplicate protection to ensure that self::$installed data is
     325        // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
     326        // so we have to assume it does not, and that may result in duplicate data being returned when listing
     327        // all installed packages for example
     328        self::$installedIsLocalDir = false;
     329    }
     330
     331    /**
     332     * @return string
     333     */
     334    private static function getSelfDir()
     335    {
     336        if (self::$selfDir === null) {
     337            self::$selfDir = strtr(__DIR__, '\\', '/');
     338        }
     339
     340        return self::$selfDir;
    297341    }
    298342
    299343    /**
    300344     * @return array[]
    301      * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
     345     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
    302346     */
    303347    private static function getInstalled()
     
    308352
    309353        $installed = array();
     354        $copiedLocalDir = false;
    310355
    311356        if (self::$canGetVendors) {
     357            $selfDir = self::getSelfDir();
    312358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     359                $vendorDir = strtr($vendorDir, '\\', '/');
    313360                if (isset(self::$installedByVendor[$vendorDir])) {
    314361                    $installed[] = self::$installedByVendor[$vendorDir];
    315362                } elseif (is_file($vendorDir.'/composer/installed.php')) {
    316                     $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
    317                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    318                         self::$installed = $installed[count($installed) - 1];
     363                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     364                    $required = require $vendorDir.'/composer/installed.php';
     365                    self::$installedByVendor[$vendorDir] = $required;
     366                    $installed[] = $required;
     367                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
     368                        self::$installed = $required;
     369                        self::$installedIsLocalDir = true;
    319370                    }
     371                }
     372                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     373                    $copiedLocalDir = true;
    320374                }
    321375            }
     
    326380            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
    327381            if (substr(__DIR__, -8, 1) !== 'C') {
    328                 self::$installed = require __DIR__ . '/installed.php';
     382                /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     383                $required = require __DIR__ . '/installed.php';
     384                self::$installed = $required;
    329385            } else {
    330386                self::$installed = array();
    331387            }
    332388        }
    333         $installed[] = self::$installed;
     389
     390        if (self::$installed !== array() && !$copiedLocalDir) {
     391            $installed[] = self::$installed;
     392        }
    334393
    335394        return $installed;
  • spinupwp/trunk/vendor/composer/autoload_classmap.php

    r2812614 r3293356  
    33// autoload_classmap.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
     
    1616    'SpinupWp\\Compatibility' => $baseDir . '/src/Compatibility.php',
    1717    'SpinupWp\\Compatibility\\ElementorPlugin' => $baseDir . '/src/Compatibility/ElementorPlugin.php',
     18    'SpinupWp\\MagicLogin' => $baseDir . '/src/MagicLogin.php',
    1819    'SpinupWp\\Plugin' => $baseDir . '/src/Plugin.php',
    1920    'SpinupWp\\SiteHealth' => $baseDir . '/src/SiteHealth.php',
  • spinupwp/trunk/vendor/composer/autoload_files.php

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

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

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

    r2671502 r3293356  
    2626
    2727        spl_autoload_register(array('ComposerAutoloaderInita5abb26a347fc40977ca46c39480b5aa', 'loadClassLoader'), true, true);
    28         self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
     28        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    2929        spl_autoload_unregister(array('ComposerAutoloaderInita5abb26a347fc40977ca46c39480b5aa', 'loadClassLoader'));
    3030
    31         $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
    32         if ($useStaticLoader) {
    33             require __DIR__ . '/autoload_static.php';
    34 
    35             call_user_func(\Composer\Autoload\ComposerStaticInita5abb26a347fc40977ca46c39480b5aa::getInitializer($loader));
    36         } else {
    37             $map = require __DIR__ . '/autoload_namespaces.php';
    38             foreach ($map as $namespace => $path) {
    39                 $loader->set($namespace, $path);
    40             }
    41 
    42             $map = require __DIR__ . '/autoload_psr4.php';
    43             foreach ($map as $namespace => $path) {
    44                 $loader->setPsr4($namespace, $path);
    45             }
    46 
    47             $classMap = require __DIR__ . '/autoload_classmap.php';
    48             if ($classMap) {
    49                 $loader->addClassMap($classMap);
    50             }
    51         }
     31        require __DIR__ . '/autoload_static.php';
     32        call_user_func(\Composer\Autoload\ComposerStaticInita5abb26a347fc40977ca46c39480b5aa::getInitializer($loader));
    5233
    5334        $loader->register(true);
    5435
    55         if ($useStaticLoader) {
    56             $includeFiles = Composer\Autoload\ComposerStaticInita5abb26a347fc40977ca46c39480b5aa::$files;
    57         } else {
    58             $includeFiles = require __DIR__ . '/autoload_files.php';
    59         }
    60         foreach ($includeFiles as $fileIdentifier => $file) {
    61             composerRequirea5abb26a347fc40977ca46c39480b5aa($fileIdentifier, $file);
     36        $filesToLoad = \Composer\Autoload\ComposerStaticInita5abb26a347fc40977ca46c39480b5aa::$files;
     37        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
     38            if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
     39                $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
     40
     41                require $file;
     42            }
     43        }, null, null);
     44        foreach ($filesToLoad as $fileIdentifier => $file) {
     45            $requireFile($fileIdentifier, $file);
    6246        }
    6347
     
    6549    }
    6650}
    67 
    68 function composerRequirea5abb26a347fc40977ca46c39480b5aa($fileIdentifier, $file)
    69 {
    70     if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
    71         require $file;
    72 
    73         $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
    74     }
    75 }
  • spinupwp/trunk/vendor/composer/autoload_static.php

    r2812614 r3293356  
    3535        'SpinupWp\\Compatibility' => __DIR__ . '/../..' . '/src/Compatibility.php',
    3636        'SpinupWp\\Compatibility\\ElementorPlugin' => __DIR__ . '/../..' . '/src/Compatibility/ElementorPlugin.php',
     37        'SpinupWp\\MagicLogin' => __DIR__ . '/../..' . '/src/MagicLogin.php',
    3738        'SpinupWp\\Plugin' => __DIR__ . '/../..' . '/src/Plugin.php',
    3839        'SpinupWp\\SiteHealth' => __DIR__ . '/../..' . '/src/SiteHealth.php',
  • spinupwp/trunk/vendor/composer/installed.php

    r2812614 r3293356  
    11<?php return array(
    22    'root' => array(
     3        'name' => 'spinupwp/spinupwp-plugin',
    34        'pretty_version' => 'trunk',
    45        'version' => 'dev-trunk',
     6        'reference' => null,
    57        'type' => 'wordpress-plugin',
    68        'install_path' => __DIR__ . '/../../',
    79        'aliases' => array(),
    8         'reference' => NULL,
    9         'name' => 'spinupwp/spinupwp-plugin',
    1010        'dev' => false,
    1111    ),
     
    1414            'pretty_version' => 'trunk',
    1515            'version' => 'dev-trunk',
     16            'reference' => null,
    1617            'type' => 'wordpress-plugin',
    1718            'install_path' => __DIR__ . '/../../',
    1819            'aliases' => array(),
    19             'reference' => NULL,
    2020            'dev_requirement' => false,
    2121        ),
Note: See TracChangeset for help on using the changeset viewer.