<?php

//require '/thosts/vij/wp/vendor/autoload.php';
require '/vhosts/vetandlife.ru/vendor/autoload.php';

dbl_config('vetandlife', 'mysql:host=mysql;dbname=vetandlife', 'vetandlife', 'g-34hJk-3-er2');
$currdate = date('Y-m-d H:i:s');

$future_sql = "SELECT ID FROM `wp_posts` WHERE `post_status` = 'future' AND `post_date` <= '$currdate' ";
$future_news = db_get($future_sql);


if (count($future_news) == 0 ){
    echo 'no count';
    exit;
}

foreach ($future_news as $news) {
    
    $upd_sql = "UPDATE `wp_posts` SET `post_status` = 'publish' WHERE `ID` = '${news['ID']}';";
    $result =  db_get($upd_sql);  

}


