magento2 – Magento 2 says class is undefined, can’t upgrade

I’m trying to install a third party module via composer with very low support, so I have to debug it myself.

The problem

I’m encountering an error “Constant name is expected” when I try to bin/magento setup:upgrade.
I’ve searched around and found this post, which led me to modify some magento code and display more details about the error :

Array
(
    (name) => code
    (value) => CreditAgricoleEtransactionsModelUiEtepcbConfigProvider::CODE
)

This is the class under {root_vendor_dir}/creditagricole/etransactions/Model/Ui

//class EtepcbConfigProvider
<?php

namespace VendorModuleModelUi;

use MagentoCheckoutModelConfigProviderInterface;
// use MagentoFrameworkAppConfigScopeConfigInterface;
// use MagentoFrameworkViewAssetSource;
use MagentoFrameworkObjectManagerInterface;
use CreditAgricoleEtransactionsGatewayHttpClientClientMock;
use CreditAgricoleEtransactionsModelUiEtepcbConfig;

/**
 * Class ConfigProvider
 */
final class EtepcbConfigProvider implements ConfigProviderInterface
{
    const CODE = 'etep_cb';
    /**
     * Retrieve assoc array of checkout configuration
     *
     * @return array
     */
    public function getConfig()
    {
        return (
            'payment' => (
                self::CODE => (
                    'cards' => $this->getCards()
                )
            )
        );
    }

    public function getCards(){...}
}


What I’ve tried so far

I’ve looked around where that constant is called and found several references in the module’s etc folder :

<argument name="code" xsi:type="const">CreditAgricoleEtransactionsModelUiEtepcbConfigProvider::CODE</argument>

I’ve searched for the same sort of code in magento core files and found that there were no first like in this module, so I’ve tried removing it, but nothing changed.

The class throwing the error is :

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace MagentoFrameworkDataArgumentInterpreter;

use MagentoFrameworkDataArgumentInterpreterInterface;

/**
 * Interpreter that returns value of a constant by its name
 */
class Constant implements InterpreterInterface
{
    /**
     * {@inheritdoc}
     * @return mixed
     * @throws InvalidArgumentException
     */
    public function evaluate(array $data) {
        if(!isset($data('value')) || !defined($data('value'))) {
            throw new InvalidArgumentException('Constant name is expected.');
        }
        return constant($data('value'));
    }
}

I’ve tested both the isset and defined function separately and got these results:

 print_r($data);
 // Array ( (name) => code (value) => CreditAgricoleEtransactionsModelUiEtepcbConfigProvider::CODE )

 print_r(isset($data('value')));
// 1

 print_r(defined($data('value')));
// <nothing>

Finally, I’ve tried using defined with the constant name directly (with and without the first ) and got:

print_r(defined(CreditAgricoleEtransactionsModelUiEtepcbConfigProvider::CODE));
// Fatal error: Uncaught Error: Class 'CreditAgricoleEtransactionsModelUiEtepcbConfigProvider' not found in /var/www/html/vendor/magento/framework/Data/Argument/Interpreter/Constant.php:24 Stack trace: #0

print_r(defined(CreditAgricoleEtransactionsModelUiEtepcbConfigProvider::CODE));
//Fatal error: Uncaught Error: Class 'MagentoFrameworkDataArgumentInterpreterCreditAgricoleEtransactionsModelUiEtepcbConfigProvider' not found in /var/www/html/vendor/magento/framework/Data/Argument/Interpreter/Constant.php:24 Stack trace: #0

//using string (with and without )
print_r(defined("CreditAgricoleEtransactionsModelUiEtepcbConfigProvider::CODE"));
//Fatal error: Uncaught InvalidArgumentException: Constant name is expected. in /var/www/html/vendor/magento/framework/Data/Argument/Interpreter/Constant.php:26

Dirty temporary fix ?

The last thing I’ve tried is moving the code base into app/code and renaming the top folders accordingly and SOMEHOW, this seems to fix the error. However the frontend content isn’t working and I don’t feel confident about this solution, as this module was meant to be installed with composer.
Do modules installed in vendor and app/code work differently or are they interchangeable ?

That’s where I’m at today. I have no idea what’s wrong with this module, this is the first time I see this error appear, just after having installed it. I would very much like to install it “normally”.

elasticsearch – Elastic search throws errror while running upgrade command via CLI in magento 2

