Skip to content

Commit 5711907

Browse files
committed
Merge branch 'main' into next
2 parents 80dae5c + 6892dee commit 5711907

File tree

6 files changed

+166
-17
lines changed

6 files changed

+166
-17
lines changed

.ddev/commands/web/openmage-install

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
#!/bin/bash
2+
3+
## ProjectTypes: magento
4+
## Description: Install OpenMage
5+
## Usage: openmage-install [-d|--default] [-s|--sampledata] [-k|--keep] [-q|--quiet]
6+
## Example: ddev openmage-install -d -s -k
7+
## Flags: [{"Name":"default","Shorthand":"d","Usage":"use default values"},{"Name":"sampledata","Shorthand":"s","Usage":"install sample data"},{"Name":"keep","Shorthand":"k","Usage":"keep sample data package"},{"Name":"quiet","Shorthand":"q","Usage":"silent install with sample data"}]
8+
9+
ROOT="${PWD}"
10+
11+
QUIET_INSTALL_FLAG=''
12+
SAMPLE_DATA_FLAG=''
13+
SAMPLE_DATA_KEEP_FLAG=''
14+
USE_DEFAULT_FLAG=''
15+
16+
while :; do
17+
case ${1:-} in
18+
-d|--default)
19+
USE_DEFAULT_FLAG='true' ;;
20+
-s|--sampledata)
21+
SAMPLE_DATA_FLAG='true' ;;
22+
-k|--keep)
23+
SAMPLE_DATA_KEEP_FLAG='true' ;;
24+
-q|--quiet)
25+
QUIET_INSTALL_FLAG='true'
26+
USE_DEFAULT_FLAG='true'
27+
SAMPLE_DATA_FLAG='true'
28+
;;
29+
--) # End of all options.
30+
shift
31+
break
32+
;;
33+
-?*)
34+
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
35+
;;
36+
*) # Default case: No more options, so break out of the loop.
37+
break
38+
esac
39+
40+
shift
41+
done
42+
43+
LOCALXML="${ROOT}/app/etc/local.xml"
44+
if [ -f "${LOCALXML}" ]; then
45+
if [[ "${QUIET_INSTALL_FLAG}" ]]; then
46+
DELETE='y'
47+
else
48+
read -r -p "OpenMage is already installed. Delete local.xml and drop the database? [y/N] " DELETE
49+
DELETE=${DELETE,,} # to lower
50+
fi
51+
52+
if [[ "${DELETE}" =~ ^(yes|y) ]]; then
53+
mysql -u db -h db -e "DROP SCHEMA IF EXISTS db; CREATE SCHEMA db;";
54+
rm "${LOCALXML}"
55+
else
56+
exit 1
57+
fi
58+
fi
59+
60+
# install sample data
61+
if [[ "${SAMPLE_DATA_FLAG}" ]]; then
62+
INSTALL_SAMPLE_DATA='y'
63+
else
64+
read -r -p "Install Sample Data? [y/N] " INSTALL_SAMPLE_DATA
65+
INSTALL_SAMPLE_DATA=${INSTALL_SAMPLE_DATA,,} # to lower
66+
fi
67+
68+
if [[ $INSTALL_SAMPLE_DATA =~ ^(yes|y) ]]; then
69+
SAMPLE_DATA_URL=https://github.com/Vinai/compressed-magento-sample-data/raw/master/compressed-magento-sample-data-1.9.2.4.tgz
70+
SAMPLE_DATA_DIRECTORY="${ROOT}/.sampleData"
71+
SAMPLE_DATA_FILE=sample_data.tgz
72+
73+
if [[ ! -d "${SAMPLE_DATA_DIRECTORY}" ]]; then
74+
echo "Creating Sample Data directory..."
75+
mkdir -p "${SAMPLE_DATA_DIRECTORY}"
76+
fi
77+
78+
cd "${SAMPLE_DATA_DIRECTORY}" || exit
79+
if [[ ! -f "${SAMPLE_DATA_DIRECTORY}/${SAMPLE_DATA_FILE}" ]]; then
80+
echo "Downloading Sample Data..."
81+
wget "${SAMPLE_DATA_URL}" -O "${SAMPLE_DATA_FILE}"
82+
fi
83+
84+
echo "Uncompressing Sample Data..."
85+
tar xf "${SAMPLE_DATA_FILE}"
86+
87+
echo "Copying Sample Data into the OpenMage directory..."
88+
cp -r magento-sample-data-1.9.2.4/* "${ROOT}/"
89+
90+
echo "Importing Sample Data into the database..."
91+
mysql -u db -h db db < "${SAMPLE_DATA_DIRECTORY}/magento-sample-data-1.9.2.4/magento_sample_data_for_1.9.2.4.sql"
92+
93+
# remove sample data
94+
if [[ "${SAMPLE_DATA_KEEP_FLAG}" ]]; then
95+
rm -rf $(
96+
find . -maxdepth 1 -type f -name "*" ! -name "${SAMPLE_DATA_FILE}")
97+
else
98+
cd "${ROOT}" || exit
99+
rm -rf "${SAMPLE_DATA_DIRECTORY}"
100+
fi
101+
fi
102+
103+
cd "${ROOT}" || exit
104+
105+
if [[ "${USE_DEFAULT_FLAG}" ]]; then
106+
ADMIN_USER='admin'
107+
ADMIN_FIRSTNAME='OpenMage'
108+
ADMIN_LASTNAME='Administrator'
109+
ADMIN_EMAIL='[email protected]'
110+
ADMIN_PASSWORD='veryl0ngpassw0rd'
111+
TABLE_PREFIX='om_'
112+
else
113+
read -r -p "Admin User [admin]: " ADMIN_USER
114+
ADMIN_USER=${ADMIN_USER:-admin}
115+
read -r -p "Admin Firstname [OpenMage]: " ADMIN_FIRSTNAME
116+
ADMIN_FIRSTNAME=${ADMIN_FIRSTNAME:-OpenMage}
117+
read -r -p "Admin Lastname [Administrator]: " ADMIN_LASTNAME
118+
ADMIN_LASTNAME=${ADMIN_LASTNAME:-Administrator}
119+
read -r -p "Admin Email [[email protected]]: " ADMIN_EMAIL
120+
ADMIN_EMAIL=${ADMIN_EMAIL:-admin@example.com}
121+
read -r -p "Admin Password [veryl0ngpassw0rd]: " ADMIN_PASSWORD
122+
ADMIN_PASSWORD=${ADMIN_PASSWORD:-veryl0ngpassw0rd}
123+
if [[ $INSTALL_SAMPLE_DATA =~ ^(yes|y) ]]; then
124+
TABLE_PREFIX=''
125+
else
126+
read -r -e -i 'om_' -p "Table Prefix [om_]: " TABLE_PREFIX
127+
fi
128+
fi
129+
130+
php -f install.php -- \
131+
--license_agreement_accepted 'yes' \
132+
--locale 'en_US' \
133+
--timezone 'America/New_York' \
134+
--db_host 'db' \
135+
--db_name 'db' \
136+
--db_user 'db' \
137+
--db_pass 'db' \
138+
--db_prefix "${TABLE_PREFIX}" \
139+
--url "${DDEV_PRIMARY_URL}" \
140+
--use_rewrites 'yes' \
141+
--use_secure 'yes' \
142+
--secure_base_url "${DDEV_PRIMARY_URL}" \
143+
--use_secure_admin 'yes' \
144+
--admin_username "${ADMIN_USER}" \
145+
--admin_lastname "${ADMIN_LASTNAME}" \
146+
--admin_firstname "${ADMIN_FIRSTNAME}" \
147+
--admin_email "${ADMIN_EMAIL}" \
148+
--admin_password "${ADMIN_PASSWORD}" \
149+
--session_save 'files' \
150+
--admin_frontname 'admin' \
151+
--backend_frontname 'admin' \
152+
--default_currency 'USD' \
153+
--enable_charts 'yes' \
154+
--skip_url_validation 'yes'

app/code/core/Mage/GoogleAnalytics/Block/Ga.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
*/
2222
class Mage_GoogleAnalytics_Block_Ga extends Mage_Core_Block_Template
2323
{
24+
protected const CHECKOUT_MODULE_NAME = "checkout";
25+
protected const CHECKOUT_CONTROLLER_NAME = "onepage";
26+
2427
/**
2528
* Render regular page tracking javascript code
2629
* The custom "page name" may be set from layout or somewhere else. It must start from slash.
@@ -304,7 +307,7 @@ protected function _getEnhancedEcommerceDataForAnalytics4()
304307
*
305308
* @link https://developers.google.com/tag-platform/gtagjs/reference/events#begin_checkout
306309
*/
307-
elseif ($moduleName == 'checkout' && $controllerName == 'onepage') {
310+
elseif ($moduleName == static::CHECKOUT_MODULE_NAME && $controllerName == static::CHECKOUT_CONTROLLER_NAME) {
308311
$productCollection = Mage::getSingleton('checkout/session')->getQuote()->getAllVisibleItems();
309312
if ($productCollection) {
310313
$eventData = [];
@@ -342,7 +345,7 @@ protected function _getEnhancedEcommerceDataForAnalytics4()
342345
$orderIds = $this->getOrderIds();
343346
if (!empty($orderIds) && is_array($orderIds)) {
344347
$collection = Mage::getResourceModel('sales/order_collection')
345-
->addFieldToFilter('entity_id', ['in' => $orderIds]);
348+
->addFieldToFilter('entity_id', ['in' => $orderIds]);
346349
/** @var Mage_Sales_Model_Order $order */
347350
foreach ($collection as $order) {
348351
$orderData = [

app/code/core/Mage/Paypal/Model/Ipn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ protected function _registerPaymentRefund()
559559
->setTransactionId($this->getRequestData('txn_id'))
560560
->setParentTransactionId($this->getRequestData('parent_txn_id'))
561561
->setIsTransactionClosed($isRefundFinal)
562-
->registerRefundNotification(-1 * $this->getRequestData('mc_gross'));
562+
->registerRefundNotification(-1 * (float)$this->getRequestData('mc_gross'));
563563
$this->_order->addStatusHistoryComment($comment, false);
564564
$this->_order->save();
565565

app/code/core/Mage/Rule/Model/Abstract.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,7 @@ protected function _convertFlatToRecursive(array $data)
319319
$path = explode('--', $id);
320320
$node =& $arr;
321321
for ($i = 0, $l = count($path); $i < $l; $i++) {
322-
if (!isset($node[$key][$path[$i]])) {
323-
$node[$key][$path[$i]] = [];
324-
}
325-
$node =& $node[$key][$path[$i]];
322+
$node =& $node[$key][$path[$i]] ?? [];
326323
}
327324
foreach ($data as $k => $v) {
328325
$node[$k] = $v;

composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.dist.baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3670,11 +3670,6 @@ parameters:
36703670
count: 1
36713671
path: app/code/core/Mage/Rss/Helper/Data.php
36723672

3673-
-
3674-
message: "#^Offset 'actions'\\|'conditions' on array\\{\\} in isset\\(\\) does not exist\\.$#"
3675-
count: 1
3676-
path: app/code/core/Mage/Rule/Model/Abstract.php
3677-
36783673
-
36793674
message: "#^Property Mage_Rule_Model_Abstract\\:\\:\\$_conditions \\(Mage_Rule_Model_Condition_Combine\\) in empty\\(\\) is not falsy\\.$#"
36803675
count: 1

0 commit comments

Comments
 (0)