Skip to content

Commit

Permalink
1.1.4 release features (#129)
Browse files Browse the repository at this point in the history
* Create SECURITY.md (#127)

* replaced webpack with bun

* wip

* Update wpc2o-options-api.php

* Update wpc2o-options-api.php

* Update .distignore

* Update phpcs.yml

* Bump versiion to 1.1.3

* Update package.json

* WC HPOS compat & stock sync improvements

* phpcs fix
  • Loading branch information
AshleyRedman authored Apr 27, 2024
1 parent dbd6043 commit 8e5c250
Show file tree
Hide file tree
Showing 13 changed files with 206 additions and 110 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ body:
attributes:
label: Plugin version
description: |
e.g `1.1.3`
e.g `1.1.4`
validations:
required: true

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
blank_issues_enabled: false
contact_links:
- name: Help & support - FAQ
url: https://github.com/ajrsoftware/WPClothes2Order/discussions/new?category=q-a&body=%23%23%23%20Your%20question%20here%0A%0A-%20What%20version%20of%20the%20plugin%20are%20you%20using%3F%20e.g%20%601.1.3%60%0A-%20What%20PHP%20version%20are%20you%20using%3F%20e.g%20%607.4%60%0A-%20Where%20did%20you%20install%20the%20plugin%20from%3F%20e.g%20%60WordPress%20org%60%0A%0A---
url: https://github.com/ajrsoftware/WPClothes2Order/discussions/new?category=q-a&body=%23%23%23%20Your%20question%20here%0A%0A-%20What%20version%20of%20the%20plugin%20are%20you%20using%3F%20e.g%20%601.1.4%60%0A-%20What%20PHP%20version%20are%20you%20using%3F%20e.g%20%607.4%60%0A-%20Where%20did%20you%20install%20the%20plugin%20from%3F%20e.g%20%60WordPress%20org%60%0A%0A---
about: "If you can't get something to work the way you expect, check out our FAQ's."
- name: Feature Request
url: https://github.com/ajrsoftware/WPClothes2Order/discussions/new?category=ideas
Expand Down
80 changes: 40 additions & 40 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ on:

jobs:
# PHP 7.4
phpcs-7_4:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP Action
uses: shivammathur/[email protected]
with:
php-version: '7.4'
tools: composer:v2, phpcs

- name: Install dependencies
working-directory: ./
run: composer install

- name: Run phpcs
working-directory: ./
run: vendor/bin/phpcs
# phpcs-7_4:
# timeout-minutes: 10
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2

# - name: Setup PHP Action
# uses: shivammathur/[email protected]
# with:
# php-version: '7.4'
# tools: composer:v2, phpcs

# - name: Install dependencies
# working-directory: ./
# run: composer install

# - name: Run phpcs
# working-directory: ./
# run: vendor/bin/phpcs
# PHP 8.0
phpcs-8_0:
timeout-minutes: 10
Expand Down Expand Up @@ -95,23 +95,23 @@ jobs:
working-directory: ./
run: vendor/bin/phpcs
# PHP 8.3
phpcs-8_3:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP Action
uses: shivammathur/[email protected]
with:
php-version: '8.3'
tools: composer:v2, phpcs

- name: Install dependencies
working-directory: ./
run: composer install

- name: Run phpcs
working-directory: ./
run: vendor/bin/phpcs
# phpcs-8_3:
# timeout-minutes: 10
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2

# - name: Setup PHP Action
# uses: shivammathur/[email protected]
# with:
# php-version: '8.3'
# tools: composer:v2, phpcs

# - name: Install dependencies
# working-directory: ./
# run: composer install

# - name: Run phpcs
# working-directory: ./
# run: vendor/bin/phpcs
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

- Contributors: [Ashley Redman](https://github.com/AshleyRedman), [Reuben Porter](https://github.com/ReubenPorter)
- Tags: woocommerce, clothes2order
- Requires at least: 5.8
- Tested up to: 6.4
- Requires PHP: 7.4
- Stable tag: 1.1.3
- Requires at least: 6.0
- Requires PHP: 8.0
- Tested up to: 8.2
- WC requires at least: 8.0
- WC tested up to: 8.8
- License: GPLv3
- License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

| Version | Supported |
| ------- | ------------------ |
| 1.1.3 | :white_check_mark: |
| > 1.1.3 | :x: |
| 1.1.4 | :white_check_mark: |
| > 1.1.4 | :x: |

## Reporting a Vulnerability

Expand Down
Binary file modified bun.lockb
Binary file not shown.
45 changes: 37 additions & 8 deletions classes/WPC2O_Stock_Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,46 @@ private function create_file_name(): void

private function read_products_csv_to_batches($fileparam): array
{
$file_array = array();
global $wpdb; // Access WordPress database functions

$file = fopen($fileparam, 'r');
while (( $line = fgetcsv($file) ) !== false) {
$file_array[] = $line;
}
fclose($file);
$batches = array();

$file = new SplFileObject($fileparam);
$file->setFlags(SplFileObject::READ_CSV);
$file->setCsvControl(',', '"', '\\');

// Skip the header line
$file->seek(1);

array_shift($file_array);
$batch_size = 800;
$batch = array();

while (!$file->eof()) {
$line = $file->fgetcsv();

if ($line === false) {
break;
}

$batches = array_chunk($file_array, 800);
$batch[] = $line;

if (count($batch) >= $batch_size) {
// Convert $batch into a format suitable for storing in the database
// For example, if you're storing each line as a separate record in a custom table:
// $wpdb->insert( $table_name, $batch ); // $batch should be an array of arrays
// Adjust this part according to your plugin's database structure

$batches[] = $batch;
$batch = array();
}
}

// Add the last batch if it's not empty
if (!empty($batch)) {
// Insert the last batch into the database
// $wpdb->insert( $table_name, $batch );
$batches[] = $batch;
}

return $batches;
}
Expand Down
Loading

0 comments on commit 8e5c250

Please sign in to comment.