I have successfully cloned & installed a Magento cloud environment Magento 2.4.2 in my local instance.

And also installed elastic search and tested it via the command line and it’s working fine.

Note: I have followed his link to install and configure elastic search https://www.emizentech.com/blog/magento-2-4-with-elasticsearch-complete-guide.html

Output from the command line:
enter image description here

But while running upgrade command throws following error.

enter image description here

Elastic search configuration file

/etc/elasticsearch/elasticsearch.yml

enter image description here

Can anyone please help me to sort out this?

install – pkgutil doesn’t show Xcode Command Line Tools after upgrade to macOS 11.3

I’ve upgraded to macOS 11.3 from macOS 11.2.3. I’d installed Xcode Command Line Tools using Homebrew. Before the upgrade, I used pkgutil to check if Xcode CLT was installed and I got

% /usr/sbin/pkgutil --packages | grep CL
com.apple.pkg.CLTools_Executables
% /usr/sbin/pkgutil --pkg-info com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables

After the upgrade from macOS 11.2.3 to macOS 11.3, Command Line Tools is installed and usable. However, I didn’t see the same results when using pkgutil to check if Xcode CLT was installed.

% xcode-select --version
xcode-select version 2384.
% xcode-select -p
/Library/Developer/CommandLineTools
% ls -l /Library/Developer/CommandLineTools
total 0
drwxr-xr-x  5 root  wheel  160 Jan  9 07:43 Library
drwxr-xr-x  6 root  wheel  192 Apr 27 23:15 SDKs
drwxr-xr-x  7 root  wheel  224 Apr 24 16:19 usr
% brew doctor
Your system is ready to brew.
% /usr/sbin/pkgutil --packages | grep CL
% /usr/sbin/pkgutil --pkg-info com.apple.pkg.CLTools_Executables
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

Is it still possible to use pkgutil to check if Xcode CLT is installed? Has the package name or location changed?

Upgrade to Ubuntu 21.04 blanked the OBS Studio preview windows

I’ve been using OBS Studio under Ubuntu 20.10 (and older) for the last four years (but at a novice level only) with Intel integrated graphics CPU. Used the “official” Ubuntu repository for the original install and stayed current as practical. I upgraded to Ubuntu 21.04 earlier this week and discovered that the preview screen in OBS Studio is blank. The red rectangle border is limited to the OBS Studio app window and none of the other windows are available for selection. Similarly, the Screen Capture setting can be enabled but the corresponding preview window is blank. There is no recorded file (I’ve checked the output folder as set in app Preferences) when the Start Recording is enabled and subsequently stopped.

My cursory web search revealed similar reported anomalies going back several years. The workaround (inapplicable for my predicament – no NVidia hardware to disable, no Windows OS, only integrated graphics) made sense but naturally I cannot try these under Ubuntu.

I’ve uninstalled with –purge option and deleted the ./config/obs-studio folder for each of the following installation methods:

  • Ubuntu 21.04
  • snap
  • PPA (with back reference to Groovy since Hirsute couldn’t fetch the OBS Studio package)

I remain unsuccessful in using OBS Studio in my accustomed manner with previous Ubuntu releases. The two issues that I have currently are:

  • blank preview screen
  • the window option no longer displays all available windows for selection, only the OBS Studio app window (and a “ghosted” Thunderbird window since it was closed prior to the launch of OBS Studio)

I understand that I have to disable Wayland and revert back to X11 (my “uneducated” guess) but I don’t know where to begin. I have read about exporting environment variables but even after executing the command(s) to export the variables and launching OBS Studio, the Screen Capture setting still displays “WAYLAND” and not X11 as the prefix to the title of that selection.

Any guidance will be sincerely appreciated. Thanks.

Kind regards.

XenForo 2.2.5 Upgrade Nulled By NulledTeam

XenForo 2.2.5 is now available for all licensed customers to download. We strongly recommend that all customers running previous versions of XenForo 2.2 upgrade to this release to benefit from increased stability.

This release changes the default CAPTCHA method from reCAPTCHA to hCaptcha. If you were using the default CAPTCHA settings, you will automatically be switched over to hCaptcha. If you provided your own reCAPTCHA keys or chose a different CAPTCHA method, your existing CAPTCHA…

.

Upgrade midi drivers? – Ask Ubuntu

