Plugin Directory

Changeset 2784464


Ignore:
Timestamp:
09/14/2022 08:40:59 AM (3 years ago)
Author:
pmpr
Message:

update codebase

Location:
pmpr-ir
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pmpr-ir/tags/1.2.1/src/Pmpr/Plugin/Pmpr/Ajax.php

    r2784023 r2784464  
    7070
    7171                            // try to get last updates before install
    72                             $this->fetchCommonComponents(true);
    73                             if ($components = $this->getCommonComponents()) {
     72                            if ($components = $this->fetchCommonComponents(true)) {
    7473
    7574                                $code = null;
  • pmpr-ir/tags/1.2.1/src/Pmpr/Plugin/Pmpr/Traits/CommonTrait.php

    r2784023 r2784464  
    118118        foreach ($requirements as $requirement) {
    119119
    120             if (Manipulate::getArrayItem($requirement, 'show', false)) {
     120            if (Manipulate::getArrayItem($requirement, 'show')) {
    121121
    122122                $satisfied = false;
     
    139139    public function getCommonComponents(): array
    140140    {
    141         $result = [];
    142         if ($commons = get_transient(self::FETCHED_COMMONS)) {
     141        $result  = [];
     142        $commons = get_transient(self::FETCHED_COMMONS);
     143
     144        if (!$commons) {
     145
     146            $commons = $this->fetchCommonComponents(true);
     147        }
     148
     149        if ($commons && is_array($commons)) {
    143150
    144151            foreach ($commons as $common) {
     
    164171    public function fetchCommonComponents(bool $force = false)
    165172    {
    166         if ($this->isRequirementsSatisfied(true)) {
    167 
    168             if ($force || !get_transient(self::FETCHED_COMMONS)) {
     173        $items = [];
     174        if ($this->isRequirementsSatisfied()) {
     175
     176            $items = get_transient(self::FETCHED_COMMONS);
     177            if ($force || !$items) {
    169178
    170179                if (!get_transient(self::FETCH_COMMON_COMPONENTS_RUNNING)) {
     
    187196            }
    188197        }
     198
     199        return $items;
    189200    }
    190201
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Ajax.php

    r2784023 r2784464  
    7070
    7171                            // try to get last updates before install
    72                             $this->fetchCommonComponents(true);
    73                             if ($components = $this->getCommonComponents()) {
     72                            if ($components = $this->fetchCommonComponents(true)) {
    7473
    7574                                $code = null;
  • pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Traits/CommonTrait.php

    r2784023 r2784464  
    118118        foreach ($requirements as $requirement) {
    119119
    120             if (Manipulate::getArrayItem($requirement, 'show', false)) {
     120            if (Manipulate::getArrayItem($requirement, 'show')) {
    121121
    122122                $satisfied = false;
     
    139139    public function getCommonComponents(): array
    140140    {
    141         $result = [];
    142         if ($commons = get_transient(self::FETCHED_COMMONS)) {
     141        $result  = [];
     142        $commons = get_transient(self::FETCHED_COMMONS);
     143
     144        if (!$commons) {
     145
     146            $commons = $this->fetchCommonComponents(true);
     147        }
     148
     149        if ($commons && is_array($commons)) {
    143150
    144151            foreach ($commons as $common) {
     
    164171    public function fetchCommonComponents(bool $force = false)
    165172    {
    166         if ($this->isRequirementsSatisfied(true)) {
    167 
    168             if ($force || !get_transient(self::FETCHED_COMMONS)) {
     173        $items = [];
     174        if ($this->isRequirementsSatisfied()) {
     175
     176            $items = get_transient(self::FETCHED_COMMONS);
     177            if ($force || !$items) {
    169178
    170179                if (!get_transient(self::FETCH_COMMON_COMPONENTS_RUNNING)) {
     
    187196            }
    188197        }
     198
     199        return $items;
    189200    }
    190201
Note: See TracChangeset for help on using the changeset viewer.