Plugin Directory

Changeset 3299013


Ignore:
Timestamp:
05/22/2025 07:19:17 PM (7 months ago)
Author:
boonebgorges
Message:

Create tag 2.2.5.

Location:
buddypress-docs
Files:
22 edited
1 copied

Legend:

Unmodified
Added
Removed
  • buddypress-docs/tags/2.2.5/includes/component.php

    r3162780 r3299013  
    458458        if ( ! empty( $_POST['doc-edit-submit'] ) || ! empty( $_POST['doc-edit-submit-continue'] ) ) {
    459459
    460             // Existing Docs have a more specific permission check.
    461             $doc = bp_docs_get_current_doc();
    462             if ( $doc && ! current_user_can( 'bp_docs_edit', $doc->ID ) ) {
    463                 return;
    464             } elseif ( ! $doc && ! current_user_can( 'bp_docs_create' ) ) {
    465                 return;
    466             }
    467 
     460            $doc_id = false;
     461            if ( isset( $_POST['doc-id'] ) ) {
     462                $doc_id = absint( $_POST['doc-id'] );
     463            }
     464
     465            $current_doc = bp_docs_get_current_doc();
     466            if ( $current_doc ) {
     467                // Don't allow editing if there's a mismatch.
     468                if ( $doc_id && $doc_id !== $current_doc->ID ) {
     469                    return;
     470                }
     471
     472                $doc_id = $current_doc->ID;
     473            }
     474
     475            // Legacy.
    468476            check_admin_referer( 'bp_docs_save' );
     477
     478            if ( $doc_id ) {
     479                check_admin_referer( 'bp_docs_edit_' . (string) $doc_id, 'bp_docs_edit_nonce' );
     480            }
    469481
    470482            $result = bp_docs_save_doc_via_post();
  • buddypress-docs/tags/2.2.5/includes/functions.php

    r1957023 r3299013  
    11111111    );
    11121112
    1113     if ( isset( $_POST['doc_id'] ) && 0 != $_POST['doc_id'] ) {
     1113    if ( empty( $args['doc_id'] ) && ! empty( $_POST['doc_id'] ) ) {
    11141114        $args['doc_id'] = (int) $_POST['doc_id'];
     1115    }
     1116
     1117    // Existing Docs have a more specific permission check.
     1118    if ( $args['doc_id'] && ! current_user_can( 'bp_docs_edit', $args['doc_id'] ) ) {
     1119        return;
     1120    } elseif ( ! $args['doc_id'] && ! current_user_can( 'bp_docs_create' ) ) {
     1121        return;
    11151122    }
    11161123
  • buddypress-docs/tags/2.2.5/includes/templatetags-edit.php

    r3162780 r3299013  
    9898        return apply_filters( 'bp_docs_get_edit_doc_content', $content );
    9999    }
     100
     101/**
     102 * Echoes a nonce field for specific doc editing.
     103 *
     104 * @since 2.2.5
     105 *
     106 * @param int $doc_id The ID of the doc being edited. If not set, will use the current doc.
     107 *                    We make this optional because old templates may not pass it.
     108 * @return void
     109 */
     110function bp_docs_edit_doc_nonce( $doc_id = null ) {
     111    if ( ! $doc_id ) {
     112        $doc = bp_docs_get_current_doc();
     113        if ( $doc ) {
     114            $doc_id = $doc->ID;
     115        }
     116    }
     117
     118    if ( ! $doc_id ) {
     119        return;
     120    }
     121
     122    wp_nonce_field( 'bp_docs_edit_' . (string) $doc_id, 'bp_docs_edit_nonce' );
     123}
     124add_action( 'bp_docs_before_doc_edit_content', 'bp_docs_edit_doc_nonce' );
    100125
    101126/**
  • buddypress-docs/tags/2.2.5/languages/buddypress-docs-ro_RO.po

    r1777844 r3299013  
    215215#: includes/templates/docs/docs-loop.php:79
    216216msgid "Viewing %1$s-%2$s of %3$s docs"
    217 msgstr "Vizualizarea %1$ s-% 2$ s de %3$ s docs"
     217msgstr "Vizualizarea %1$s-%2$s de %3$s docs"
    218218
    219219#: includes/templates/docs/docs-loop.php:89
  • buddypress-docs/tags/2.2.5/languages/buddypress-docs.pot

    r3162780 r3299013  
    1 # Copyright (C) 2024 Boone B Gorges, David Cavins
     1# Copyright (C) 2025 Boone B Gorges, David Cavins
    22# This file is distributed under the same license as the BuddyPress Docs plugin.
    33msgid ""
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-10-04T09:14:01-05:00\n"
     12"POT-Creation-Date: 2025-05-22T14:13:55-05:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.9.0\n"
     
    568568
    569569#: includes/attachments.php:434
    570 #: includes/component.php:1091
     570#: includes/component.php:1103
    571571msgid "Upload File"
    572572msgstr ""
    573573
    574574#: includes/attachments.php:435
    575 #: includes/component.php:1092
     575#: includes/component.php:1104
    576576msgid "OK"
    577577msgstr ""
     
    693693msgstr ""
    694694
    695 #: includes/component.php:495
     695#: includes/component.php:507
    696696msgid "This doc is currently being edited by %s. To prevent overwrites, you cannot edit until that user has finished. Please try again in a few minutes."
    697697msgstr ""
    698698
    699 #: includes/component.php:508
     699#: includes/component.php:520
    700700msgid "You do not have permission to edit the doc."
    701701msgstr ""
    702702
    703 #: includes/component.php:522
     703#: includes/component.php:534
    704704msgid "You do not have permission to create a Doc in this group."
    705705msgstr ""
    706706
    707 #: includes/component.php:536
     707#: includes/component.php:548
    708708msgid "You do not have permission to view this Doc's history."
    709709msgstr ""
    710710
    711 #: includes/component.php:560
     711#: includes/component.php:572
    712712msgid "Lock successfully removed"
    713713msgstr ""
    714714
    715 #: includes/component.php:592
     715#: includes/component.php:604
    716716msgid "Doc successfully deleted!"
    717717msgstr ""
    718718
    719 #: includes/component.php:594
     719#: includes/component.php:606
    720720msgid "Could not delete doc."
    721721msgstr ""
    722722
    723 #: includes/component.php:597
     723#: includes/component.php:609
    724724msgid "You do not have permission to delete that doc."
    725725msgstr ""
    726726
    727 #: includes/component.php:618
     727#: includes/component.php:630
    728728msgid "Doc successfully removed from Trash!"
    729729msgstr ""
    730730
    731 #: includes/component.php:620
     731#: includes/component.php:632
    732732msgid "Could not remove Doc from Trash."
    733733msgstr ""
    734734
    735 #: includes/component.php:623
     735#: includes/component.php:635
    736736msgid "You do not have permission to remove that Doc from the Trash."
    737737msgstr ""
    738738
    739 #: includes/component.php:638
     739#: includes/component.php:650
    740740msgid "Doc successfully removed from the group"
    741741msgstr ""
    742742
    743 #: includes/component.php:640
     743#: includes/component.php:652
    744744msgid "Could not remove Doc from the group."
    745745msgstr ""
    746746
    747 #: includes/component.php:643
     747#: includes/component.php:655
    748748msgid "You do not have permission to remove that Doc from this group."
    749749msgstr ""
    750750
    751 #: includes/component.php:978
    752 #: includes/component.php:1001
    753 #: includes/component.php:1003
     751#: includes/component.php:990
     752#: includes/component.php:1013
     753#: includes/component.php:1015
    754754msgid "Search"
    755755msgstr ""
    756756
    757 #: includes/component.php:1086
     757#: includes/component.php:1098
    758758msgid "and %d more"
    759759msgstr ""
    760760
    761 #: includes/component.php:1088
     761#: includes/component.php:1100
    762762msgid "show all tags"
    763763msgstr ""
    764764
    765 #: includes/component.php:1089
     765#: includes/component.php:1101
    766766msgid "show fewer tags"
    767767msgstr ""
    768768
    769 #: includes/component.php:1090
     769#: includes/component.php:1102
    770770msgid "Still working?"
    771771msgstr ""
     
    11641164msgstr ""
    11651165
    1166 #: includes/templatetags-edit.php:147
     1166#: includes/templatetags-edit.php:172
    11671167msgid "(no parent)"
    11681168msgstr ""
  • buddypress-docs/tags/2.2.5/loader.php

    r3162780 r3299013  
    44Plugin URI: http://github.com/boonebgorges/buddypress-docs
    55Description: Adds collaborative Docs to BuddyPress
    6 Version: 2.2.4
     6Version: 2.2.5
    77Author: Boone B Gorges, David Cavins
    88Author URI: http://boone.gorg.es
     
    1616*/
    1717
    18 define( 'BP_DOCS_VERSION', '2.2.4' );
     18define( 'BP_DOCS_VERSION', '2.2.5' );
    1919
    2020require_once __DIR__ . '/vendor/autoload.php';
  • buddypress-docs/tags/2.2.5/readme.txt

    r3162780 r3299013  
    44Tags: buddypress, docs, wiki, documents, collaboration
    55Requires at least: 3.3
    6 Tested up to: 6.6
    7 Stable tag: 2.2.4
     6Tested up to: 6.8
     7Stable tag: 2.2.5
    88
    99Adds collaborative Docs to BuddyPress.
     
    3333
    3434== Changelog ==
     35
     36= 2.2.5 =
     37* Security fix: Prevent users from editing Docs that they do not have permission to edit. Props to HedgeByte Cybersecurity for reporting this issue.
     38* Fixed bug in ro_RO translation package.
    3539
    3640= 2.2.4 =
  • buddypress-docs/tags/2.2.5/vendor/autoload.php

    r3003509 r3299013  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
  • buddypress-docs/tags/2.2.5/vendor/composer/InstalledVersions.php

    r3003509 r3299013  
    2828{
    2929    /**
     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    /**
    3036     * @var mixed[]|null
    3137     * @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
    3238     */
    3339    private static $installed;
     40
     41    /**
     42     * @var bool
     43     */
     44    private static $installedIsLocalDir;
    3445
    3546    /**
     
    310321        self::$installed = $data;
    311322        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;
    312341    }
    313342
     
    323352
    324353        $installed = array();
     354        $copiedLocalDir = false;
    325355
    326356        if (self::$canGetVendors) {
     357            $selfDir = self::getSelfDir();
    327358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     359                $vendorDir = strtr($vendorDir, '\\', '/');
    328360                if (isset(self::$installedByVendor[$vendorDir])) {
    329361                    $installed[] = self::$installedByVendor[$vendorDir];
     
    331363                    /** @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 */
    332364                    $required = require $vendorDir.'/composer/installed.php';
    333                     $installed[] = self::$installedByVendor[$vendorDir] = $required;
    334                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    335                         self::$installed = $installed[count($installed) - 1];
     365                    self::$installedByVendor[$vendorDir] = $required;
     366                    $installed[] = $required;
     367                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
     368                        self::$installed = $required;
     369                        self::$installedIsLocalDir = true;
    336370                    }
     371                }
     372                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     373                    $copiedLocalDir = true;
    337374                }
    338375            }
     
    351388        }
    352389
    353         if (self::$installed !== array()) {
     390        if (self::$installed !== array() && !$copiedLocalDir) {
    354391            $installed[] = self::$installed;
    355392        }
  • buddypress-docs/tags/2.2.5/vendor/composer/installed.php

    r3162780 r3299013  
    22    'root' => array(
    33        'name' => 'boonebgorges/buddypress-docs',
    4         'pretty_version' => '2.1.4',
    5         'version' => '2.1.4.0',
     4        'pretty_version' => '2.2.5',
     5        'version' => '2.2.5.0',
    66        'reference' => null,
    77        'type' => 'project',
     
    1212    'versions' => array(
    1313        'boonebgorges/buddypress-docs' => array(
    14             'pretty_version' => '2.1.4',
    15             'version' => '2.1.4.0',
     14            'pretty_version' => '2.2.5',
     15            'version' => '2.2.5.0',
    1616            'reference' => null,
    1717            'type' => 'project',
  • buddypress-docs/trunk/includes/component.php

    r3162780 r3299013  
    458458        if ( ! empty( $_POST['doc-edit-submit'] ) || ! empty( $_POST['doc-edit-submit-continue'] ) ) {
    459459
    460             // Existing Docs have a more specific permission check.
    461             $doc = bp_docs_get_current_doc();
    462             if ( $doc && ! current_user_can( 'bp_docs_edit', $doc->ID ) ) {
    463                 return;
    464             } elseif ( ! $doc && ! current_user_can( 'bp_docs_create' ) ) {
    465                 return;
    466             }
    467 
     460            $doc_id = false;
     461            if ( isset( $_POST['doc-id'] ) ) {
     462                $doc_id = absint( $_POST['doc-id'] );
     463            }
     464
     465            $current_doc = bp_docs_get_current_doc();
     466            if ( $current_doc ) {
     467                // Don't allow editing if there's a mismatch.
     468                if ( $doc_id && $doc_id !== $current_doc->ID ) {
     469                    return;
     470                }
     471
     472                $doc_id = $current_doc->ID;
     473            }
     474
     475            // Legacy.
    468476            check_admin_referer( 'bp_docs_save' );
     477
     478            if ( $doc_id ) {
     479                check_admin_referer( 'bp_docs_edit_' . (string) $doc_id, 'bp_docs_edit_nonce' );
     480            }
    469481
    470482            $result = bp_docs_save_doc_via_post();
  • buddypress-docs/trunk/includes/functions.php

    r1957023 r3299013  
    11111111    );
    11121112
    1113     if ( isset( $_POST['doc_id'] ) && 0 != $_POST['doc_id'] ) {
     1113    if ( empty( $args['doc_id'] ) && ! empty( $_POST['doc_id'] ) ) {
    11141114        $args['doc_id'] = (int) $_POST['doc_id'];
     1115    }
     1116
     1117    // Existing Docs have a more specific permission check.
     1118    if ( $args['doc_id'] && ! current_user_can( 'bp_docs_edit', $args['doc_id'] ) ) {
     1119        return;
     1120    } elseif ( ! $args['doc_id'] && ! current_user_can( 'bp_docs_create' ) ) {
     1121        return;
    11151122    }
    11161123
  • buddypress-docs/trunk/includes/templatetags-edit.php

    r3162780 r3299013  
    9898        return apply_filters( 'bp_docs_get_edit_doc_content', $content );
    9999    }
     100
     101/**
     102 * Echoes a nonce field for specific doc editing.
     103 *
     104 * @since 2.2.5
     105 *
     106 * @param int $doc_id The ID of the doc being edited. If not set, will use the current doc.
     107 *                    We make this optional because old templates may not pass it.
     108 * @return void
     109 */
     110function bp_docs_edit_doc_nonce( $doc_id = null ) {
     111    if ( ! $doc_id ) {
     112        $doc = bp_docs_get_current_doc();
     113        if ( $doc ) {
     114            $doc_id = $doc->ID;
     115        }
     116    }
     117
     118    if ( ! $doc_id ) {
     119        return;
     120    }
     121
     122    wp_nonce_field( 'bp_docs_edit_' . (string) $doc_id, 'bp_docs_edit_nonce' );
     123}
     124add_action( 'bp_docs_before_doc_edit_content', 'bp_docs_edit_doc_nonce' );
    100125
    101126/**
  • buddypress-docs/trunk/languages/buddypress-docs-ro_RO.po

    r1777844 r3299013  
    215215#: includes/templates/docs/docs-loop.php:79
    216216msgid "Viewing %1$s-%2$s of %3$s docs"
    217 msgstr "Vizualizarea %1$ s-% 2$ s de %3$ s docs"
     217msgstr "Vizualizarea %1$s-%2$s de %3$s docs"
    218218
    219219#: includes/templates/docs/docs-loop.php:89
  • buddypress-docs/trunk/languages/buddypress-docs.pot

    r3162780 r3299013  
    1 # Copyright (C) 2024 Boone B Gorges, David Cavins
     1# Copyright (C) 2025 Boone B Gorges, David Cavins
    22# This file is distributed under the same license as the BuddyPress Docs plugin.
    33msgid ""
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-10-04T09:14:01-05:00\n"
     12"POT-Creation-Date: 2025-05-22T14:13:55-05:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.9.0\n"
     
    568568
    569569#: includes/attachments.php:434
    570 #: includes/component.php:1091
     570#: includes/component.php:1103
    571571msgid "Upload File"
    572572msgstr ""
    573573
    574574#: includes/attachments.php:435
    575 #: includes/component.php:1092
     575#: includes/component.php:1104
    576576msgid "OK"
    577577msgstr ""
     
    693693msgstr ""
    694694
    695 #: includes/component.php:495
     695#: includes/component.php:507
    696696msgid "This doc is currently being edited by %s. To prevent overwrites, you cannot edit until that user has finished. Please try again in a few minutes."
    697697msgstr ""
    698698
    699 #: includes/component.php:508
     699#: includes/component.php:520
    700700msgid "You do not have permission to edit the doc."
    701701msgstr ""
    702702
    703 #: includes/component.php:522
     703#: includes/component.php:534
    704704msgid "You do not have permission to create a Doc in this group."
    705705msgstr ""
    706706
    707 #: includes/component.php:536
     707#: includes/component.php:548
    708708msgid "You do not have permission to view this Doc's history."
    709709msgstr ""
    710710
    711 #: includes/component.php:560
     711#: includes/component.php:572
    712712msgid "Lock successfully removed"
    713713msgstr ""
    714714
    715 #: includes/component.php:592
     715#: includes/component.php:604
    716716msgid "Doc successfully deleted!"
    717717msgstr ""
    718718
    719 #: includes/component.php:594
     719#: includes/component.php:606
    720720msgid "Could not delete doc."
    721721msgstr ""
    722722
    723 #: includes/component.php:597
     723#: includes/component.php:609
    724724msgid "You do not have permission to delete that doc."
    725725msgstr ""
    726726
    727 #: includes/component.php:618
     727#: includes/component.php:630
    728728msgid "Doc successfully removed from Trash!"
    729729msgstr ""
    730730
    731 #: includes/component.php:620
     731#: includes/component.php:632
    732732msgid "Could not remove Doc from Trash."
    733733msgstr ""
    734734
    735 #: includes/component.php:623
     735#: includes/component.php:635
    736736msgid "You do not have permission to remove that Doc from the Trash."
    737737msgstr ""
    738738
    739 #: includes/component.php:638
     739#: includes/component.php:650
    740740msgid "Doc successfully removed from the group"
    741741msgstr ""
    742742
    743 #: includes/component.php:640
     743#: includes/component.php:652
    744744msgid "Could not remove Doc from the group."
    745745msgstr ""
    746746
    747 #: includes/component.php:643
     747#: includes/component.php:655
    748748msgid "You do not have permission to remove that Doc from this group."
    749749msgstr ""
    750750
    751 #: includes/component.php:978
    752 #: includes/component.php:1001
    753 #: includes/component.php:1003
     751#: includes/component.php:990
     752#: includes/component.php:1013
     753#: includes/component.php:1015
    754754msgid "Search"
    755755msgstr ""
    756756
    757 #: includes/component.php:1086
     757#: includes/component.php:1098
    758758msgid "and %d more"
    759759msgstr ""
    760760
    761 #: includes/component.php:1088
     761#: includes/component.php:1100
    762762msgid "show all tags"
    763763msgstr ""
    764764
    765 #: includes/component.php:1089
     765#: includes/component.php:1101
    766766msgid "show fewer tags"
    767767msgstr ""
    768768
    769 #: includes/component.php:1090
     769#: includes/component.php:1102
    770770msgid "Still working?"
    771771msgstr ""
     
    11641164msgstr ""
    11651165
    1166 #: includes/templatetags-edit.php:147
     1166#: includes/templatetags-edit.php:172
    11671167msgid "(no parent)"
    11681168msgstr ""
  • buddypress-docs/trunk/loader.php

    r3162780 r3299013  
    44Plugin URI: http://github.com/boonebgorges/buddypress-docs
    55Description: Adds collaborative Docs to BuddyPress
    6 Version: 2.2.4
     6Version: 2.2.5
    77Author: Boone B Gorges, David Cavins
    88Author URI: http://boone.gorg.es
     
    1616*/
    1717
    18 define( 'BP_DOCS_VERSION', '2.2.4' );
     18define( 'BP_DOCS_VERSION', '2.2.5' );
    1919
    2020require_once __DIR__ . '/vendor/autoload.php';
  • buddypress-docs/trunk/readme.txt

    r3162780 r3299013  
    44Tags: buddypress, docs, wiki, documents, collaboration
    55Requires at least: 3.3
    6 Tested up to: 6.6
    7 Stable tag: 2.2.4
     6Tested up to: 6.8
     7Stable tag: 2.2.5
    88
    99Adds collaborative Docs to BuddyPress.
     
    3333
    3434== Changelog ==
     35
     36= 2.2.5 =
     37* Security fix: Prevent users from editing Docs that they do not have permission to edit. Props to HedgeByte Cybersecurity for reporting this issue.
     38* Fixed bug in ro_RO translation package.
    3539
    3640= 2.2.4 =
  • buddypress-docs/trunk/vendor/autoload.php

    r3003509 r3299013  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
  • buddypress-docs/trunk/vendor/composer/InstalledVersions.php

    r3003509 r3299013  
    2828{
    2929    /**
     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    /**
    3036     * @var mixed[]|null
    3137     * @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
    3238     */
    3339    private static $installed;
     40
     41    /**
     42     * @var bool
     43     */
     44    private static $installedIsLocalDir;
    3445
    3546    /**
     
    310321        self::$installed = $data;
    311322        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;
    312341    }
    313342
     
    323352
    324353        $installed = array();
     354        $copiedLocalDir = false;
    325355
    326356        if (self::$canGetVendors) {
     357            $selfDir = self::getSelfDir();
    327358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     359                $vendorDir = strtr($vendorDir, '\\', '/');
    328360                if (isset(self::$installedByVendor[$vendorDir])) {
    329361                    $installed[] = self::$installedByVendor[$vendorDir];
     
    331363                    /** @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 */
    332364                    $required = require $vendorDir.'/composer/installed.php';
    333                     $installed[] = self::$installedByVendor[$vendorDir] = $required;
    334                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    335                         self::$installed = $installed[count($installed) - 1];
     365                    self::$installedByVendor[$vendorDir] = $required;
     366                    $installed[] = $required;
     367                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
     368                        self::$installed = $required;
     369                        self::$installedIsLocalDir = true;
    336370                    }
     371                }
     372                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     373                    $copiedLocalDir = true;
    337374                }
    338375            }
     
    351388        }
    352389
    353         if (self::$installed !== array()) {
     390        if (self::$installed !== array() && !$copiedLocalDir) {
    354391            $installed[] = self::$installed;
    355392        }
  • buddypress-docs/trunk/vendor/composer/installed.php

    r3162780 r3299013  
    22    'root' => array(
    33        'name' => 'boonebgorges/buddypress-docs',
    4         'pretty_version' => '2.1.4',
    5         'version' => '2.1.4.0',
     4        'pretty_version' => '2.2.5',
     5        'version' => '2.2.5.0',
    66        'reference' => null,
    77        'type' => 'project',
     
    1212    'versions' => array(
    1313        'boonebgorges/buddypress-docs' => array(
    14             'pretty_version' => '2.1.4',
    15             'version' => '2.1.4.0',
     14            'pretty_version' => '2.2.5',
     15            'version' => '2.2.5.0',
    1616            'reference' => null,
    1717            'type' => 'project',
Note: See TracChangeset for help on using the changeset viewer.