Problem with upgrading php version from 7.4 to 8 - php-8

I am using Joomla version 3.10 and after upgrading the php version from 7.4 to 8.0, I received this error.
Fatal error: Unparenthesized a ? b : c ? d : eis not supported. Use either(a ? b : c) ? d : eora ? b : (c ? d : e) in /home/public_html/language/fa-IR/fa-IR.localise.php on line 115
I put the source code of fa-IR.localise.php on line 115 below:
`if (strpos($return, self::MONTH_LENGTH) !== false) {
$return = str_replace(self::MONTH_LENGTH, $m < 7 ? 31 : $m < 12 ? 30 : self::leap_persian($y) ? 30 : 29 , $return);`
Thank you for helping me.
When I go back to php version 7.4, the problem is solved

$return = str_replace(self::MONTH_LENGTH, ($m < 7 ? 31 : ($m < 12 ? 30 : (self::leap_persian($y) ? 30 : 29) ) ) , $return);
Operations need after PHP 7.4 this ( ... ) brace's.

Related

Using FromArgb for Int32[] value results in swapped Red and Blue values

I have this Int32[] value 14508153 which should be:
R : 121
G : 96
B : 221
If I use:
[System.Drawing.Color]::FromArgb(14508153)
It returns:
R : 221
G : 96
B : 121
A : 0
IsKnownColor : False
IsEmpty : False
IsNamedColor : False
IsSystemColor : False
Name : dd6079
Questions
How or why are those values swapped for R and B using that function?
Is there a built-in PowerShell method to convert them correctly?
I can't speak to why the bytes need to be rearranged (see the bottom section for thoughts), but here's how you can do it:
Add-Type -AssemblyName System.Drawing
$bytes = [System.BitConverter]::GetBytes(14508153)
[byte[]] $rearrangedBytes = $bytes[2], $bytes[1], $bytes[0], $bytes[3]
[System.Drawing.Color]::FromArgb(
[System.BitConverter]::ToInt32($rearrangedBytes, 0)
)
See System.BitConverter.GetBytes(), System.BitConverter.ToInt32().
The above yields:
R : 121
G : 96
B : 221
A : 0
IsKnownColor : False
IsEmpty : False
IsNamedColor : False
IsSystemColor : False
Name : 7960dd
It appears that only 3 of the bytes in your [int] (System.Int32) value are relevant, and that they are in Big-Endian order (see the Wikipedia article about endianness).
By contrast, System.Drawing.Color.FromArgb() expects all 4 bytes to be relevant, in Little-Endian order.

retrieving RDS license

I have a question, iam running a PowerShell command to retrieved RDS LicenseKeyPack details, according to win32-tslicensekeypack KeyPackType should a number between 0 and 6, yet i am getting 7 on some outputs. What dose this mean?.
Example output:
KeyPackId : 3
KeyPackType : 2
ProductVersion : Windows Server 2016
TypeAndModel : RDS Per User CAL
AvailableLicenses : 48
IssuedLicenses : 1202
ExpirationDate : 20380101000000.000000-000
KeyPackId : 5
KeyPackType : 7
ProductVersion : Windows Server 2012
TypeAndModel : RDS Per User CAL
AvailableLicenses : 0
IssuedLicenses : 1
ExpirationDate : 20380119031407.000000-000
KeyPackId : 7
KeyPackType : 7
ProductVersion : Windows Server 2016
TypeAndModel : RDS Per User CAL
AvailableLicenses : 0
IssuedLicenses : 49
ExpirationDate : 20380119031407.000000-000"

Improving the speed of PowerShell commands in Windows 2016

