Changeset 3140303
- Timestamp:
- 08/23/2024 10:38:26 AM (18 months ago)
- Location:
- pmpr-ir
- Files:
-
- 2 edited
-
tags/1.3.5/src/Pmpr/Plugin/Pmpr/Component/Common.php (modified) (2 diffs)
-
trunk/src/Pmpr/Plugin/Pmpr/Component/Common.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pmpr-ir/tags/1.3.5/src/Pmpr/Plugin/Pmpr/Component/Common.php
r3078042 r3140303 35 35 public function addActions() 36 36 { 37 $this->addAction('admin_init', [$this, ' addRequiredComponentsJobs']);37 $this->addAction('admin_init', [$this, 'installRequiredComponents']); 38 38 39 39 parent::addActions(); … … 54 54 } 55 55 56 public function addRequiredComponentsJobs()56 public function installRequiredComponents() 57 57 { 58 $isDebug = (bool)$this->getHelper()->getServer()->getRequest('pr-dev', false); 59 60 $HTMLHelper = $this->getHelper()->getHTML(); 58 61 if ($this->isRequirementsSatisfied()) { 59 62 60 63 $componentHelper = $this->getHelper()->getComponent(); 61 64 if (!$componentHelper->isRequiredInstalled()) { 65 62 66 $components = $componentHelper->getRequired(); 67 63 68 foreach ($components as $component) { 64 69 65 $this->getManager()->install($component); 70 $result = $this->getManager()->install($component); 71 if (!$result || is_wp_error($result)) { 72 73 $reason = ''; 74 if (is_wp_error($result)) { 75 $reason = $result->get_error_message(); 76 } 77 if ($isDebug) { 78 79 $HTMLHelper->renderNotice(sprintf('can not install %s: %s', $component, $reason)); 80 } 81 } else if ($isDebug) { 82 83 $HTMLHelper->renderNotice(sprintf('%s installed', $component)); 84 } 66 85 } 86 } else if ($isDebug) { 87 88 $HTMLHelper->renderNotice('common components already installed'); 67 89 } 90 } else if ($isDebug) { 91 92 $HTMLHelper->renderNotice('can not install common components: requirements not satisfied'); 68 93 } 69 94 } -
pmpr-ir/trunk/src/Pmpr/Plugin/Pmpr/Component/Common.php
r3078042 r3140303 35 35 public function addActions() 36 36 { 37 $this->addAction('admin_init', [$this, ' addRequiredComponentsJobs']);37 $this->addAction('admin_init', [$this, 'installRequiredComponents']); 38 38 39 39 parent::addActions(); … … 54 54 } 55 55 56 public function addRequiredComponentsJobs()56 public function installRequiredComponents() 57 57 { 58 $isDebug = (bool)$this->getHelper()->getServer()->getRequest('pr-dev', false); 59 60 $HTMLHelper = $this->getHelper()->getHTML(); 58 61 if ($this->isRequirementsSatisfied()) { 59 62 60 63 $componentHelper = $this->getHelper()->getComponent(); 61 64 if (!$componentHelper->isRequiredInstalled()) { 65 62 66 $components = $componentHelper->getRequired(); 67 63 68 foreach ($components as $component) { 64 69 65 $this->getManager()->install($component); 70 $result = $this->getManager()->install($component); 71 if (!$result || is_wp_error($result)) { 72 73 $reason = ''; 74 if (is_wp_error($result)) { 75 $reason = $result->get_error_message(); 76 } 77 if ($isDebug) { 78 79 $HTMLHelper->renderNotice(sprintf('can not install %s: %s', $component, $reason)); 80 } 81 } else if ($isDebug) { 82 83 $HTMLHelper->renderNotice(sprintf('%s installed', $component)); 84 } 66 85 } 86 } else if ($isDebug) { 87 88 $HTMLHelper->renderNotice('common components already installed'); 67 89 } 90 } else if ($isDebug) { 91 92 $HTMLHelper->renderNotice('can not install common components: requirements not satisfied'); 68 93 } 69 94 }
Note: See TracChangeset
for help on using the changeset viewer.