Haideți băieți și cu soluție pentru mine…
Ultimul log de erori:
[06-Apr-2018 01:30:13 UTC] PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1615 Prepared statement needs to be re-prepared in /home/user/public_html/private/Model/DB.php:111
Stack trace:
#0 /home/user/public_html/private/Model/DB.php(111): PDOStatement->execute()
#1 /home/user/public_html/private/Model/DB.php(72): DB::query('select', 'select category...', Array)
#2 /home/user/public_html/private/Controller/Cron/NOD_categories.php(126): DB::select('\r\n\t\t\t\t\tSELECT\r\n...', Array)
#3 /home/user/public_html/private/Model/Dom.php(97): require_once('/home/user/publ...')
#4 /home/user/public_html/index.php(28): Dom::show()
#5 {main}
thrown in /home/user/public_html/private/Model/DB.php on line 111
[06-Apr-2018 01:30:59 UTC] PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1615 Prepared statement needs to be re-prepared in /home/user/public_html/private/Model/DB.php:111
Stack trace:
#0 /home/user/public_html/private/Model/DB.php(111): PDOStatement->execute()
#1 /home/user/public_html/private/Model/DB.php(72): DB::query('select', 'select category...', Array)
#2 /home/user/public_html/private/Controller/Cron/EMAG_categories.php(105): DB::select('\r\n\t\t\t\t\t\tSELECT\r...', Array)
#3 /home/user/public_html/private/Model/Dom.php(97): require_once('/home/user/publ...')
#4 /home/user/public_html/index.php(28): Dom::show()
#5 {main}
thrown in /home/user/public_html/private/Model/DB.php on line 111
[06-Apr-2018 01:40:05 UTC] PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1615 Prepared statement needs to be re-prepared in /home/user/public_html/private/Model/DB.php:111
Stack trace:
#0 /home/user/public_html/private/Model/DB.php(111): PDOStatement->execute()
#1 /home/user/public_html/private/Model/DB.php(90): DB::query('update', 'update site_pro...', Array)
#2 /home/user/public_html/private/Controller/Cron/NOD_products_update.php(98): DB::update('\r\n\t\tUPDATE\r\n\t\t\t...', Array)
#3 /home/user/public_html/private/Model/Dom.php(97): require_once('/home/user/publ...')
#4 /home/user/public_html/index.php(28): Dom::show()
#5 {main}
thrown in /home/user/public_html/private/Model/DB.php on line 111
[06-Apr-2018 05:20:32 UTC] PHP Fatal error: Uncaught SoapFault exception: [soap:Client] Server was unable to process the request in /home/user/public_html/private/Controller/Cron/ABC_categories.php:33
Stack trace:
#0 /home/user/public_html/private/Controller/Cron/ABC_categories.php(33): SoapClient->__call('GetPriceListHie...', Array)
#1 /home/user/public_html/private/Model/Dom.php(97): require_once('/home/user/publ...')
#2 /home/user/public_html/index.php(28): Dom::show()
#3 {main}
thrown in /home/user/public_html/private/Controller/Cron/ABC_categories.php on line 33
[06-Apr-2018 05:30:09 UTC] PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1615 Prepared statement needs to be re-prepared in /home/user/public_html/private/Model/DB.php:111
Stack trace:
#0 /home/user/public_html/private/Model/DB.php(111): PDOStatement->execute()
#1 /home/user/public_html/private/Model/DB.php(90): DB::query('update', 'update nod_cate...', Array)
#2 /home/user/public_html/private/Controller/Cron/NOD_categories.php(196): DB::update('\r\n\t\t\t\t\t\tUPDATE\r...', Array)
#3 /home/user/public_html/private/Model/Dom.php(97): require_once('/home/user/publ...')
#4 /home/user/public_html/index.php(28): Dom::show()
#5 {main}
thrown in /home/user/public_html/private/Model/DB.php on line 111
[06-Apr-2018 05:33:42 UTC] PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1615 Prepared statement needs to be re-prepared in /home/user/public_html/private/Model/DB.php:111
Stack trace:
#0 /home/user/public_html/private/Model/DB.php(111): PDOStatement->execute()
#1 /home/user/public_html/private/Model/DB.php(72): DB::query('select', 'select category...', Array)
#2 /home/user/public_html/private/Controller/Cron/EMAG_categories.php(105): DB::select('\r\n\t\t\t\t\t\tSELECT\r...', Array)
#3 /home/user/public_html/private/Model/Dom.php(97): require_once('/home/user/publ...')
#4 /home/user/public_html/index.php(28): Dom::show()
#5 {main}
thrown in /home/user/public_html/private/Model/DB.php on line 111
Un fișier în urma căruia primesc erori (EMAG_categories.php):
<?php
### Check if we can make updates ###
$get_one_updated_data = DB::select("
SELECT
category_id
FROM
emag_categories
WHERE
AddDate(category_last_update, INTERVAL 10 MINUTE) > ?
LIMIT 1
", [
DT::get()
]);
### If updates found in last 10 minutes, then exit ###
if(count($get_one_updated_data) == 1)
{
exit();
}
### Start date ###
$start_date_of_insert_or_update = DT::get();
### Get emag categories ###
EMAG::connect('/category/read');
### If error on API ###
if(EMAG::$is_error)
{
error_log("Something went wrong. Getting emag categories results failed! Error: ".EMAG::$error_msg);
}
### If no emag result ###
elseif(!EMAG::$results)
{
error_log("Something went wrong. Getting emag categories failed!");
}
### Else, all seems to be good until now ###
else
{
# If the results is not an array or is empty #
if(!is_array(EMAG::$results) || empty(EMAG::$results))
{
error_log("Something went wrong. Getting emag categories results failed!");
}
# Else, the results is in correct format #
else
{
# For each category #
foreach(EMAG::$results as $category)
{
# Get emag category again #
EMAG::connect('/category/read', 'GET', ['id' => $category['id']]);
# If error on API #
if(EMAG::$is_error)
{
error_log("Something went wrong. Getting emag category ".$category['id']." results failed! Error: ".EMAG::$error_msg);
}
# If no emag result #
elseif(!EMAG::$results)
{
error_log("Something went wrong. Getting emag category ".$category['id']." failed!");
}
# Else, all seems to be good until now #
else
{
# If the results is not an array or is empty #
if(!is_array(EMAG::$results) || count(EMAG::$results) != 1)
{
error_log("Something went wrong. Getting emag category ".$category['id']." results is empty or bigger than 1!");
}
# Else, the results is in correct format #
else
{
# Category #
$category = EMAG::$results[0];
# If is_allowed field not set #
if(!isset($category['is_allowed']) || !Useful::check_int($category['is_allowed']))
{
$category['is_allowed'] = 0;
}
# If parent_id field not set #
if(!isset($category['parent_id']) || !Useful::check_int($category['parent_id']))
{
$category['parent_id'] = 0;
}
# Sanitize filters #
$category['characteristics'] = serialize($category['characteristics']);
# Remove empty spaces from category id #
$category['id'] = trim($category['id']);
# Check category if is in our database #
$get_category_if_exists = DB::select("
SELECT
category_id
FROM
emag_categories
WHERE
category_external_id = ?
", [
$category['id'],
]);
# If category found in database more than once #
if(count($get_category_if_exists) > 1)
{
error_log("Something went wrong. Emag category ".$category['id']." is in database more than once!");
}
# Else, if category found once #
elseif(count($get_category_if_exists) == 1)
{
# Begin transaction #
DB::begin();
# Update category #
$update_category = DB::update("
UPDATE
emag_categories
SET
category_name = ?,
category_external_parent_id = ?,
category_is_allowed = ?,
category_is_ean_mandatory = ?,
category_filters = ?,
category_last_update = ?
WHERE
category_id = ?
", [
$category['name'],
$category['parent_id'],
$category['is_allowed'],
$category['is_ean_mandatory'] ? 1 : 0,
$category['characteristics'],
DT::get(),
$get_category_if_exists[0]['category_id'],
]);
# If category updated #
if($update_category == 1)
{
DB::commit();
}
# Else, if category NOT updated #
else
{
DB::rollback();
error_log("Can't update Emag category with ID ".$get_category_if_exists[0]['category_id'].".");
}
}
# Else, category not found #
else
{
# Begin transaction #
DB::begin();
# Insert category #
$insert_category = DB::insert("
INSERT INTO
emag_categories
(
category_name,
category_external_id,
category_external_parent_id,
category_is_allowed,
category_is_ean_mandatory,
category_filters,
category_last_update
)
VALUES
(
?, ?, ?, ?, ?, ?, ?
)
", [
$category['name'],
$category['id'],
$category['parent_id'],
$category['is_allowed'],
$category['is_ean_mandatory'] ? 1 : 0,
$category['characteristics'],
DT::get()
]);
# If category inserted #
if($insert_category == 1)
{
DB::commit();
}
# Else, if category NOT inserted #
else
{
DB::rollback();
error_log("Can't insert emag category in cron.");
}
}
}
}
}
}
}
### Count affected emag categories ###
$check_categories = DB::count("
SELECT
COUNT(*)
FROM
emag_categories
WHERE
category_last_update >= ?
", [
$start_date_of_insert_or_update
]);
### If there was less than 5 categories affected, something went bad ###
if($check_categories < 5)
{
error_log("Something went very bad on emag categories. Less than 5 categories inserted/updated !");
}
### Else, we can delete categories where update or insert wasn't made - This means that categories were not found anymore in emag marketplace ###
else
{
# Delete categories #
DB::begin();
$deleted = DB::delete("
DELETE FROM
emag_categories
WHERE
category_last_update < ?
", [
$start_date_of_insert_or_update
]);
DB::commit();
# Leave a message to admin #
if($deleted > 0)
{
Logs::insert($deleted." emag ".($deleted == 1 ? 'category was' : 'categories were')." deleted from database. This is because you are not allowed anymore to insert products in ".($deleted == 1 ? 'this' : 'those')." categories, or ".($deleted == 1 ? 'it was' : 'were')." removed from Emag Marketplace.");
}
}
Ce să fie, ce să fie ?