For some reason, Ubuntu is not reading midi very well consistently.

Sometimes my drumpad works perfectly. Sometimes exactly every other note is ignored. Other times it ignores at random.

I’ve turned my computer on/off without turning off my drum pad and it went from not working to working perfect. Over the course of my music session, it randomly stopped working eventually.

The drum pad has no issues anywhere else, so I’m almost positive it’s a midi driver issue.

Further, I’ve used midi-debugger software to check it wasn’t just my DAW.


Can I upgrade my midi drivers? Or is there some way I can verify the issue is with Ubuntu beyond what I’ve tried?

Peak load upgrade and downgrade SQL Server 2017 Standard SQL Server 2017 Enterprise

We are currently running on SQL Server 2017 standard edition and for higher traffic weekends like Mothers day we want to go on SQL Server 2017 enterprise version and during non peak hours we want to come back on Standard. We run on AWS EC2 images of respective versions. My question is

  1. Can we just take the backup of 2017 standard and restore on 2017 enterprise? I mean do we have to do an in place upgrade and not a backup and restore
  2. Similarly can we do a restore from 2017 enterprise to 2017 standard during non peak hours? I mean it is mandatory to do an in place downgrade

We tried the backup restore option and running into memory issues

What is the best approach?

kubuntu – Upgrade from Focal to Groovy did not complete

I got a new PC pre-loaded with Ubuntu Focal Fossa. I changed the UI to Kubuntu and upgraded to Groovy Gorilla, and it seemed to work well (PC behavior is good in general, software sources are Groovy), but then I realized that it still reports “Focal” in os-release, and keeps telling me an upgrade (Groovy) is available

I used sudo do-release-upgrade to complete the upgrade, and it tried to, but failed. After updating repository info, it shows this:

  • Updating repository information
  • Third party sources disabled Some third party entries in your sources.list were disabled. You can re-enable them after the upgrade with the ‘software-properties’ tool or your package manager.
  • To continue please press (ENTER)

Then after I press ENTER, it continues up to calculating the changes, and then:

  • Calculating the changes
  • Restoring original system state
  • Aborting
  • Reading package lists… Done
  • Building dependency tree
  • Reading state information… Done

I verified all the sources displayed in “Software and Updates” are selected and not disabled, but this did not help. I suspect some sources (Focal sources?) have disappeared but are needed for this upgrade.

On my previous computer, I had used Kubuntu since Gutsy Gibbon, never had a problem like that. Any idea? I know I could reinstall from scratch, but if I can avoid it …

Thanks.

Upgrade existing Magento 1.9 using Open mage or get patches from it

  1. Can we upgrade our existing Magento 1.9 site using open mage ?

Yes, you can. Min PHP7, I recommend PHP7.4. PHP8 is WIP and not recommended for production.

  1. Have anyone implemented the same with their existing website ?

Yes, all our sites from M1.9 are now on OpenMage.

  1. What issues were faced during upgrading if any ?

We planned the updagrde carefully in stages as we wanted to upgrade PHP and server as well. The issues (some exceptions and errors) were resolved in the development server then we test the upgrade steps in staging server, which is a mirror of production. We didn’t face any issue in staging and production servers.

I think the number of issues you face will depend on

  1. Your current M1 version, the further away you are from v1.9.4.5, the more issues you should expect to encounter.
  2. The number of extensions and custom code you have, if you have lots of these, you may have more issues.
  3. The OpenMage version you intend to upgrade to, v20 does not guarantee BC.

Please guide us on this and what approaches we can take.

We use git in every step in our upgrade plan. It may not be the best approach for your case. It’s a bit more complicated if compare with the drop-file-in-place approach but in our case, using git offers the following:

  1. Very easy to revert the changes if anything goes wrong. We have a branch before upgrade and a branch after upgrade.
  2. We can fix issues encountered in the development server and commit them to the upgrade branch, which make it trivia to deploy the upgrade to staging and produciton.

Irregardless which approach you take, you need to take these into considerations:

  1. Do you need to upgrade the server and PHP in production?
  2. Do you need to notify the customers on shut down of the site?
  3. Which team member is responsible for which task during upgrading of production? Draw a detail sequence of actions that should take place, this will also be used as a checklist before turning on production.

Our sites were noticeably much more responsive after the upgrade, probably mainly due to new hardware and PHP7+.