This commit is contained in:
2026-02-19 12:32:49 +01:00
6 changed files with 391 additions and 47 deletions

View File

@@ -4,7 +4,11 @@
"AGENTS.md": {
"type": "-",
"size": 2540,
<<<<<<< HEAD
"lmtime": 0,
=======
"lmtime": 1771369610845,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"ajax.php": {
@@ -30,8 +34,13 @@
"class.Api.php": {
"type": "-",
"size": 19358,
<<<<<<< HEAD
"lmtime": 1744498273470,
"modified": true
=======
"lmtime": 1771373591501,
"modified": false
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
},
"class.Campaigns.php": {
"type": "-",
@@ -41,13 +50,19 @@
},
"class.CampaignTerms.php": {
"type": "-",
<<<<<<< HEAD
"size": 20891,
"lmtime": 1771441276763,
=======
"size": 21563,
"lmtime": 1771446539471,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"class.Clients.php": {
"type": "-",
"size": 1603,
<<<<<<< HEAD
"lmtime": 0,
"modified": true
},
@@ -55,12 +70,25 @@
"type": "-",
"size": 117327,
"lmtime": 1771446080190,
=======
"lmtime": 1771446539472,
"modified": false
},
"class.Cron.php": {
"type": "-",
"size": 119789,
"lmtime": 1771446788002,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"class.Products.php": {
"type": "-",
"size": 39363,
<<<<<<< HEAD
"lmtime": 1771440055487,
=======
"lmtime": 1771446539476,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"class.Site.php": {
@@ -71,6 +99,7 @@
},
"class.Users.php": {
"type": "-",
<<<<<<< HEAD
"size": 15829,
"lmtime": 1771198781919,
"modified": true
@@ -79,6 +108,16 @@
"type": "-",
"size": 818,
"lmtime": 0,
=======
"size": 16302,
"lmtime": 1771446539477,
"modified": false
},
"class.XmlFiles.php": {
"type": "-",
"size": 856,
"lmtime": 1771446539477,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
}
},
@@ -86,7 +125,11 @@
"class.Campaigns.php": {
"type": "-",
"size": 10634,
<<<<<<< HEAD
"lmtime": 1771441276763,
=======
"lmtime": 1771446539478,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"class.Clients.php": {
@@ -104,8 +147,13 @@
"class.Products.php": {
"type": "-",
"size": 27192,
<<<<<<< HEAD
"lmtime": 1771170224109,
"modified": true
=======
"lmtime": 1771446539479,
"modified": false
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
},
"class.Users.php": {
"type": "-",
@@ -115,8 +163,13 @@
},
"class.XmlFiles.php": {
"type": "-",
<<<<<<< HEAD
"size": 1410,
"lmtime": 0,
=======
"size": 1453,
"lmtime": 1771446539480,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
}
},
@@ -124,20 +177,42 @@
"class.ClaudeApi.php": {
"type": "-",
"size": 12510,
<<<<<<< HEAD
"lmtime": 1771198088093,
"modified": true
=======
"lmtime": 1771446539481,
"modified": false
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
},
"class.GoogleAdsApi.php": {
"type": "-",
"size": 99181,
<<<<<<< HEAD
"lmtime": 1771444236566,
=======
"lmtime": 1771446539482,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"class.OpenAiApi.php": {
"type": "-",
"size": 18739,
<<<<<<< HEAD
"lmtime": 1771171891986,
"modified": true
=======
"lmtime": 1771446539484,
"modified": false
}
},
"view": {
"class.Users.php": {
"type": "-",
"size": 415,
"lmtime": 1771446539484,
"modified": false
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
}
}
},
@@ -157,21 +232,36 @@
},
"config.php": {
"type": "-",
<<<<<<< HEAD
"size": 515,
"lmtime": 1771444244763,
=======
"size": 571,
"lmtime": 1771449735250,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"cron.php": {
"type": "-",
<<<<<<< HEAD
"size": 1971,
"lmtime": 0,
"modified": true
=======
"size": 1977,
"lmtime": 1771446539486,
"modified": false
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
},
"docs": {
"database.sql": {
"type": "-",
"size": 17320,
<<<<<<< HEAD
"lmtime": 1771440593718,
=======
"lmtime": 1771446539487,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"google_ads_api_design_doc.doc": {
@@ -189,7 +279,11 @@
"memory.md": {
"type": "-",
"size": 2680,
<<<<<<< HEAD
"lmtime": 1771443431441,
=======
"lmtime": 1771446539488,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"PLAN.md": {
@@ -213,9 +307,15 @@
},
"index.php": {
"type": "-",
<<<<<<< HEAD
"size": 3885,
"lmtime": 1771198110809,
"modified": true
=======
"size": 3891,
"lmtime": 1771446539489,
"modified": false
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
},
"install.php": {
"type": "-",
@@ -232,40 +332,69 @@
},
"style.css": {
"type": "-",
<<<<<<< HEAD
"size": 48422,
"lmtime": 1771441569261,
=======
"size": 48423,
"lmtime": 1771446539490,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"style.css.map": {
"type": "-",
"size": 12494,
<<<<<<< HEAD
"lmtime": 1771441569259,
=======
"lmtime": 1771446539491,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"style-old.css": {
"type": "-",
"size": 19791,
<<<<<<< HEAD
"lmtime": 0,
"modified": true
=======
"lmtime": 1771370224943,
"modified": false
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
},
"style-old.scss": {
"type": "-",
"size": 25906,
<<<<<<< HEAD
"lmtime": 0,
"modified": true
=======
"lmtime": 1771370224941,
"modified": false
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
},
"style.scss": {
"type": "-",
"size": 59257,
<<<<<<< HEAD
"lmtime": 1771441540574,
=======
"lmtime": 1771446539492,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
}
},
"libraries": {
"adspro-dialog.css": {
"type": "-",
"size": 6932,
"lmtime": 1771446539493,
"modified": false
},
"adspro-dialog.js": {
"type": "-",
"size": 9505,
"lmtime": 1771367545298,
"size": 10747,
"lmtime": 1771446539494,
"modified": false
},
"bootstrap": {},
@@ -324,12 +453,6 @@
"size": 48385,
"lmtime": 0,
"modified": false
},
"adspro-dialog.css": {
"type": "-",
"size": 6801,
"lmtime": 1771367581706,
"modified": false
}
},
"migrations": {
@@ -354,43 +477,71 @@
"004_campaigns_performance_max_flag.sql": {
"type": "-",
"size": 543,
<<<<<<< HEAD
"lmtime": 0,
=======
"lmtime": 1771372240963,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"005_drop_is_performance_max_column.sql": {
"type": "-",
"size": 505,
<<<<<<< HEAD
"lmtime": 0,
=======
"lmtime": 1771372246305,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"006_products_scope_dimensions.sql": {
"type": "-",
"size": 6350,
<<<<<<< HEAD
"lmtime": 0,
=======
"lmtime": 1771373537593,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"007_clients_merchant_account_id.sql": {
"type": "-",
"size": 123,
<<<<<<< HEAD
"lmtime": 0,
=======
"lmtime": 1771446539495,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"008_products_keyword_planner_terms.sql": {
"type": "-",
"size": 764,
<<<<<<< HEAD
"lmtime": 0,
=======
"lmtime": 1771446539495,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"009_products_merchant_sync_log.sql": {
"type": "-",
"size": 880,
<<<<<<< HEAD
"lmtime": 0,
=======
"lmtime": 1771446539496,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"010_campaign_keywords.sql": {
"type": "-",
"size": 1278,
<<<<<<< HEAD
"lmtime": 1771440593714,
=======
"lmtime": 1771446539497,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"demo_data.sql": {
@@ -407,45 +558,74 @@
"modified": false
},
"templates": {
"allegro": {},
"campaigns": {
"main_view.php": {
"type": "-",
"size": 12379,
"lmtime": 1771371901368,
"modified": false
}
},
"campaign_terms": {
"main_view.php": {
"type": "-",
"size": 81281,
"lmtime": 1771446539498,
"modified": false
}
},
"clients": {
"main_view.php": {
"type": "-",
"size": 7024,
"lmtime": 1771446539499,
"modified": false
}
},
"cron": {},
"html": {},
"products": {
"main_view.php": {
"type": "-",
"size": 49238,
<<<<<<< HEAD
"lmtime": 1771441425576,
=======
"lmtime": 1771446539500,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"product_history.php": {
"type": "-",
<<<<<<< HEAD
"size": 13214,
"lmtime": 1769467103988,
"modified": true
=======
"size": 13302,
"lmtime": 1771446539501,
"modified": false
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
}
},
"site": {
"layout-cron.php": {
"type": "-",
"size": 5764,
"lmtime": 1771367592957,
"size": 5763,
"lmtime": 1771370224949,
"modified": false
},
"layout-logged.php": {
"type": "-",
"size": 7746,
"lmtime": 1771367592216,
"size": 8625,
"lmtime": 1771446539502,
"modified": false
},
"layout-unlogged.php": {
"type": "-",
"size": 2024,
"lmtime": 0,
"modified": true
}
},
"campaigns": {
"main_view.php": {
"type": "-",
"size": 11584,
"lmtime": 1769729268050,
"size": 2023,
"lmtime": 1771370224947,
"modified": false
}
},
@@ -458,25 +638,51 @@
},
"settings.php": {
"type": "-",
"size": 11754,
"lmtime": 1771198773079,
"size": 21626,
"lmtime": 1771446539503,
"modified": false
}
},
"campaign_terms": {
"xml_files": {
"main_view.php": {
"type": "-",
<<<<<<< HEAD
"size": 81281,
"lmtime": 1771441788473,
=======
"size": 2849,
"lmtime": 1771446539504,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
}
}
},
<<<<<<< HEAD
"tmp": {},
"TODO.md": {
"type": "-",
"size": 0,
"lmtime": 0,
=======
"tmp": {
"debug_products_urls.php": {
"type": "-",
"size": 2766,
"lmtime": 1771446539505,
"modified": false
},
"products_data_save.txt": {
"type": "-",
"size": 46550,
"lmtime": 0,
"modified": false
}
},
"TODO.md": {
"type": "-",
"size": 0,
"lmtime": 1771446539470,
>>>>>>> ed59af4a5ab471bdf2eeef28e0335416285baa3a
"modified": false
},
"tools": {},

View File

@@ -220,7 +220,7 @@ class Cron
static public function cron_products_urls()
{
global $mdb;
global $mdb, $settings;
self::touch_cron_invocation( __FUNCTION__ );
$api = new \services\GoogleAdsApi();
@@ -237,10 +237,31 @@ class Cron
$debug_mode = (int) \S::get( 'debug' ) === 1;
if ( $batch_limit <= 0 )
{
$batch_limit = 300;
$batch_limit = (int) ( $settings['cron_products_urls_limit_per_client'] ?? 100 );
}
if ( $batch_limit <= 0 )
{
$batch_limit = 100;
}
$batch_limit = min( 1000, $batch_limit );
$clients_per_run_default = (int) ( $settings['cron_products_urls_clients_per_run'] ?? ( $settings['cron_products_clients_per_run'] ?? 1 ) );
if ( $clients_per_run_default <= 0 )
{
$clients_per_run_default = 1;
}
$clients_per_run = (int) \S::get( 'clients_per_run' );
if ( $clients_per_run <= 0 )
{
$clients_per_run = (int) self::get_setting_value( 'cron_products_urls_clients_per_run', $clients_per_run_default );
}
if ( $clients_per_run <= 0 )
{
$clients_per_run = $clients_per_run_default;
}
$clients_per_run = min( 20, $clients_per_run );
$where = "deleted = 0 AND google_merchant_account_id IS NOT NULL AND google_merchant_account_id <> ''";
if ( $client_id > 0 )
{
@@ -261,6 +282,17 @@ class Cron
exit;
}
$total_clients_available = count( $clients );
if ( $client_id <= 0 )
{
$last_client_cursor = (int) self::get_setting_value( 'cron_products_urls_last_client_id', 0 );
$clients = self::pick_clients_batch_by_cursor( $clients, $clients_per_run, $last_client_cursor );
}
else
{
$clients_per_run = 1;
}
$checked_products = 0;
$updated_urls = 0;
$unresolved_products = 0;
@@ -361,9 +393,21 @@ class Cron
$details[] = $detail_row;
}
if ( $client_id <= 0 && !empty( $clients ) )
{
$last_client = end( $clients );
$last_client_id = (int) ( $last_client['id'] ?? 0 );
if ( $last_client_id > 0 )
{
self::set_setting_value( 'cron_products_urls_last_client_id', (string) $last_client_id );
}
}
echo json_encode( [
'result' => empty( $errors ) ? 'Synchronizacja URL produktow zakonczona.' : 'Synchronizacja URL produktow zakonczona z bledami.',
'total_clients_available' => $total_clients_available,
'processed_clients' => $processed_clients,
'clients_per_run' => $clients_per_run,
'checked_products' => $checked_products,
'updated_urls' => $updated_urls,
'unresolved_products' => $unresolved_products,
@@ -3044,6 +3088,52 @@ class Cron
return 0;
}
static private function pick_clients_batch_by_cursor( $clients, $limit, $cursor_client_id = 0 )
{
$clients = is_array( $clients ) ? array_values( $clients ) : [];
if ( empty( $clients ) )
{
return [];
}
$limit = max( 1, (int) $limit );
$total = count( $clients );
if ( $limit >= $total )
{
return $clients;
}
$start_index = 0;
$cursor_client_id = (int) $cursor_client_id;
if ( $cursor_client_id > 0 )
{
$found_next = false;
foreach ( $clients as $idx => $client )
{
$current_id = (int) ( $client['id'] ?? 0 );
if ( $current_id > $cursor_client_id )
{
$start_index = $idx;
$found_next = true;
break;
}
}
if ( !$found_next )
{
$start_index = 0;
}
}
$batch = [];
for ( $i = 0; $i < $limit; $i++ )
{
$batch[] = $clients[( $start_index + $i ) % $total];
}
return $batch;
}
static private function get_conversion_window_days()
{
$request_value = (int) \S::get( 'conversion_window_days' );

View File

@@ -12,3 +12,4 @@ $settings['email_password'] = 'ProjectPro2025!';
$settings['cron_products_clients_per_run'] = 1;
$settings['cron_campaigns_clients_per_run'] = 1;
$settings['cron_products_urls_limit_per_client'] = 10;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -37,6 +37,8 @@ body {
font-size: 14px;
color: $cText;
background: $cContentBg;
max-width: 100vw;
overflow: hidden;
}
.hide {
@@ -474,7 +476,7 @@ body.logged {
}
}
&.active > .nav-group-label {
&.active>.nav-group-label {
color: $cWhite;
background: rgba($cPrimary, 0.12);
border-left-color: $cPrimary;
@@ -993,7 +995,7 @@ table {
.settings-toggle-checkbox {
display: none;
& + .settings-toggle-switch {
&+.settings-toggle-switch {
display: inline-block;
position: relative;
width: 44px;
@@ -1016,7 +1018,7 @@ table {
}
}
&:checked + .settings-toggle-switch {
&:checked+.settings-toggle-switch {
background: #22C55E;
&::after {
@@ -1205,6 +1207,10 @@ table {
// CAMPAIGNS PAGE
// ===========================
.campaigns-page {
max-width: 100%;
overflow-x: hidden;
width: 100%;
.campaigns-header {
display: flex;
justify-content: space-between;
@@ -1226,11 +1232,13 @@ table {
.campaigns-filters {
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-bottom: 20px;
.filter-group {
flex: 1;
min-width: 0;
label {
display: block;
@@ -1418,13 +1426,25 @@ table {
padding: 20px;
margin-bottom: 20px;
min-height: 350px;
overflow: hidden;
#container {
max-width: 100%;
}
}
.campaigns-table-wrap {
background: $cWhite;
border-radius: 10px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
overflow: hidden;
overflow-x: auto;
-ms-overflow-style: none;
scrollbar-width: none;
max-width: 100%;
&::-webkit-scrollbar {
display: none;
}
.table {
margin: 0;
@@ -1595,7 +1615,9 @@ table {
color: #8899A6;
margin-bottom: 6px;
i { margin-right: 4px; }
i {
margin-right: 4px;
}
}
.form-control {
@@ -1626,9 +1648,17 @@ table {
&.filter-group-client,
&.filter-group-campaign,
&.filter-group-ad-group { flex: 1 1 260px; }
&.filter-group-roas { flex: 0 0 200px; }
&.filter-group-columns { flex: 0 0 240px; }
&.filter-group-ad-group {
flex: 1 1 260px;
}
&.filter-group-roas {
flex: 0 0 200px;
}
&.filter-group-columns {
flex: 0 0 240px;
}
}
}
@@ -1821,7 +1851,9 @@ table {
align-items: center;
margin-bottom: 4px;
label { margin: 0; }
label {
margin: 0;
}
}
.desc-tabs {
@@ -1842,12 +1874,14 @@ table {
color: #666;
transition: all .15s ease;
i { margin-right: 4px; }
i {
margin-right: 4px;
}
&.active {
background: #fff;
color: #333;
box-shadow: 0 1px 3px rgba(0,0,0,.12);
box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
font-weight: 500;
}
@@ -1862,9 +1896,21 @@ table {
}
.desc-preview {
ul, ol { margin: 6px 0; padding-left: 20px; }
li { margin-bottom: 3px; }
b, strong { font-weight: 600; }
ul,
ol {
margin: 6px 0;
padding-left: 20px;
}
li {
margin-bottom: 3px;
}
b,
strong {
font-weight: 600;
}
}
.input-with-ai {
@@ -2251,7 +2297,7 @@ table#products {
background: #E9EEF5;
overflow: hidden;
> span {
>span {
display: block;
height: 100%;
background: linear-gradient(90deg, #5A9BFF 0%, #2E6BDF 100%);
@@ -2560,7 +2606,7 @@ table#products {
}
}
table.campaigns-extra-table > thead > tr > th {
table.campaigns-extra-table>thead>tr>th {
position: sticky;
top: 0;
z-index: 2;
@@ -3048,6 +3094,7 @@ table#products {
}
#products {
th:last-child,
td:last-child {
white-space: nowrap;
@@ -3074,7 +3121,7 @@ table#products {
}
}
.products-page table#products > thead > tr > th {
.products-page table#products>thead>tr>th {
position: sticky;
top: 0;
z-index: 2;
@@ -3137,4 +3184,4 @@ table#products {
content: '\25BC';
color: #FFFFFF;
background: #2563EB;
}
}