Example of a problem:
Measure-Command { Get-VMSwitch -SwitchType "External" }
Windows 2012 and 2016 have the same hardware and CPU load is ~50%
Windows Server 2016 (3 external Switches)
Days : 0
Hours : 0
Minutes : 0
Seconds : 6
Milliseconds : 377
Ticks : 63779086
TotalDays : 7.38183865740741E-05
TotalHours : 0.00177164127777778
TotalMinutes : 0.106298476666667
TotalSeconds : 6.3779086
TotalMilliseconds : 6377.9086
Windows Server 2012R2 (3 external Switches)
Days : 0
Hours : 0
Minutes : 0
Seconds : 1
Milliseconds : 376
Ticks : 13762494
TotalDays : 1.59288125E-05
TotalHours : 0.0003822915
TotalMinutes : 0.02293749
TotalSeconds : 1.3762494
TotalMilliseconds : 1376.2494
Windows 2012R2 with a greater or equal CPU load is 6 times faster.
Windows Server 2016 (9 external Switches)
Days : 0
Hours : 0
Minutes : 1
Seconds : 6
Milliseconds : 168
Ticks : 661689307
TotalDays : 0.000765844105324074
TotalHours : 0.0183802585277778
TotalMinutes : 1.10281551166667
TotalSeconds : 66.1689307
TotalMilliseconds : 66168.9307
Windows 2016 slower now 48 times! :)
In Windows 2016 Meltdown/Specter fixes are disabled.
Is there any option for improving the performance of powershell commands in Windows 2016?
Thanks.
Well, I found another solution. It's using bottlenecks through WMI.
The WMI msvm-ethernetswitchport class can provide all the VMSwitches elements, where we can already get the same information that Powershel CMD Get-VMSwitch provides.
https://learn.microsoft.com/en-us/windows/desktop/hyperv_v2/msvm-ethernetswitchport and etc.
A simple example:
ManagementScope scope = new ManagementScope("\\\\.\\ROOT\\virtualization\\v2");
ObjectQuery query = new ObjectQuery("SELECT * FROM Msvm_EthernetSwitchPort");
ManagementObjectSearcher searcher =
new ManagementObjectSearcher(scope, query);
ManagementObjectCollection queryCollection = searcher.Get();
foreach (ManagementObject m in queryCollection)
{
Console.WriteLine("DeviceID : {0}", m["DeviceID"]);
Console.WriteLine("ElementName : {0}", m["ElementName"]);
}
It's sad that PowerShell in Windows 2016 runs so slowly...
In fact, through WMI there are so many options how to get this data.
https://learn.microsoft.com/en-us/windows/desktop/hyperv_v2/hyper-v-networking-api

TYPO3 version 6 to version 8 compatibility issues

While upgrading typo3 version 6 to 8.7.3 getting this database error...
An exception occurred while executing 'SELECT `pid` FROM `sys_template` WHERE (root = 1 AND deleted = 0 AND hidden = 0 AND starttime <= :starttime AND (endtime = 0 OR endtime > :endtime)) AND ((`sys_template`.`deleted` = 0) AND (`sys_template`.`hidden` = 0) AND (`sys_template`.`starttime` <= 1500543000) AND ((`sys_template`.`endtime` = 0) OR (`sys_template`.`endtime` > 1500543000)))': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':starttime AND (endtime = 0 OR endtime > :endtime)) AND ((`sys_template`.`delete' at line 1
Please review the screen shot.
DB Configuration variables have changed from TYPO3 v7 to v8 ^^
It is not
$GLOBALS['TYPO3_CONF_VARS']['DB']['database']
$GLOBALS['TYPO3_CONF_VARS']['DB']['host']
$GLOBALS['TYPO3_CONF_VARS']['DB']['username']
$GLOBALS['TYPO3_CONF_VARS']['DB']['password']
anymore, but
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host']
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname']
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['user']
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['password']
This is especially the case, when configuring additional Environments via AdditionalConfiguration.php

How to get a child item into a variable on its own

I am relatively sure this is quite easy to do but my google fu is not running strong
At the moment I am doing:
add-pssnapin windows.serverbackup
get-wbsummary
This returns me:
NextBackupTime : 07/09/2012 12:00:00
NumberOfVersions : 210
LastSuccessfulBackupTime : 06/09/2012 21:00:13
LastSuccessfulBackupTargetPath : \\?\Volume{bf315689-e5ed-11e1-a376-d067e5f384ea}
LastSuccessfulBackupTargetLabel : SBSERVE 2012_08_21 12:20 DISK_01
LastBackupTime : 06/09/2012 21:00:13
LastBackupTarget : SBSERVE 2012_08_21 12:20 DISK_01
DetailedMessage :
LastBackupResultHR : 0
LastBackupResultDetailedHR : 0
CurrentOperationStatus : NoOperationInProgress
What I want to do is get just the result portion (not its title into a variable) so for example $lastbackuptime = 07/09/2012 12:00:00
PS> $wbs = Get-WBSummary
PS> $lastbackuptime = $wbs.NextBackupTime