From 392aef0fbeacbb5311ae56fbd40272651232878b Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Mon, 14 Oct 2024 15:42:52 +0200 Subject: [PATCH 1/3] Added workflow to automatically sync OM --- .github/workflows/sync-om.yml | 79 +++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/sync-om.yml diff --git a/.github/workflows/sync-om.yml b/.github/workflows/sync-om.yml new file mode 100644 index 00000000..8860f718 --- /dev/null +++ b/.github/workflows/sync-om.yml @@ -0,0 +1,79 @@ +name: Sync daily OM commits to Maho + +on: + schedule: + - cron: '0 6 * * *' # Run at 6 AM UTC every day + workflow_dispatch: + +jobs: + sync-om: + runs-on: ubuntu-latest + steps: + - name: Checkout Maho + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + + - name: Fetch OM updates and create PRs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Fetch OpenMage repository + git remote add upstream https://github.com/OpenMage/magento-lts.git + git fetch upstream + + # Get yesterday's date + yesterday=$(date -d "yesterday" +%Y-%m-%d) + + # Get list of commits from yesterday + commits=$(git log --since="$yesterday 00:00:00" --until="$yesterday 23:59:59" --format="%H" upstream/main) + + # Function to create a PR for a commit + create_pr_for_commit() { + commit_hash=$1 + branch_name="sync-openmage-${commit_hash:0:8}" + + # Create a new branch + git checkout -b "$branch_name" + + # Cherry-pick the commit + if git cherry-pick "$commit_hash"; then + # Push the branch + git push -u origin "$branch_name" + + # Get commit message + commit_msg=$(git log -1 --pretty=format:"%s" "$commit_hash") + + # Check if the commit is from a PR + pr_number=$(git log -1 --pretty=format:"%b" "$commit_hash" | grep -oP "(?<=Pull Request #)\d+") + + if [ -n "$pr_number" ]; then + pr_title="OM PR $pr_number" + else + pr_title="OM commit: $commit_hash" + fi + + # Create PR + gh pr create --title "$pr_title" --body "This PR syncs the OpenMage commit: $commit_hash + + Original commit message: $commit_msg + + For more details, see: https://github.com/OpenMage/magento-lts/commit/$commit_hash" + else + echo "Failed to cherry-pick commit $commit_hash. Skipping." + git cherry-pick --abort + fi + + # Return to main branch + git checkout main + } + + # Process each commit + for commit in $commits; do + create_pr_for_commit "$commit" + done \ No newline at end of file From 43669e44deee5fdba09d4854b5026e756e46abb1 Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Mon, 14 Oct 2024 20:05:54 +0200 Subject: [PATCH 2/3] Further removal of Mage_Sendfriend module --- .../Mage/Adminhtml/Helper/Help/Mapping.php | 1 - .../core/Mage/Adminhtml/etc/adminhtml.xml | 4 --- .../core/Mage/Catalog/Block/Product/View.php | 11 ------- app/code/core/Mage/Catalog/Helper/Product.php | 16 ---------- app/code/core/Mage/Catalog/Model/Session.php | 2 -- .../core_setup/mysql4-upgrade-0.7.8-0.7.9.php | 1 - .../Mage/Reports/Model/Event/Observer.php | 17 ----------- .../reports_setup/data-install-1.6.0.0.php | 4 --- app/code/core/Mage/Reports/etc/config.xml | 8 ----- .../reports_setup/mysql4-install-0.7.1.php | 1 - .../mysql4-upgrade-0.7.0-0.7.1.php | 1 - .../template/catalog/product/view.phtml | 4 --- .../catalog/product/view/sharing.phtml | 4 --- .../en_US/template/email/product_share.html | 30 ------------------- .../Commands/LegacyRenameMysql4Classes.php | 1 - 15 files changed, 105 deletions(-) delete mode 100644 app/locale/en_US/template/email/product_share.html diff --git a/app/code/core/Mage/Adminhtml/Helper/Help/Mapping.php b/app/code/core/Mage/Adminhtml/Helper/Help/Mapping.php index f791d6f3..eabb2f18 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Help/Mapping.php +++ b/app/code/core/Mage/Adminhtml/Helper/Help/Mapping.php @@ -151,7 +151,6 @@ abstract class Mage_Adminhtml_Helper_Help_Mapping extends Mage_Core_Helper_Abstr 'system_config/edit/section/cataloginventory' => 'configuration/catalog/inventory.html', 'system_config/edit/section/sitemap' => 'configuration/catalog/google-sitemap.html', 'system_config/edit/section/rss' => 'configuration/catalog/rss-feeds.html', - 'system_config/edit/section/sendfriend' => 'configuration/catalog/email-to-a-friend.html', 'system_config/edit/section/newsletter' => 'configuration/customers/newsletter.html', 'system_config/edit/section/customer' => 'configuration/customers/customer-configuration.html', 'system_config/edit/section/wishlist' => 'configuration/customers/wishlist.html', diff --git a/app/code/core/Mage/Adminhtml/etc/adminhtml.xml b/app/code/core/Mage/Adminhtml/etc/adminhtml.xml index a9851513..9e22acbb 100644 --- a/app/code/core/Mage/Adminhtml/etc/adminhtml.xml +++ b/app/code/core/Mage/Adminhtml/etc/adminhtml.xml @@ -194,10 +194,6 @@ Currency Setup 120 - - Email to a Friend - 140 - Admin 100 diff --git a/app/code/core/Mage/Catalog/Block/Product/View.php b/app/code/core/Mage/Catalog/Block/Product/View.php index 77a7cf36..0680f8bc 100644 --- a/app/code/core/Mage/Catalog/Block/Product/View.php +++ b/app/code/core/Mage/Catalog/Block/Product/View.php @@ -91,17 +91,6 @@ public function getProduct() return Mage::registry('product'); } - /** - * Check if product can be emailed to friend - * - * @return bool - */ - public function canEmailToFriend() - { - $sendToFriendModel = Mage::registry('send_to_friend_model'); - return $sendToFriendModel && $sendToFriendModel->canEmailToFriend(); - } - /** * Retrieve url for direct adding product to cart * diff --git a/app/code/core/Mage/Catalog/Helper/Product.php b/app/code/core/Mage/Catalog/Helper/Product.php index 74e7c6b3..ca977110 100644 --- a/app/code/core/Mage/Catalog/Helper/Product.php +++ b/app/code/core/Mage/Catalog/Helper/Product.php @@ -149,22 +149,6 @@ public function getThumbnailUrl($product) return $url; } - /** - * @param Mage_Catalog_Model_Product $product - * @return string - */ - public function getEmailToFriendUrl($product) - { - $categoryId = null; - if ($category = Mage::registry('current_category')) { - $categoryId = $category->getId(); - } - return $this->_getUrl('sendfriend/product/send', [ - 'id' => $product->getId(), - 'cat_id' => $categoryId - ]); - } - /** * @return array */ diff --git a/app/code/core/Mage/Catalog/Model/Session.php b/app/code/core/Mage/Catalog/Model/Session.php index 5a1424d5..3cd31351 100644 --- a/app/code/core/Mage/Catalog/Model/Session.php +++ b/app/code/core/Mage/Catalog/Model/Session.php @@ -24,8 +24,6 @@ * @method int getLastVisitedCategoryId() * @method string getLimitPage() * @method bool getParamsMemorizeDisabled() - * @method array getSendfriendFormData() - * @method $this setSendfriendFormData(array $value) * @method string getSortDirection() * @method string getSortOrder() * @method $this unsDisplayMode() diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.8-0.7.9.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.8-0.7.9.php index 2f135c11..4ea59a09 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.8-0.7.9.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.8-0.7.9.php @@ -31,7 +31,6 @@ 'sales_email/creditmemo_comment/template' => 'sales_email_creditmemo_comment_template', 'sales_email/shipment/template' => 'sales_email_shipment_template', 'sales_email/shipment_comment/template' => 'sales_email_shipment_comment_template', - 'sendfriend/email/template' => 'sendfriend_email_template', 'sitemap/generate/error_email_template' => 'sitemap_generate_error_email_template', 'wishlist/email/email_template' => 'wishlist_email_email_template', ]; diff --git a/app/code/core/Mage/Reports/Model/Event/Observer.php b/app/code/core/Mage/Reports/Model/Event/Observer.php index 4ff60381..33320c34 100644 --- a/app/code/core/Mage/Reports/Model/Event/Observer.php +++ b/app/code/core/Mage/Reports/Model/Event/Observer.php @@ -130,23 +130,6 @@ public function catalogProductView(Varien_Event_Observer $observer) return $this->_event(Mage_Reports_Model_Event::EVENT_PRODUCT_VIEW, $productId); } - /** - * Send Product link to friends action - * - * @return $this - */ - public function sendfriendProduct(Varien_Event_Observer $observer) - { - if (!$this->_enabledReports) { - return $this; - } - - return $this->_event( - Mage_Reports_Model_Event::EVENT_PRODUCT_SEND, - $observer->getEvent()->getProduct()->getId() - ); - } - /** * Remove Product from Compare Products action * diff --git a/app/code/core/Mage/Reports/data/reports_setup/data-install-1.6.0.0.php b/app/code/core/Mage/Reports/data/reports_setup/data-install-1.6.0.0.php index 3eb8c414..d363db5d 100644 --- a/app/code/core/Mage/Reports/data/reports_setup/data-install-1.6.0.0.php +++ b/app/code/core/Mage/Reports/data/reports_setup/data-install-1.6.0.0.php @@ -21,10 +21,6 @@ 'event_type_id' => Mage_Reports_Model_Event::EVENT_PRODUCT_VIEW, 'event_name' => 'catalog_product_view' ], - [ - 'event_type_id' => Mage_Reports_Model_Event::EVENT_PRODUCT_SEND, - 'event_name' => 'sendfriend_product' - ], [ 'event_type_id' => Mage_Reports_Model_Event::EVENT_PRODUCT_COMPARE, 'event_name' => 'catalog_product_compare_add_product' diff --git a/app/code/core/Mage/Reports/etc/config.xml b/app/code/core/Mage/Reports/etc/config.xml index ffcf2d96..e0ef368c 100644 --- a/app/code/core/Mage/Reports/etc/config.xml +++ b/app/code/core/Mage/Reports/etc/config.xml @@ -128,14 +128,6 @@ - - - - reports/event_observer - sendfriendProduct - - - diff --git a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-install-0.7.1.php b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-install-0.7.1.php index 68377f3c..3e29fd0a 100644 --- a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-install-0.7.1.php +++ b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-install-0.7.1.php @@ -25,7 +25,6 @@ INSERT INTO {$this->getTable('report_event_types')} VALUES (1, 'catalog_product_view'), -(2, 'sendfriend_product'), (3, 'catalog_product_compare_add_product'), (4, 'checkout_cart_add_product'), (5, 'wishlist_add_product'), diff --git a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.0-0.7.1.php index 338cfdda..c615f923 100644 --- a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -25,7 +25,6 @@ INSERT INTO {$this->getTable('report_event_types')} VALUES (1, 'catalog_product_view'), -(2, 'sendfriend_product'), (3, 'catalog_product_compare_add_product'), (4, 'checkout_cart_add_product'), (5, 'wishlist_add_product'), diff --git a/app/design/frontend/base/default/template/catalog/product/view.phtml b/app/design/frontend/base/default/template/catalog/product/view.phtml index b474cc93..7e58a000 100644 --- a/app/design/frontend/base/default/template/catalog/product/view.phtml +++ b/app/design/frontend/base/default/template/catalog/product/view.phtml @@ -40,10 +40,6 @@

productAttribute($_product, $_product->getName(), 'name') ?>

- canEmailToFriend()): ?> - - - getReviewsSummaryHtml($_product, false, true) ?> getChildHtml('alert_urls') ?> getChildHtml('product_type_data') ?> diff --git a/app/design/frontend/rwd/default/template/catalog/product/view/sharing.phtml b/app/design/frontend/rwd/default/template/catalog/product/view/sharing.phtml index 1ac26b41..0ac9dad4 100644 --- a/app/design/frontend/rwd/default/template/catalog/product/view/sharing.phtml +++ b/app/design/frontend/rwd/default/template/catalog/product/view/sharing.phtml @@ -15,10 +15,6 @@ helper('wishlist')->getAddUrlWithCustomParams($_product, [], false); ?>