Plugin Directory

Changeset 2917289


Ignore:
Timestamp:
05/25/2023 11:33:14 AM (3 years ago)
Author:
wpsynchro
Message:

Update to version 1.9.1

Location:
wpsynchro
Files:
139 added
13 edited

Legend:

Unmodified
Added
Removed
  • wpsynchro/trunk/changelog.txt

    r2806797 r2917289  
     1= 1.9.1 =
     2 * Bump support for WP 6.2
     3 * Improvement: API now flushes data before returning
     4
    15= 1.9.0 =
    2  * Bug: Fix issue where MU plugin did not load properly
     6 * Bugfix: Fix issue where MU plugin did not load properly
    37 * Improvement: Ensure WP 6.1 and PHP 8.1 compatibility
    48 * Improvement: Improve the warning message when different versions of WP is used
     
    1418
    1519= 1.8.2 =
    16  * Bug: In some cases no search/replaces were done, when using the preconfigured migrations (the affected migrations will be deleted when updating to this version)
    17  * Bug: Certain MySQL version in 8.0.x range gave problems when migrating to MariaDB, which is now fixed by WP Synchro
    18  * Bug: Table prefix re-write failed, when there was already data in table with that prefix
     20 * Bugfix: In some cases no search/replaces were done, when using the preconfigured migrations (the affected migrations will be deleted when updating to this version)
     21 * Bugfix: Certain MySQL version in 8.0.x range gave problems when migrating to MariaDB, which is now fixed by WP Synchro
     22 * Bugfix: Table prefix re-write failed, when there was already data in table with that prefix
    1923 * Improvement: License information is now included with log files
    2024
  • wpsynchro/trunk/readme.txt

    r2806797 r2917289  
    1 === WordPress Migration Plugin DB & Files - WP Synchro ===
     1=== WP Synchro - WordPress Migration Plugin for Database & Files ===
    22Contributors: wpsynchro
    33Donate link: https://wpsynchro.com/?utm_source=wordpress.org&utm_medium=referral&utm_campaign=donate
    4 Tags: migrate,database,files,media,migration
     4Tags: migrate,clone,files,media,migration
    55Requires at least: 4.9
    6 Tested up to: 6.1
    7 Stable tag: 1.9.0
     6Tested up to: 6.2
     7Stable tag: 1.9.1
    88Requires PHP: 7.0
    99License: GPLv3
     
    115115== Changelog ==
    116116
     117= 1.9.1 =
     118 * Bump support for WP 6.2
     119 * Improvement: API now flushes data before returning
     120
    117121= 1.9.0 =
    118122 * Bug: Fix issue where MU plugin did not load properly
  • wpsynchro/trunk/src/API/LoadAPI.php

    r2806797 r2917289  
    2222                'check_permission' => false,
    2323                'class' => '\WPSynchro\API\Initiate',
    24                 'http_type' => 'POST',
    2524            ],
    2625            'wpsynchro_masterdata' => [
    2726                'check_permission' => true,
    2827                'class' => '\WPSynchro\API\MasterData',
    29                 'http_type' => 'POST',
    3028            ],
    3129            'wpsynchro_backupdatabase' => [
    3230                'check_permission' => true,
    3331                'class' => '\WPSynchro\API\DatabaseBackup',
    34                 'http_type' => 'POST',
    3532            ],
    3633            'wpsynchro_db_sync' => [
    3734                'check_permission' => true,
    3835                'class' => '\WPSynchro\API\ClientSyncDatabase',
    39                 'http_type' => 'POST',
    4036            ],
    4137            'wpsynchro_file_populate' => [
    4238                'check_permission' => true,
    4339                'class' => '\WPSynchro\API\PopulateFileList',
    44                 'http_type' => 'POST',
    4540            ],
    4641            'wpsynchro_file_populate_status' => [
    4742                'check_permission' => true,
    4843                'class' => '\WPSynchro\API\PopulateFileListStatus',
    49                 'http_type' => 'POST',
    5044            ],
    5145            'wpsynchro_file_push' => [
    5246                'check_permission' => true,
    5347                'class' => '\WPSynchro\API\FileTransfer',
    54                 'http_type' => 'POST',
    5548            ],
    5649            'wpsynchro_file_pull' => [
    5750                'check_permission' => true,
    5851                'class' => '\WPSynchro\API\GetFiles',
    59                 'http_type' => 'POST',
    6052            ],
    6153            'wpsynchro_file_finalize' => [
    6254                'check_permission' => true,
    6355                'class' => '\WPSynchro\API\FileFinalize',
    64                 'http_type' => 'POST',
    6556            ],
    6657            'wpsynchro_frontend_filesystem' => [
     
    7364                },
    7465                'class' => '\WPSynchro\API\Filesystem',
    75                 'http_type' => 'POST',
    7666            ],
    7767            'wpsynchro_frontend_verify_remote' => [
     
    8070                },
    8171                'class' => '\WPSynchro\API\VerifyMigration',
    82                 'http_type' => 'POST',
    8372            ],
    8473            'wpsynchro_frontend_healthcheck' => [
     
    8776                },
    8877                'class' => '\WPSynchro\API\HealthCheck',
    89                 'http_type' => 'POST',
    9078            ],
    9179            'wpsynchro_test' => [
     
    9785                    return;
    9886                },
    99                 'http_type' => 'GET',
    10087            ],
    10188            'wpsynchro_execute_action' => [
    10289                'check_permission' => true,
    10390                'class' => '\WPSynchro\API\ExecuteAction',
    104                 'http_type' => 'POST',
    10591            ],
    10692            'wpsynchro_frontend_download_log' => [
     
    10995                },
    11096                'class' => '\WPSynchro\API\DownloadLog',
    111                 'http_type' => 'GET',
    11297            ],
    11398            'wpsynchro_run_synchronize' => [
     
    120105                },
    121106                'class' => '\WPSynchro\API\Migrate',
    122                 'http_type' => 'POST',
    123107            ],
    124108            'wpsynchro_run_status' => [
     
    131115                },
    132116                'class' => '\WPSynchro\API\Status',
    133                 'http_type' => 'POST',
    134117            ],
    135118            'wpsynchro_run_status_file_changed_get' => [
     
    139122                    $obj->getFileChanges();
    140123                },
    141                 'http_type' => 'GET',
    142124            ],
    143125            'wpsynchro_run_status_file_changed_accept' => [
     
    147129                    $obj->acceptFileChanges();
    148130                },
    149                 'http_type' => 'POST',
    150131            ],
    151132        ];
     
    173154                // Get handler
    174155                $handler = $this->action_to_handler_mapping[$action];
    175                 // Check if correct HTTP type
    176                 if ($_SERVER['REQUEST_METHOD'] !== $handler['http_type']) {
    177                     return;
    178                 }
    179156
    180157                // If we need to check permission, do that first
     
    203180                    $obj->service();
    204181                }
     182
     183                ob_flush();
     184                flush();
    205185
    206186                die();
  • wpsynchro/trunk/vendor/autoload.php

    r2806797 r2917289  
    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
    7 return ComposerAutoloaderInit1098787fe2b87e786a8ba8e1000374da::getLoader();
     25return ComposerAutoloaderInit6ac74a5630382b13cd5eb589287c109a::getLoader();
  • wpsynchro/trunk/vendor/composer/ClassLoader.php

    r2535936 r2917289  
    4343class ClassLoader
    4444{
     45    /** @var \Closure(string):void */
     46    private static $includeFile;
     47
     48    /** @var ?string */
    4549    private $vendorDir;
    4650
    4751    // PSR-4
     52    /**
     53     * @var array[]
     54     * @psalm-var array<string, array<string, int>>
     55     */
    4856    private $prefixLengthsPsr4 = array();
     57    /**
     58     * @var array[]
     59     * @psalm-var array<string, array<int, string>>
     60     */
    4961    private $prefixDirsPsr4 = array();
     62    /**
     63     * @var array[]
     64     * @psalm-var array<string, string>
     65     */
    5066    private $fallbackDirsPsr4 = array();
    5167
    5268    // PSR-0
     69    /**
     70     * @var array[]
     71     * @psalm-var array<string, array<string, string[]>>
     72     */
    5373    private $prefixesPsr0 = array();
     74    /**
     75     * @var array[]
     76     * @psalm-var array<string, string>
     77     */
    5478    private $fallbackDirsPsr0 = array();
    5579
     80    /** @var bool */
    5681    private $useIncludePath = false;
     82
     83    /**
     84     * @var string[]
     85     * @psalm-var array<string, string>
     86     */
    5787    private $classMap = array();
     88
     89    /** @var bool */
    5890    private $classMapAuthoritative = false;
     91
     92    /**
     93     * @var bool[]
     94     * @psalm-var array<string, bool>
     95     */
    5996    private $missingClasses = array();
     97
     98    /** @var ?string */
    6099    private $apcuPrefix;
    61100
     101    /**
     102     * @var self[]
     103     */
    62104    private static $registeredLoaders = array();
    63105
     106    /**
     107     * @param ?string $vendorDir
     108     */
    64109    public function __construct($vendorDir = null)
    65110    {
    66111        $this->vendorDir = $vendorDir;
    67     }
    68 
     112        self::initializeIncludeClosure();
     113    }
     114
     115    /**
     116     * @return string[]
     117     */
    69118    public function getPrefixes()
    70119    {
     
    76125    }
    77126
     127    /**
     128     * @return array[]
     129     * @psalm-return array<string, array<int, string>>
     130     */
    78131    public function getPrefixesPsr4()
    79132    {
     
    81134    }
    82135
     136    /**
     137     * @return array[]
     138     * @psalm-return array<string, string>
     139     */
    83140    public function getFallbackDirs()
    84141    {
     
    86143    }
    87144
     145    /**
     146     * @return array[]
     147     * @psalm-return array<string, string>
     148     */
    88149    public function getFallbackDirsPsr4()
    89150    {
     
    91152    }
    92153
     154    /**
     155     * @return string[] Array of classname => path
     156     * @psalm-return array<string, string>
     157     */
    93158    public function getClassMap()
    94159    {
     
    97162
    98163    /**
    99      * @param array $classMap Class to filename map
     164     * @param string[] $classMap Class to filename map
     165     * @psalm-param array<string, string> $classMap
     166     *
     167     * @return void
    100168     */
    101169    public function addClassMap(array $classMap)
     
    112180     * appending or prepending to the ones previously set for this prefix.
    113181     *
    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
     182     * @param string          $prefix  The prefix
     183     * @param string[]|string $paths   The PSR-0 root directories
     184     * @param bool            $prepend Whether to prepend the directories
     185     *
     186     * @return void
    117187     */
    118188    public function add($prefix, $paths, $prepend = false)
     
    157227     * appending or prepending to the ones previously set for this namespace.
    158228     *
    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
     229     * @param string          $prefix  The prefix/namespace, with trailing '\\'
     230     * @param string[]|string $paths   The PSR-4 base directories
     231     * @param bool            $prepend Whether to prepend the directories
    162232     *
    163233     * @throws \InvalidArgumentException
     234     *
     235     * @return void
    164236     */
    165237    public function addPsr4($prefix, $paths, $prepend = false)
     
    205277     * replacing any others previously set for this prefix.
    206278     *
    207      * @param string       $prefix The prefix
    208      * @param array|string $paths  The PSR-0 base directories
     279     * @param string          $prefix The prefix
     280     * @param string[]|string $paths  The PSR-0 base directories
     281     *
     282     * @return void
    209283     */
    210284    public function set($prefix, $paths)
     
    221295     * replacing any others previously set for this namespace.
    222296     *
    223      * @param string       $prefix The prefix/namespace, with trailing '\\'
    224      * @param array|string $paths  The PSR-4 base directories
     297     * @param string          $prefix The prefix/namespace, with trailing '\\'
     298     * @param string[]|string $paths  The PSR-4 base directories
    225299     *
    226300     * @throws \InvalidArgumentException
     301     *
     302     * @return void
    227303     */
    228304    public function setPsr4($prefix, $paths)
     
    244320     *
    245321     * @param bool $useIncludePath
     322     *
     323     * @return void
    246324     */
    247325    public function setUseIncludePath($useIncludePath)
     
    266344     *
    267345     * @param bool $classMapAuthoritative
     346     *
     347     * @return void
    268348     */
    269349    public function setClassMapAuthoritative($classMapAuthoritative)
     
    286366     *
    287367     * @param string|null $apcuPrefix
     368     *
     369     * @return void
    288370     */
    289371    public function setApcuPrefix($apcuPrefix)
     
    306388     *
    307389     * @param bool $prepend Whether to prepend the autoloader or not
     390     *
     391     * @return void
    308392     */
    309393    public function register($prepend = false)
     
    325409    /**
    326410     * Unregisters this instance as an autoloader.
     411     *
     412     * @return void
    327413     */
    328414    public function unregister()
     
    339425     *
    340426     * @param  string    $class The name of the class
    341      * @return bool|null True if loaded, null otherwise
     427     * @return true|null True if loaded, null otherwise
    342428     */
    343429    public function loadClass($class)
    344430    {
    345431        if ($file = $this->findFile($class)) {
    346             includeFile($file);
     432            $includeFile = self::$includeFile;
     433            $includeFile($file);
    347434
    348435            return true;
    349436        }
     437
     438        return null;
    350439    }
    351440
     
    402491    }
    403492
     493    /**
     494     * @param  string       $class
     495     * @param  string       $ext
     496     * @return string|false
     497     */
    404498    private function findFileWithExtension($class, $ext)
    405499    {
     
    467561        return false;
    468562    }
     563
     564    /**
     565     * @return void
     566     */
     567    private static function initializeIncludeClosure()
     568    {
     569        if (self::$includeFile !== null) {
     570            return;
     571        }
     572
     573        /**
     574         * Scope isolated include.
     575         *
     576         * Prevents access to $this/self from included files.
     577         *
     578         * @param  string $file
     579         * @return void
     580         */
     581        self::$includeFile = \Closure::bind(static function($file) {
     582            include $file;
     583        }, null, null);
     584    }
    469585}
    470 
    471 /**
    472  * Scope isolated include.
    473  *
    474  * Prevents access to $this/self from included files.
    475  */
    476 function includeFile($file)
    477 {
    478     include $file;
    479 }
  • wpsynchro/trunk/vendor/composer/InstalledVersions.php

    r2806797 r2917289  
    11<?php
    22
    3 
    4 
    5 
    6 
    7 
    8 
    9 
    10 
    11 
     3/*
     4 * This file is part of Composer.
     5 *
     6 * (c) Nils Adermann <[email protected]>
     7 *     Jordi Boggiano <[email protected]>
     8 *
     9 * For the full copyright and license information, please view the LICENSE
     10 * file that was distributed with this source code.
     11 */
    1212
    1313namespace Composer;
     
    1616use Composer\Semver\VersionParser;
    1717
    18 
    19 
    20 
    21 
    22 
    23 
    24 
     18/**
     19 * This class is copied in every Composer installed project and available to all
     20 *
     21 * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
     22 *
     23 * To require its presence, you can require `composer-runtime-api ^2.0`
     24 *
     25 * @final
     26 */
    2527class InstalledVersions
    2628{
    27 private static $installed = array (
    28   'root' =>
    29   array (
    30     'pretty_version' => 'dev-master',
    31     'version' => 'dev-master',
    32     'aliases' =>
    33     array (
    34     ),
    35     'reference' => '6f4c15706122fdebcba9f2ea130fce5bd88fffe5',
    36     'name' => 'wpsynchro/wpsynchro',
    37   ),
    38   'versions' =>
    39   array (
    40     'wpsynchro/wpsynchro' =>
    41     array (
    42       'pretty_version' => 'dev-master',
    43       'version' => 'dev-master',
    44       'aliases' =>
    45       array (
    46       ),
    47       'reference' => '6f4c15706122fdebcba9f2ea130fce5bd88fffe5',
    48     ),
    49   ),
    50 );
    51 private static $canGetVendors;
    52 private static $installedByVendor = array();
    53 
    54 
    55 
    56 
    57 
    58 
    59 
    60 public static function getInstalledPackages()
    61 {
    62 $packages = array();
    63 foreach (self::getInstalled() as $installed) {
    64 $packages[] = array_keys($installed['versions']);
     29    /**
     30     * @var mixed[]|null
     31     * @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
     32     */
     33    private static $installed;
     34
     35    /**
     36     * @var bool|null
     37     */
     38    private static $canGetVendors;
     39
     40    /**
     41     * @var array[]
     42     * @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[]}>}>
     43     */
     44    private static $installedByVendor = array();
     45
     46    /**
     47     * Returns a list of all package names which are present, either by being installed, replaced or provided
     48     *
     49     * @return string[]
     50     * @psalm-return list<string>
     51     */
     52    public static function getInstalledPackages()
     53    {
     54        $packages = array();
     55        foreach (self::getInstalled() as $installed) {
     56            $packages[] = array_keys($installed['versions']);
     57        }
     58
     59        if (1 === \count($packages)) {
     60            return $packages[0];
     61        }
     62
     63        return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
     64    }
     65
     66    /**
     67     * Returns a list of all package names with a specific type e.g. 'library'
     68     *
     69     * @param  string   $type
     70     * @return string[]
     71     * @psalm-return list<string>
     72     */
     73    public static function getInstalledPackagesByType($type)
     74    {
     75        $packagesByType = array();
     76
     77        foreach (self::getInstalled() as $installed) {
     78            foreach ($installed['versions'] as $name => $package) {
     79                if (isset($package['type']) && $package['type'] === $type) {
     80                    $packagesByType[] = $name;
     81                }
     82            }
     83        }
     84
     85        return $packagesByType;
     86    }
     87
     88    /**
     89     * Checks whether the given package is installed
     90     *
     91     * This also returns true if the package name is provided or replaced by another package
     92     *
     93     * @param  string $packageName
     94     * @param  bool   $includeDevRequirements
     95     * @return bool
     96     */
     97    public static function isInstalled($packageName, $includeDevRequirements = true)
     98    {
     99        foreach (self::getInstalled() as $installed) {
     100            if (isset($installed['versions'][$packageName])) {
     101                return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
     102            }
     103        }
     104
     105        return false;
     106    }
     107
     108    /**
     109     * Checks whether the given package satisfies a version constraint
     110     *
     111     * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
     112     *
     113     *   Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
     114     *
     115     * @param  VersionParser $parser      Install composer/semver to have access to this class and functionality
     116     * @param  string        $packageName
     117     * @param  string|null   $constraint  A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
     118     * @return bool
     119     */
     120    public static function satisfies(VersionParser $parser, $packageName, $constraint)
     121    {
     122        $constraint = $parser->parseConstraints($constraint);
     123        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
     124
     125        return $provided->matches($constraint);
     126    }
     127
     128    /**
     129     * Returns a version constraint representing all the range(s) which are installed for a given package
     130     *
     131     * It is easier to use this via isInstalled() with the $constraint argument if you need to check
     132     * whether a given version of a package is installed, and not just whether it exists
     133     *
     134     * @param  string $packageName
     135     * @return string Version constraint usable with composer/semver
     136     */
     137    public static function getVersionRanges($packageName)
     138    {
     139        foreach (self::getInstalled() as $installed) {
     140            if (!isset($installed['versions'][$packageName])) {
     141                continue;
     142            }
     143
     144            $ranges = array();
     145            if (isset($installed['versions'][$packageName]['pretty_version'])) {
     146                $ranges[] = $installed['versions'][$packageName]['pretty_version'];
     147            }
     148            if (array_key_exists('aliases', $installed['versions'][$packageName])) {
     149                $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
     150            }
     151            if (array_key_exists('replaced', $installed['versions'][$packageName])) {
     152                $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
     153            }
     154            if (array_key_exists('provided', $installed['versions'][$packageName])) {
     155                $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
     156            }
     157
     158            return implode(' || ', $ranges);
     159        }
     160
     161        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     162    }
     163
     164    /**
     165     * @param  string      $packageName
     166     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
     167     */
     168    public static function getVersion($packageName)
     169    {
     170        foreach (self::getInstalled() as $installed) {
     171            if (!isset($installed['versions'][$packageName])) {
     172                continue;
     173            }
     174
     175            if (!isset($installed['versions'][$packageName]['version'])) {
     176                return null;
     177            }
     178
     179            return $installed['versions'][$packageName]['version'];
     180        }
     181
     182        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     183    }
     184
     185    /**
     186     * @param  string      $packageName
     187     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
     188     */
     189    public static function getPrettyVersion($packageName)
     190    {
     191        foreach (self::getInstalled() as $installed) {
     192            if (!isset($installed['versions'][$packageName])) {
     193                continue;
     194            }
     195
     196            if (!isset($installed['versions'][$packageName]['pretty_version'])) {
     197                return null;
     198            }
     199
     200            return $installed['versions'][$packageName]['pretty_version'];
     201        }
     202
     203        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     204    }
     205
     206    /**
     207     * @param  string      $packageName
     208     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
     209     */
     210    public static function getReference($packageName)
     211    {
     212        foreach (self::getInstalled() as $installed) {
     213            if (!isset($installed['versions'][$packageName])) {
     214                continue;
     215            }
     216
     217            if (!isset($installed['versions'][$packageName]['reference'])) {
     218                return null;
     219            }
     220
     221            return $installed['versions'][$packageName]['reference'];
     222        }
     223
     224        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     225    }
     226
     227    /**
     228     * @param  string      $packageName
     229     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
     230     */
     231    public static function getInstallPath($packageName)
     232    {
     233        foreach (self::getInstalled() as $installed) {
     234            if (!isset($installed['versions'][$packageName])) {
     235                continue;
     236            }
     237
     238            return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
     239        }
     240
     241        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     242    }
     243
     244    /**
     245     * @return array
     246     * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
     247     */
     248    public static function getRootPackage()
     249    {
     250        $installed = self::getInstalled();
     251
     252        return $installed[0]['root'];
     253    }
     254
     255    /**
     256     * Returns the raw installed.php data for custom implementations
     257     *
     258     * @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.
     259     * @return array[]
     260     * @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[]}>}
     261     */
     262    public static function getRawData()
     263    {
     264        @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
     265
     266        if (null === self::$installed) {
     267            // only require the installed.php file if this file is loaded from its dumped location,
     268            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
     269            if (substr(__DIR__, -8, 1) !== 'C') {
     270                self::$installed = include __DIR__ . '/installed.php';
     271            } else {
     272                self::$installed = array();
     273            }
     274        }
     275
     276        return self::$installed;
     277    }
     278
     279    /**
     280     * Returns the raw data of all installed.php which are currently loaded for custom implementations
     281     *
     282     * @return array[]
     283     * @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[]}>}>
     284     */
     285    public static function getAllRawData()
     286    {
     287        return self::getInstalled();
     288    }
     289
     290    /**
     291     * Lets you reload the static array from another file
     292     *
     293     * This is only useful for complex integrations in which a project needs to use
     294     * this class but then also needs to execute another project's autoloader in process,
     295     * and wants to ensure both projects have access to their version of installed.php.
     296     *
     297     * A typical case would be PHPUnit, where it would need to make sure it reads all
     298     * the data it needs from this class, then call reload() with
     299     * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
     300     * the project in which it runs can then also use this class safely, without
     301     * interference between PHPUnit's dependencies and the project's dependencies.
     302     *
     303     * @param  array[] $data A vendor/composer/installed.php data set
     304     * @return void
     305     *
     306     * @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
     307     */
     308    public static function reload($data)
     309    {
     310        self::$installed = $data;
     311        self::$installedByVendor = array();
     312    }
     313
     314    /**
     315     * @return array[]
     316     * @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[]}>}>
     317     */
     318    private static function getInstalled()
     319    {
     320        if (null === self::$canGetVendors) {
     321            self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
     322        }
     323
     324        $installed = array();
     325
     326        if (self::$canGetVendors) {
     327            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     328                if (isset(self::$installedByVendor[$vendorDir])) {
     329                    $installed[] = self::$installedByVendor[$vendorDir];
     330                } elseif (is_file($vendorDir.'/composer/installed.php')) {
     331                    $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
     332                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
     333                        self::$installed = $installed[count($installed) - 1];
     334                    }
     335                }
     336            }
     337        }
     338
     339        if (null === self::$installed) {
     340            // only require the installed.php file if this file is loaded from its dumped location,
     341            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
     342            if (substr(__DIR__, -8, 1) !== 'C') {
     343                self::$installed = require __DIR__ . '/installed.php';
     344            } else {
     345                self::$installed = array();
     346            }
     347        }
     348        $installed[] = self::$installed;
     349
     350        return $installed;
     351    }
    65352}
    66 
    67 if (1 === \count($packages)) {
    68 return $packages[0];
    69 }
    70 
    71 return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
    72 }
    73 
    74 
    75 
    76 
    77 
    78 
    79 
    80 
    81 
    82 public static function isInstalled($packageName)
    83 {
    84 foreach (self::getInstalled() as $installed) {
    85 if (isset($installed['versions'][$packageName])) {
    86 return true;
    87 }
    88 }
    89 
    90 return false;
    91 }
    92 
    93 
    94 
    95 
    96 
    97 
    98 
    99 
    100 
    101 
    102 
    103 
    104 
    105 
    106 public static function satisfies(VersionParser $parser, $packageName, $constraint)
    107 {
    108 $constraint = $parser->parseConstraints($constraint);
    109 $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    110 
    111 return $provided->matches($constraint);
    112 }
    113 
    114 
    115 
    116 
    117 
    118 
    119 
    120 
    121 
    122 
    123 public static function getVersionRanges($packageName)
    124 {
    125 foreach (self::getInstalled() as $installed) {
    126 if (!isset($installed['versions'][$packageName])) {
    127 continue;
    128 }
    129 
    130 $ranges = array();
    131 if (isset($installed['versions'][$packageName]['pretty_version'])) {
    132 $ranges[] = $installed['versions'][$packageName]['pretty_version'];
    133 }
    134 if (array_key_exists('aliases', $installed['versions'][$packageName])) {
    135 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
    136 }
    137 if (array_key_exists('replaced', $installed['versions'][$packageName])) {
    138 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
    139 }
    140 if (array_key_exists('provided', $installed['versions'][$packageName])) {
    141 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
    142 }
    143 
    144 return implode(' || ', $ranges);
    145 }
    146 
    147 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    148 }
    149 
    150 
    151 
    152 
    153 
    154 public static function getVersion($packageName)
    155 {
    156 foreach (self::getInstalled() as $installed) {
    157 if (!isset($installed['versions'][$packageName])) {
    158 continue;
    159 }
    160 
    161 if (!isset($installed['versions'][$packageName]['version'])) {
    162 return null;
    163 }
    164 
    165 return $installed['versions'][$packageName]['version'];
    166 }
    167 
    168 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    169 }
    170 
    171 
    172 
    173 
    174 
    175 public static function getPrettyVersion($packageName)
    176 {
    177 foreach (self::getInstalled() as $installed) {
    178 if (!isset($installed['versions'][$packageName])) {
    179 continue;
    180 }
    181 
    182 if (!isset($installed['versions'][$packageName]['pretty_version'])) {
    183 return null;
    184 }
    185 
    186 return $installed['versions'][$packageName]['pretty_version'];
    187 }
    188 
    189 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    190 }
    191 
    192 
    193 
    194 
    195 
    196 public static function getReference($packageName)
    197 {
    198 foreach (self::getInstalled() as $installed) {
    199 if (!isset($installed['versions'][$packageName])) {
    200 continue;
    201 }
    202 
    203 if (!isset($installed['versions'][$packageName]['reference'])) {
    204 return null;
    205 }
    206 
    207 return $installed['versions'][$packageName]['reference'];
    208 }
    209 
    210 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    211 }
    212 
    213 
    214 
    215 
    216 
    217 public static function getRootPackage()
    218 {
    219 $installed = self::getInstalled();
    220 
    221 return $installed[0]['root'];
    222 }
    223 
    224 
    225 
    226 
    227 
    228 
    229 
    230 public static function getRawData()
    231 {
    232 return self::$installed;
    233 }
    234 
    235 
    236 
    237 
    238 
    239 
    240 
    241 
    242 
    243 
    244 
    245 
    246 
    247 
    248 
    249 
    250 
    251 
    252 
    253 public static function reload($data)
    254 {
    255 self::$installed = $data;
    256 self::$installedByVendor = array();
    257 }
    258 
    259 
    260 
    261 
    262 
    263 private static function getInstalled()
    264 {
    265 if (null === self::$canGetVendors) {
    266 self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
    267 }
    268 
    269 $installed = array();
    270 
    271 if (self::$canGetVendors) {
    272 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
    273 if (isset(self::$installedByVendor[$vendorDir])) {
    274 $installed[] = self::$installedByVendor[$vendorDir];
    275 } elseif (is_file($vendorDir.'/composer/installed.php')) {
    276 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
    277 }
    278 }
    279 }
    280 
    281 $installed[] = self::$installed;
    282 
    283 return $installed;
    284 }
    285 }
  • wpsynchro/trunk/vendor/composer/autoload_classmap.php

    r2740471 r2917289  
    33// autoload_classmap.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • wpsynchro/trunk/vendor/composer/autoload_namespaces.php

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

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

    r2806797 r2917289  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit1098787fe2b87e786a8ba8e1000374da
     5class ComposerAutoloaderInit6ac74a5630382b13cd5eb589287c109a
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit1098787fe2b87e786a8ba8e1000374da', 'loadClassLoader'), true, true);
    28         self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit1098787fe2b87e786a8ba8e1000374da', 'loadClassLoader'));
     27        spl_autoload_register(array('ComposerAutoloaderInit6ac74a5630382b13cd5eb589287c109a', 'loadClassLoader'), true, true);
     28        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit6ac74a5630382b13cd5eb589287c109a', '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\ComposerStaticInit1098787fe2b87e786a8ba8e1000374da::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\ComposerStaticInit6ac74a5630382b13cd5eb589287c109a::getInitializer($loader));
    5233
    5334        $loader->register(true);
  • wpsynchro/trunk/vendor/composer/autoload_static.php

    r2806797 r2917289  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit1098787fe2b87e786a8ba8e1000374da
     7class ComposerStaticInit6ac74a5630382b13cd5eb589287c109a
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    129129    {
    130130        return \Closure::bind(function () use ($loader) {
    131             $loader->prefixLengthsPsr4 = ComposerStaticInit1098787fe2b87e786a8ba8e1000374da::$prefixLengthsPsr4;
    132             $loader->prefixDirsPsr4 = ComposerStaticInit1098787fe2b87e786a8ba8e1000374da::$prefixDirsPsr4;
    133             $loader->classMap = ComposerStaticInit1098787fe2b87e786a8ba8e1000374da::$classMap;
     131            $loader->prefixLengthsPsr4 = ComposerStaticInit6ac74a5630382b13cd5eb589287c109a::$prefixLengthsPsr4;
     132            $loader->prefixDirsPsr4 = ComposerStaticInit6ac74a5630382b13cd5eb589287c109a::$prefixDirsPsr4;
     133            $loader->classMap = ComposerStaticInit6ac74a5630382b13cd5eb589287c109a::$classMap;
    134134
    135135        }, null, ClassLoader::class);
  • wpsynchro/trunk/vendor/composer/installed.php

    r2806797 r2917289  
    1 <?php return array (
    2   'root' =>
    3   array (
    4     'pretty_version' => 'dev-master',
    5     'version' => 'dev-master',
    6     'aliases' =>
    7     array (
     1<?php return array(
     2    'root' => array(
     3        'name' => 'wpsynchro/wpsynchro',
     4        'pretty_version' => 'dev-master',
     5        'version' => 'dev-master',
     6        'reference' => '40d2505613c1ab904e79dabf208da312f9b440b1',
     7        'type' => 'wordpress-plugin',
     8        'install_path' => __DIR__ . '/../../',
     9        'aliases' => array(),
     10        'dev' => false,
    811    ),
    9     'reference' => '6f4c15706122fdebcba9f2ea130fce5bd88fffe5',
    10     'name' => 'wpsynchro/wpsynchro',
    11   ),
    12   'versions' =>
    13   array (
    14     'wpsynchro/wpsynchro' =>
    15     array (
    16       'pretty_version' => 'dev-master',
    17       'version' => 'dev-master',
    18       'aliases' =>
    19       array (
    20       ),
    21       'reference' => '6f4c15706122fdebcba9f2ea130fce5bd88fffe5',
     12    'versions' => array(
     13        'wpsynchro/wpsynchro' => array(
     14            'pretty_version' => 'dev-master',
     15            'version' => 'dev-master',
     16            'reference' => '40d2505613c1ab904e79dabf208da312f9b440b1',
     17            'type' => 'wordpress-plugin',
     18            'install_path' => __DIR__ . '/../../',
     19            'aliases' => array(),
     20            'dev_requirement' => false,
     21        ),
    2222    ),
    23   ),
    2423);
  • wpsynchro/trunk/wpsynchro.php

    r2806797 r2917289  
    44  Plugin URI: https://wpsynchro.com/home
    55  Description: Complete migration plugin for WordPress - Migration of database and files made easy
    6   Version: 1.9.0
     6  Version: 1.9.1
    77  Author: WPSynchro
    88  Author URI: https://wpsynchro.com
     
    3434} // Exit if accessed directly
    3535
    36 define('WPSYNCHRO_VERSION', '1.9.0');
     36define('WPSYNCHRO_VERSION', '1.9.1');
    3737define('WPSYNCHRO_DB_VERSION', '9');
    3838define('WPSYNCHRO_NEWEST_MU_COMPATIBILITY_VERSION', '1.0.5');
Note: See TracChangeset for help on using the changeset viewer.